diff options
Diffstat (limited to 'src/main/java/me/Danker/handlers')
5 files changed, 103 insertions, 104 deletions
diff --git a/src/main/java/me/Danker/handlers/APIHandler.java b/src/main/java/me/Danker/handlers/APIHandler.java index c96aa50..c9460fe 100644 --- a/src/main/java/me/Danker/handlers/APIHandler.java +++ b/src/main/java/me/Danker/handlers/APIHandler.java @@ -1,24 +1,22 @@ package me.Danker.handlers; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Scanner; - import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Scanner; + public class APIHandler { public static JsonObject getResponse(String urlString) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; @@ -31,7 +29,7 @@ public class APIHandler { if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String input; - StringBuffer response = new StringBuffer(); + StringBuilder response = new StringBuilder(); while ((input = in.readLine()) != null) { response.append(input); @@ -39,9 +37,8 @@ public class APIHandler { in.close(); Gson gson = new Gson(); - JsonObject object = gson.fromJson(response.toString(), JsonObject.class); - - return object; + + return gson.fromJson(response.toString(), JsonObject.class); } else { if (urlString.startsWith("https://api.hypixel.net/")) { InputStream errorStream = conn.getErrorStream(); @@ -50,23 +47,19 @@ public class APIHandler { String error = scanner.next(); Gson gson = new Gson(); - JsonObject object = gson.fromJson(error, JsonObject.class); - return object; + return gson.fromJson(error, JsonObject.class); } } else if (urlString.startsWith("https://api.mojang.com/users/profiles/minecraft/") && conn.getResponseCode() == 204) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: Player does not exist.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: Player does not exist.")); } else { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Request failed. HTTP Error Code: " + conn.getResponseCode())); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Request failed. HTTP Error Code: " + conn.getResponseCode())); } } - } catch (MalformedURLException ex) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "An error has occured. See logs for more details.")); - System.err.println(ex); } catch (IOException ex) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "An error has occured. See logs for more details.")); - System.err.println(ex); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "An error has occured. See logs for more details.")); + ex.printStackTrace(); } - + return new JsonObject(); } @@ -82,7 +75,7 @@ public class APIHandler { if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String input; - StringBuffer response = new StringBuffer(); + StringBuilder response = new StringBuilder(); while ((input = in.readLine()) != null) { response.append(input); @@ -90,33 +83,25 @@ public class APIHandler { in.close(); Gson gson = new Gson(); - JsonArray array = gson.fromJson(response.toString(), JsonArray.class); - - return array; + + return gson.fromJson(response.toString(), JsonArray.class); } else { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Request failed. HTTP Error Code: " + conn.getResponseCode())); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Request failed. HTTP Error Code: " + conn.getResponseCode())); } - } catch (MalformedURLException ex) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "An error has occured. See logs for more details.")); - System.err.println(ex); } catch (IOException ex) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "An error has occured. See logs for more details.")); - System.err.println(ex); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "An error has occured. See logs for more details.")); + ex.printStackTrace(); } - + return new JsonArray(); } public static String getUUID(String username) { - Gson gson = new Gson(); - JsonObject uuidResponse = getResponse("https://api.mojang.com/users/profiles/minecraft/" + username); - String UUID = uuidResponse.get("id").getAsString(); - return UUID; + return uuidResponse.get("id").getAsString(); } public static String getLatestProfileID(String UUID, String key) { - Gson gson = new Gson(); EntityPlayer player = Minecraft.getMinecraft().thePlayer; // Get profiles @@ -125,11 +110,11 @@ public class APIHandler { JsonObject profilesResponse = getResponse("https://api.hypixel.net/skyblock/profiles?uuid=" + UUID + "&key=" + key); if (!profilesResponse.get("success").getAsBoolean()) { String reason = profilesResponse.get("cause").getAsString(); - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); return null; } if (profilesResponse.get("profiles").isJsonNull()) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "This player doesn't appear to have played SkyBlock.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "This player doesn't appear to have played SkyBlock.")); return null; } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 4cc910b..23bd6c4 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -1,30 +1,25 @@ package me.Danker.handlers; -import java.io.File; - -import me.Danker.TheMod; -import me.Danker.commands.BlockSlayerCommand; -import me.Danker.commands.DisplayCommand; -import me.Danker.commands.LootCommand; -import me.Danker.commands.MoveCommand; -import me.Danker.commands.ScaleCommand; -import me.Danker.commands.ToggleCommand; +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.*; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; +import java.io.File; + public class ConfigHandler { public static Configuration config; - private static String file = "config/Danker's Skyblock Mod.cfg"; + private final static String file = "config/Danker's Skyblock Mod.cfg"; public static void init() { config = new Configuration(new File(file)); try { config.load(); } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -38,7 +33,7 @@ public class ConfigHandler { return config.get(category, key, 0).getInt(); } } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -53,7 +48,7 @@ public class ConfigHandler { return config.get(category, key, 0D).getDouble(); } } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -68,7 +63,7 @@ public class ConfigHandler { return config.get(category, key, "").getString(); } } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -83,7 +78,7 @@ public class ConfigHandler { return config.get(category, key, false).getBoolean(); } } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -97,7 +92,7 @@ public class ConfigHandler { int set = config.get(category, key, value).getInt(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -110,7 +105,7 @@ public class ConfigHandler { double set = config.get(category, key, value).getDouble(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -123,7 +118,7 @@ public class ConfigHandler { String set = config.get(category, key, value).getString(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -136,7 +131,7 @@ public class ConfigHandler { boolean set = config.get(category, key, value).getBoolean(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -149,7 +144,7 @@ public class ConfigHandler { if (!config.hasCategory(category)) return false; return config.getCategory(category).containsKey(key); } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -164,7 +159,7 @@ public class ConfigHandler { config.removeCategory(new ConfigCategory(category)); } } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -183,6 +178,9 @@ public class ConfigHandler { if (!hasKey("toggles", "AOTD")) writeBooleanConfig("toggles", "AOTD", false); if (!hasKey("toggles", "LividDagger")) writeBooleanConfig("toggles", "LividDagger", false); if (!hasKey("toggles", "SceptreMessages")) writeBooleanConfig("toggles", "SceptreMessages", true); + if (!hasKey("toggles", "MidasStaffMessages")) writeBooleanConfig("toggles", "MidasStaffMessages", true); + if (!hasKey("toggles", "ImplosionMessages")) writeBooleanConfig("toggles", "ImplosionMessages", true); + if (!hasKey("toggles", "HealMessages")) writeBooleanConfig("toggles", "HealMessages", true); if (!hasKey("toggles", "PetColors")) writeBooleanConfig("toggles", "PetColors", false); if (!hasKey("toggles", "DungeonTimer")) writeBooleanConfig("toggles", "DungeonTimer", false); if (!hasKey("toggles", "BlockSlayer")) writeStringConfig("toggles", "BlockSlayer", ""); @@ -190,21 +188,26 @@ public class ConfigHandler { if (!hasKey("toggles", "ExpertiseLore")) writeBooleanConfig("toggles", "ExpertiseLore", true); if (!hasKey("toggles", "Skill50Display")) writeBooleanConfig("toggles", "Skill50Display", false); if (!hasKey("toggles", "OutlineText")) writeBooleanConfig("toggles", "OutlineText", false); - if (!hasKey("toggles", "MidasStaffMessages")) writeBooleanConfig("toggles", "MidasStaffMessages", true); - if (!hasKey("toggles", "HealMessages")) writeBooleanConfig("toggles", "HealMessages", true); if (!hasKey("toggles", "CakeTimer")) writeBooleanConfig("toggles", "CakeTimer", false); if (!hasKey("toggles", "LowHealthNotify")) writeBooleanConfig("toggles", "LowHealthNotify", false); if (!hasKey("toggles", "LividSolver")) writeBooleanConfig("toggles", "LividSolver", false); + if (!hasKey("toggles", "StopSalvageStarred")) writeBooleanConfig("toggles", "StopSalvageStarred", false); // Puzzle Solvers if (!hasKey("toggles", "ThreeManPuzzle")) writeBooleanConfig("toggles", "ThreeManPuzzle", false); if (!hasKey("toggles", "OruoPuzzle")) writeBooleanConfig("toggles", "OruoPuzzle", false); if (!hasKey("toggles", "BlazePuzzle")) writeBooleanConfig("toggles", "BlazePuzzle", false); if (!hasKey("toggles", "CreeperPuzzle")) writeBooleanConfig("toggles", "CreeperPuzzle", false); if (!hasKey("toggles", "WaterPuzzle")) writeBooleanConfig("toggles", "WaterPuzzle", false); + if (!hasKey("toggles", "TicTacToePuzzle")) writeBooleanConfig("toggles", "TicTacToePuzzle", false); if (!hasKey("toggles", "StartsWithTerminal")) writeBooleanConfig("toggles", "StartsWithTerminal", false); if (!hasKey("toggles", "SelectAllTerminal")) writeBooleanConfig("toggles", "SelectAllTerminal", false); if (!hasKey("toggles", "IgnoreItemFrameOnSeaLanterns")) writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", false); - + if (!hasKey("toggles", "UltraSequencer")) writeBooleanConfig("toggles", "UltraSequencer", false); + if (!hasKey("toggles", "Chronomatron")) writeBooleanConfig("toggles", "Chronomatron", false); + if (!hasKey("toggles", "Superpairs")) writeBooleanConfig("toggles", "Superpairs", false); + if (!hasKey("toggles", "PickBlockInExperiments")) writeBooleanConfig("toggles", "PickBlockInExperiments", false); + + if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); // Wolf Loot @@ -388,6 +391,8 @@ public class ConfigHandler { if (!hasKey("locations", "cakeTimerY")) writeIntConfig("locations", "cakeTimerY", 30); if (!hasKey("locations", "skillTrackerX")) writeIntConfig("locations", "skillTrackerX", 40); if (!hasKey("locations", "skillTrackerY")) writeIntConfig("locations", "skillTrackerY", 50); + if (!hasKey("locations", "waterAnswerX")) writeIntConfig("locations", "waterAnswerX", 100); + if (!hasKey("locations", "waterAnswerY")) writeIntConfig("locations", "waterAnswerY", 100); if (!hasKey("scales", "coordsScale")) writeDoubleConfig("scales", "coordsScale", 1); if (!hasKey("scales", "displayScale")) writeDoubleConfig("scales", "displayScale", 1); if (!hasKey("scales", "dungeonTimerScale")) writeDoubleConfig("scales", "dungeonTimerScale", 1); @@ -395,6 +400,7 @@ public class ConfigHandler { if (!hasKey("scales", "lividHpScale")) writeDoubleConfig("scales", "lividHpScale", 1); if (!hasKey("scales", "cakeTimerScale")) writeDoubleConfig("scales", "cakeTimerScale", 1); if (!hasKey("scales", "skillTrackerScale")) writeDoubleConfig("scales", "skillTrackerScale", 1); + if (!hasKey("scales", "waterAnswerScale")) writeDoubleConfig("scales", "waterAnswerScale", 1); if (!hasKey("colors", "main")) writeStringConfig("colors", "main", EnumChatFormatting.GREEN.toString()); if (!hasKey("colors", "secondary")) writeStringConfig("colors", "secondary", EnumChatFormatting.DARK_GREEN.toString()); @@ -423,31 +429,38 @@ public class ConfigHandler { ToggleCommand.aotdToggled = getBoolean("toggles", "AOTD"); ToggleCommand.lividDaggerToggled = getBoolean("toggles", "LividDagger"); ToggleCommand.sceptreMessages = getBoolean("toggles", "SceptreMessages"); + ToggleCommand.midasStaffMessages = getBoolean("toggles", "MidasStaffMessages"); + ToggleCommand.implosionMessages = getBoolean("toggles", "ImplosionMessages"); + ToggleCommand.healMessages = getBoolean("toggles", "HealMessages"); ToggleCommand.petColoursToggled = getBoolean("toggles", "PetColors"); ToggleCommand.dungeonTimerToggled = getBoolean("toggles", "DungeonTimer"); ToggleCommand.golemAlertToggled = getBoolean("toggles", "GolemAlerts"); ToggleCommand.expertiseLoreToggled = getBoolean("toggles", "ExpertiseLore"); ToggleCommand.skill50DisplayToggled = getBoolean("toggles", "Skill50Display"); ToggleCommand.outlineTextToggled = getBoolean("toggles", "OutlineText"); - ToggleCommand.midasStaffMessages = getBoolean("toggles", "MidasStaffMessages"); - ToggleCommand.healMessages = getBoolean("toggles", "HealMessages"); ToggleCommand.cakeTimerToggled = getBoolean("toggles", "CakeTimer"); ToggleCommand.lowHealthNotifyToggled = getBoolean("toggles", "LowHealthNotify"); ToggleCommand.lividSolverToggled = getBoolean("toggles", "LividSolver"); + ToggleCommand.stopSalvageStarredToggled = getBoolean("toggles", "StopSalvageStarred"); // Puzzle Solvers ToggleCommand.threeManToggled = getBoolean("toggles", "ThreeManPuzzle"); ToggleCommand.oruoToggled = getBoolean("toggles", "OruoPuzzle"); ToggleCommand.blazeToggled = getBoolean("toggles", "BlazePuzzle"); ToggleCommand.creeperToggled = getBoolean("toggles", "CreeperPuzzle"); ToggleCommand.waterToggled = getBoolean("toggles", "WaterPuzzle"); + ToggleCommand.ticTacToeToggled = getBoolean("toggles", "TicTacToePuzzle"); ToggleCommand.startsWithToggled = getBoolean("toggles", "StartsWithTerminal"); ToggleCommand.selectAllToggled = getBoolean("toggles", "SelectAllTerminal"); ToggleCommand.itemFrameOnSeaLanternsToggled = getBoolean("toggles", "IgnoreItemFrameOnSeaLanterns"); - + ToggleCommand.ultrasequencerToggled = getBoolean("toggles", "UltraSequencer"); + ToggleCommand.chronomatronToggled = getBoolean("toggles", "Chronomatron"); + ToggleCommand.superpairsToggled = getBoolean("toggles", "Superpairs"); + ToggleCommand.swapToPickBlockInExperimentsToggled = getBoolean("toggles", "PickBlockInExperiments"); + String onlySlayer = getString("toggles", "BlockSlayer"); if (!onlySlayer.equals("")) { BlockSlayerCommand.onlySlayerName = onlySlayer.substring(0, onlySlayer.lastIndexOf(" ")); - BlockSlayerCommand.onlySlayerNumber = onlySlayer.substring(onlySlayer.lastIndexOf(" ") + 1, onlySlayer.length()); + BlockSlayerCommand.onlySlayerNumber = onlySlayer.substring(onlySlayer.lastIndexOf(" ") + 1); } // Wolf @@ -612,9 +625,9 @@ public class ConfigHandler { // Misc DisplayCommand.display = getString("misc", "display"); DisplayCommand.auto = getBoolean("misc", "autoDisplay"); - TheMod.SKILL_TIME = getInt("misc", "skill50Time") * 20; - TheMod.cakeTime = getDouble("misc", "cakeTime"); - TheMod.showSkillTracker = getBoolean("misc", "showSkillTracker"); + DankersSkyblockMod.SKILL_TIME = getInt("misc", "skill50Time") * 20; + DankersSkyblockMod.cakeTime = getDouble("misc", "cakeTime"); + DankersSkyblockMod.showSkillTracker = getBoolean("misc", "showSkillTracker"); MoveCommand.coordsXY[0] = getInt("locations", "coordsX"); MoveCommand.coordsXY[1] = getInt("locations", "coordsY"); @@ -630,6 +643,8 @@ public class ConfigHandler { MoveCommand.cakeTimerXY[1] = getInt("locations", "cakeTimerY"); MoveCommand.skillTrackerXY[0] = getInt("locations", "skillTrackerX"); MoveCommand.skillTrackerXY[1] = getInt("locations", "skillTrackerY"); + MoveCommand.waterAnswerXY[0] = getInt("locations", "waterAnswerX"); + MoveCommand.waterAnswerXY[1] = getInt("locations", "waterAnswerY"); ScaleCommand.coordsScale = getDouble("scales", "coordsScale"); ScaleCommand.displayScale = getDouble("scales", "displayScale"); @@ -638,22 +653,23 @@ public class ConfigHandler { ScaleCommand.lividHpScale = getDouble("scales", "lividHpScale"); ScaleCommand.cakeTimerScale = getDouble("scales", "cakeTimerScale"); ScaleCommand.skillTrackerScale = getDouble("scales", "skillTrackerScale"); - - TheMod.MAIN_COLOUR = getString("colors", "main"); - TheMod.SECONDARY_COLOUR = getString("colors", "secondary"); - TheMod.DELIMITER_COLOUR = getString("colors", "delimiter"); - TheMod.ERROR_COLOUR = getString("colors", "error"); - TheMod.TYPE_COLOUR = getString("colors", "type"); - TheMod.VALUE_COLOUR = getString("colors", "value"); - TheMod.SKILL_AVERAGE_COLOUR = getString("colors", "skillAverage"); - TheMod.ANSWER_COLOUR = getString("colors", "answer"); - TheMod.SKILL_50_COLOUR = getString("colors", "skill50Display"); - TheMod.COORDS_COLOUR = getString("colors", "coordsDisplay"); - TheMod.CAKE_COLOUR = getString("colors", "cakeDisplay"); - TheMod.SKILL_TRACKER_COLOUR = getString("colors", "skillTracker"); - TheMod.TRIVIA_WRONG_ANSWER_COLOUR = getString("colors", "triviaWrongAnswer"); - TheMod.LOWEST_BLAZE_COLOUR = getInt("colors", "blazeLowest"); - TheMod.HIGHEST_BLAZE_COLOUR = getInt("colors", "blazeHighest"); + ScaleCommand.waterAnswerScale = getDouble("scales", "waterAnswerScale"); + + DankersSkyblockMod.MAIN_COLOUR = getString("colors", "main"); + DankersSkyblockMod.SECONDARY_COLOUR = getString("colors", "secondary"); + DankersSkyblockMod.DELIMITER_COLOUR = getString("colors", "delimiter"); + DankersSkyblockMod.ERROR_COLOUR = getString("colors", "error"); + DankersSkyblockMod.TYPE_COLOUR = getString("colors", "type"); + DankersSkyblockMod.VALUE_COLOUR = getString("colors", "value"); + DankersSkyblockMod.SKILL_AVERAGE_COLOUR = getString("colors", "skillAverage"); + DankersSkyblockMod.ANSWER_COLOUR = getString("colors", "answer"); + DankersSkyblockMod.SKILL_50_COLOUR = getString("colors", "skill50Display"); + DankersSkyblockMod.COORDS_COLOUR = getString("colors", "coordsDisplay"); + DankersSkyblockMod.CAKE_COLOUR = getString("colors", "cakeDisplay"); + DankersSkyblockMod.SKILL_TRACKER_COLOUR = getString("colors", "skillTracker"); + DankersSkyblockMod.TRIVIA_WRONG_ANSWER_COLOUR = getString("colors", "triviaWrongAnswer"); + DankersSkyblockMod.LOWEST_BLAZE_COLOUR = getInt("colors", "blazeLowest"); + DankersSkyblockMod.HIGHEST_BLAZE_COLOUR = getInt("colors", "blazeHighest"); } } diff --git a/src/main/java/me/Danker/handlers/PacketHandler.java b/src/main/java/me/Danker/handlers/PacketHandler.java index 716b27c..da7900a 100644 --- a/src/main/java/me/Danker/handlers/PacketHandler.java +++ b/src/main/java/me/Danker/handlers/PacketHandler.java @@ -1,7 +1,5 @@ package me.Danker.handlers; -import java.lang.reflect.Field; - import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; @@ -18,6 +16,8 @@ import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.network.play.server.S04PacketEntityEquipment; import net.minecraft.util.BlockPos; +import java.lang.reflect.Field; + public class PacketHandler extends ChannelDuplexHandler { // Spirit boots fix @@ -47,7 +47,7 @@ public class PacketHandler extends ChannelDuplexHandler { EntityItemFrame itemFrame = (EntityItemFrame) entityHit; ItemStack item = itemFrame.getDisplayedItem(); if (item != null && item.getItem() == Items.arrow) { - BlockPos blockPos = Utils.getBlockUnderItemFrame(mc.theWorld, itemFrame); + BlockPos blockPos = Utils.getBlockUnderItemFrame(itemFrame); if (mc.theWorld.getBlockState(blockPos).getBlock() == Blocks.sea_lantern) { return; } diff --git a/src/main/java/me/Danker/handlers/ScoreboardHandler.java b/src/main/java/me/Danker/handlers/ScoreboardHandler.java index 92fc844..b81689c 100644 --- a/src/main/java/me/Danker/handlers/ScoreboardHandler.java +++ b/src/main/java/me/Danker/handlers/ScoreboardHandler.java @@ -1,13 +1,7 @@ package me.Danker.handlers; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - import com.google.common.collect.Iterables; import com.google.common.collect.Lists; - import net.minecraft.client.Minecraft; import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; @@ -15,6 +9,11 @@ import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.StringUtils; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + public class ScoreboardHandler { public static String cleanSB(String scoreboard) { @@ -39,10 +38,10 @@ public class ScoreboardHandler { if (objective == null) return lines; Collection<Score> scores = scoreboard.getSortedScores(objective); - List<Score> list = Lists.newArrayList(scores.stream() + List<Score> list = scores.stream() .filter(input -> input != null && input.getPlayerName() != null && !input.getPlayerName() .startsWith("#")) - .collect(Collectors.toList())); + .collect(Collectors.toList()); if (list.size() > 15) { scores = Lists.newArrayList(Iterables.skip(list, scores.size() - 15)); diff --git a/src/main/java/me/Danker/handlers/TextRenderer.java b/src/main/java/me/Danker/handlers/TextRenderer.java index 0e965e6..cbf196b 100644 --- a/src/main/java/me/Danker/handlers/TextRenderer.java +++ b/src/main/java/me/Danker/handlers/TextRenderer.java @@ -1,15 +1,14 @@ package me.Danker.handlers; -import org.lwjgl.opengl.GL11; - import me.Danker.commands.ToggleCommand; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.util.StringUtils; +import org.lwjgl.opengl.GL11; public class TextRenderer extends Gui { public TextRenderer(Minecraft mc, String text, int x, int y, double scale) { - double scaleReset = (double) Math.pow(scale, -1); + double scaleReset = Math.pow(scale, -1); GL11.glScaled(scale, scale, scale); y -= mc.fontRendererObj.FONT_HEIGHT; |