Skip to content

Commit

Permalink
fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest committed Jan 13, 2023
1 parent 5a04762 commit 701681b
Show file tree
Hide file tree
Showing 34 changed files with 64 additions and 124 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ loom {
}
runConfigs {
client {
vmArgs.remove("-XstartOnFirstThread")
ideConfigGenerated = true
}
}
Expand All @@ -57,7 +58,7 @@ dependencies {
mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9")
forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9")

compileOnly('cc.polyfrost:oneconfig-1.8.9-forge:0.1.0-alpha+')
compileOnly('cc.polyfrost:oneconfig-1.8.9-forge:0.2.0-alpha+')
include('cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-alpha+')
compileOnly('org.spongepowered:mixin:0.7.11-SNAPSHOT')

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ org.gradle.jvmargs=-Xmx2G

mod_name = Hytils Reborn
mod_id = hytils-reborn
mod_version = 1.5.1-beta2
mod_version = 1.5.1-beta3

loom.platform = forge
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import cc.polyfrost.oneconfig.utils.commands.annotations.Description;
import cc.polyfrost.oneconfig.utils.commands.annotations.Main;
import cc.woverflow.hytils.HytilsReborn;
import com.mojang.authlib.GameProfile;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
Expand Down Expand Up @@ -54,7 +54,7 @@ private void handle() {
}

@Main
private void handle(@Description("Player Name") EntityPlayer player) {
private void handle(@Description("Player Name") GameProfile player) {
if (usernameRegex.matcher(player.getName()).matches()) {
playerName = player.getName();

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/cc/woverflow/hytils/command/HytilsCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import cc.woverflow.hytils.command.parser.*;
import cc.woverflow.hytils.config.HytilsConfig;
import cc.woverflow.hytils.util.HypixelAPIUtils;
import net.minecraft.entity.player.EntityPlayer;
import com.mojang.authlib.GameProfile;
import net.minecraft.util.EnumChatFormatting;
import org.jetbrains.annotations.Nullable;

Expand All @@ -49,7 +49,7 @@ private void handleDefault() {

@SubCommand(description = "Shows your guild experience", aliases = {"guildexp", "guildexperience"})
@SuppressWarnings("SameParameterValue")
private void gexp(@Description("username") @Nullable EntityPlayer player, @Description("type") @Nullable GEXPType type) {
private void gexp(@Description("username") @Nullable GameProfile player, @Description("type") @Nullable GEXPType type) {
Multithreading.runAsync(() -> {
if (HytilsConfig.apiKey.isEmpty() || !HypixelAPIUtils.isValidKey(HytilsConfig.apiKey)) {
HytilsReborn.INSTANCE.sendMessage(EnumChatFormatting.RED + "You need to provide a valid API key to run this command! Type /api new to autoset a key.");
Expand Down Expand Up @@ -104,7 +104,7 @@ private void gexp(@Description("username") @Nullable EntityPlayer player, @Descr

@SubCommand(description = "Shows your winstreak", aliases = {"winstreak", "ws"})
@SuppressWarnings("SameParameterValue")
private void winstreak(@Description("username") @Nullable EntityPlayer player, @Description("type") @Nullable WinstreakType gamemode) {
private void winstreak(@Description("username") @Nullable GameProfile player, @Description("type") @Nullable WinstreakType gamemode) {
Multithreading.runAsync(() -> {
if (HytilsConfig.apiKey.isEmpty() || !HypixelAPIUtils.isValidKey(HytilsConfig.apiKey)) {
HytilsReborn.INSTANCE.sendMessage(EnumChatFormatting.RED + "You need to provide a valid API key to run this command! Type /api new to autoset a key.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.mojang.authlib.GameProfile;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import org.apache.commons.io.Charsets;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -84,7 +84,7 @@ private void handle() {
}

//@Main
private void handle(@Description("Player Name") EntityPlayer playerName, @Description("Time") @Greedy String time) {
private void handle(@Description("Player Name") GameProfile playerName, @Description("Time") @Greedy String time) {
Multithreading.runAsync(() -> {
try {
long millis = addMillis(time.replace(",", "").replace(" ", ""));
Expand All @@ -104,12 +104,12 @@ private void handle(@Description("Player Name") EntityPlayer playerName, @Descri
}

@SubCommand(description = "Adds a player to the ignore list for a specified amount of time.")
private void add(@Description("Player Name") EntityPlayer playerName, @Description("Time") @Greedy String time) {
private void add(@Description("Player Name") GameProfile playerName, @Description("Time") @Greedy String time) {
handle(playerName, time);
}

@SubCommand(description = "Removes a player from the ignore list.")
private void remove(@Description("Player Name") EntityPlayer playerName) {
private void remove(@Description("Player Name") GameProfile playerName) {
json.remove(playerName.getName());
Multithreading.runAsync(() -> {
try {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/cc/woverflow/hytils/command/PlayCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import cc.polyfrost.oneconfig.libs.universal.ChatColor;
import cc.polyfrost.oneconfig.libs.universal.UChat;
import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
import cc.polyfrost.oneconfig.utils.Multithreading;
import cc.polyfrost.oneconfig.utils.NetworkUtils;
import cc.polyfrost.oneconfig.utils.commands.CommandManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import cc.polyfrost.oneconfig.utils.commands.annotations.Main;
import cc.polyfrost.oneconfig.utils.commands.annotations.SubCommand;
import cc.woverflow.hytils.HytilsReborn;
import net.minecraft.entity.player.EntityPlayer;
import com.mojang.authlib.GameProfile;

import java.util.Set;

Expand All @@ -38,7 +38,7 @@ public void handle() {
}

@Main(description = "Adds or removes a player from the silent list")
private void player(EntityPlayer player) {
private void player(GameProfile player) {
String name = player.getName();
final Set<String> silentUsers = HytilsReborn.INSTANCE.getSilentRemoval().getSilentUsers();
if (silentUsers.contains(name)) {
Expand All @@ -52,7 +52,7 @@ private void player(EntityPlayer player) {
}

@SubCommand(description = "Adds a player to the silent list")
private void add(EntityPlayer entityPlayer) {
private void add(GameProfile entityPlayer) {
player(entityPlayer);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import cc.polyfrost.oneconfig.utils.commands.annotations.Main;
import cc.woverflow.hytils.HytilsReborn;
import com.google.common.collect.Sets;
import com.mojang.authlib.GameProfile;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
Expand Down Expand Up @@ -56,7 +56,7 @@ private void handle() {
}

@Main
private void handle(@Description("Player Name") EntityPlayer player) {
private void handle(@Description("Player Name") GameProfile player) {
if (usernameRegex.matcher(player.getName()).matches()) {
playerName = player.getName();
if (SKYBLOCK_IN_ALL_LANGUAGES.contains(EnumChatFormatting.getTextWithoutFormattingCodes(Minecraft.getMinecraft().theWorld
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/cc/woverflow/hytils/config/HytilsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,11 @@ public class HytilsConfig extends Config {
category = "API",
secure = true
)
@HypixelKey
public static String apiKey = "";

// Automatic

@Switch(
name = "Automatically Get API Key",
category = "Automatic", subcategory = "API"
)
public static boolean autoGetAPI = true;

@Switch(
name = "Auto Start",
category = "Automatic", subcategory = "General"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import cc.polyfrost.oneconfig.libs.caffeine.cache.Caffeine;
import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
import cc.polyfrost.oneconfig.utils.NetworkUtils;
import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawInfo;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawUtil;
import cc.woverflow.hytils.HytilsReborn;
import cc.woverflow.hytils.util.HypixelAPIUtils;
import com.google.gson.JsonObject;
Expand Down Expand Up @@ -58,10 +58,10 @@ public class HeightHandler {

public int getHeight() {
if (currentHeight != -2) return currentHeight;
if (HypixelUtils.INSTANCE.getLocrawInfo() == null || jsonObject == null || HytilsReborn.INSTANCE.getLobbyChecker().playerIsInLobby())
if (LocrawUtil.INSTANCE.getLocrawInfo() == null || jsonObject == null || HytilsReborn.INSTANCE.getLobbyChecker().playerIsInLobby())
return -1;
try {
LocrawInfo locraw = HypixelUtils.INSTANCE.getLocrawInfo();
LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo();
if (HypixelAPIUtils.isBedwars) {
if (locraw.getMapName() != null && !locraw.getMapName().trim().isEmpty()) {
String map = locraw.getMapName().toLowerCase(Locale.ENGLISH).replace(" ", "_");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ public ChatHandler() {
this.registerModule(new WhitePrivateMessages());

// Triggers

this.registerModule(new AutoAPI());
this.registerModule(new AutoChatReportConfirm());
this.registerModule(new AutoChatReportConfirm());
this.registerModule(new AutoChatSwapper());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
package cc.woverflow.hytils.handlers.chat;

import cc.polyfrost.oneconfig.libs.universal.ChatColor;
import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawInfo;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawUtil;
import cc.woverflow.hytils.HytilsReborn;
import cc.woverflow.hytils.config.HytilsConfig;
import cc.woverflow.hytils.handlers.language.LanguageData;
Expand Down Expand Up @@ -96,7 +96,7 @@ default LanguageData getLanguage() {
*/
@Nullable
default LocrawInfo getLocraw() {
return HypixelUtils.INSTANCE.getLocrawInfo();
return LocrawUtil.INSTANCE.getLocrawInfo();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

package cc.woverflow.hytils.handlers.chat.modules.blockers;

import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawInfo;
import cc.woverflow.hytils.HytilsReborn;
import cc.woverflow.hytils.config.HytilsConfig;
Expand All @@ -31,7 +30,7 @@
public class BedwarsAdvertisementsRemover implements ChatReceiveModule {
@Override
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
LocrawInfo locrawInformation = HypixelUtils.INSTANCE.getLocrawInfo();
LocrawInfo locrawInformation = getLocraw();
String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText());
if ((message.startsWith("-") && message.endsWith("-")) || (message.startsWith("▬") && message.endsWith("▬")) || (message.startsWith("≡") && message.endsWith("≡")) || (message.startsWith("?") && message.endsWith("?")) || (!message.contains(": ")) || (message.contains(Minecraft.getMinecraft().getSession().getUsername().toLowerCase()))) return;
if (locrawInformation != null && locrawInformation.getGameType() == LocrawInfo.GameType.BEDWARS && HytilsReborn.INSTANCE.getLobbyChecker().playerIsInLobby()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

package cc.woverflow.hytils.handlers.chat.modules.blockers;

import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawInfo;
import cc.woverflow.hytils.config.HytilsConfig;
import cc.woverflow.hytils.handlers.chat.ChatReceiveModule;
Expand Down Expand Up @@ -58,7 +57,7 @@ public String onMessageSend(@NotNull String message) {
}

private long getCooldownLengthInSeconds() {
LocrawInfo locraw = HypixelUtils.INSTANCE.getLocrawInfo();
LocrawInfo locraw = getLocraw();
if (locraw != null && !"LOBBY".equals(locraw.getGameMode())) {
switch (locraw.getGameType()) {
case BEDWARS: {
Expand All @@ -83,7 +82,7 @@ private long getCooldownLengthInSeconds() {

@Override
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
LocrawInfo locraw = HypixelUtils.INSTANCE.getLocrawInfo();
LocrawInfo locraw = getLocraw();
if (locraw != null && (
(locraw.getGameType() == LocrawInfo.GameType.SKYWARS && event.message.getFormattedText().equals(getLanguage().cannotShoutBeforeSkywars)) || // fun fact: there is no message when you shout after a skywars game
event.message.getFormattedText().equals(getLanguage().cannotShoutAfterGame) ||
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package cc.woverflow.hytils.handlers.chat.modules.triggers;

import cc.polyfrost.oneconfig.utils.Multithreading;
import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawInfo;
import cc.woverflow.hytils.HytilsReborn;
import cc.woverflow.hytils.config.HytilsConfig;
Expand Down Expand Up @@ -53,7 +52,7 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
}

final String message = getStrippedMessage(event.message);
LocrawInfo locraw = HypixelUtils.INSTANCE.getLocrawInfo();
LocrawInfo locraw = getLocraw();
Matcher matcher = getLanguage().autoQueuePrefixGlobalRegex.matcher(message);
if (matcher.matches() && locraw != null) {
this.command = "/play " + locraw.getGameMode().toLowerCase(Locale.ENGLISH);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import cc.polyfrost.oneconfig.libs.universal.wrappers.message.UTextComponent;
import cc.polyfrost.oneconfig.utils.Multithreading;
import cc.polyfrost.oneconfig.utils.Notifications;
import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawInfo;
import cc.woverflow.hytils.HytilsReborn;
import cc.woverflow.hytils.config.HytilsConfig;
Expand Down Expand Up @@ -119,7 +118,7 @@ private void doNotification() {
.send(HytilsReborn.MOD_NAME, "There was a problem trying to get your GEXP.");
}
}
if (isSupportedMode(HypixelUtils.INSTANCE.getLocrawInfo()) && HytilsConfig.autoGetWinstreak) {
if (isSupportedMode(getLocraw()) && HytilsConfig.autoGetWinstreak) {
try {
if (HypixelAPIUtils.getWinstreak()) {
Notifications.INSTANCE.send(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawInfo;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawUtil;
import cc.woverflow.hytils.config.HytilsConfig;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
Expand All @@ -34,7 +35,7 @@ public class SumoRenderDistance {

@SubscribeEvent
public void onWorldLoad(RenderWorldLastEvent event) {
LocrawInfo locraw = HypixelUtils.INSTANCE.getLocrawInfo();
LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo();
if (HytilsConfig.sumoRenderDistance && HypixelUtils.INSTANCE.isHypixel() && (locraw != null && locraw.getGameMode().contains("SUMO"))) {
if (isFirstRender) {
final int oldRd = gs.renderDistanceChunks;
Expand Down
Loading

0 comments on commit 701681b

Please sign in to comment.