From db9ad0bcd3f31ee7ad29dcba99469872c5143dbe Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 1 Dec 2020 20:03:14 -0500 Subject: Fix warnings Eclipse didn't tell me about Also rename TheMod.java to DankersSkyblockMod.java --- src/main/java/me/Danker/gui/DankerGui.java | 28 +++--- src/main/java/me/Danker/gui/DisplayGui.java | 6 +- src/main/java/me/Danker/gui/EditLocationsGui.java | 99 ++++++++++++---------- src/main/java/me/Danker/gui/OnlySlayerGui.java | 25 +++--- src/main/java/me/Danker/gui/PuzzleSolversGui.java | 4 +- src/main/java/me/Danker/gui/SkillTrackerGui.java | 45 +++++----- .../java/me/Danker/gui/buttons/LocationButton.java | 7 +- 7 files changed, 112 insertions(+), 102 deletions(-) (limited to 'src/main/java/me/Danker/gui') diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index de3aad2..a1f762d 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -1,11 +1,6 @@ package me.Danker.gui; -import java.awt.Desktop; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; @@ -15,6 +10,11 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; +import java.awt.*; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + public class DankerGui extends GuiScreen { private int page; @@ -172,29 +172,29 @@ public class DankerGui extends GuiScreen { if (button == closeGUI) { Minecraft.getMinecraft().thePlayer.closeScreen(); } else if (button == nextPage) { - TheMod.guiToOpen = "dankergui" + (page + 1); + DankersSkyblockMod.guiToOpen = "dankergui" + (page + 1); } else if (button == backPage) { - TheMod.guiToOpen = "dankergui" + (page - 1); + DankersSkyblockMod.guiToOpen = "dankergui" + (page - 1); } else if (button == githubLink) { try { Desktop.getDesktop().browse(new URI("https://github.com/bowser0000/SkyblockMod")); } catch (IOException | URISyntaxException ex) { - System.err.println(ex); + ex.printStackTrace(); } } else if (button == discordLink) { try { Desktop.getDesktop().browse(new URI("https://discord.gg/QsEkNQS")); } catch (IOException | URISyntaxException ex) { - System.err.println(ex); + ex.printStackTrace(); } } else if (button == changeDisplay) { - TheMod.guiToOpen = "displaygui"; + DankersSkyblockMod.guiToOpen = "displaygui"; } else if (button == onlySlayer) { - TheMod.guiToOpen = "onlyslayergui"; + DankersSkyblockMod.guiToOpen = "onlyslayergui"; } else if (button == puzzleSolvers) { - TheMod.guiToOpen = "puzzlesolvers"; + DankersSkyblockMod.guiToOpen = "puzzlesolvers"; } else if (button == skillTracker) { - TheMod.guiToOpen = "skilltracker"; + DankersSkyblockMod.guiToOpen = "skilltracker"; } else if (button == outlineText) { ToggleCommand.outlineTextToggled = !ToggleCommand.outlineTextToggled; ConfigHandler.writeBooleanConfig("toggles", "OutlineText", ToggleCommand.outlineTextToggled); diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 0a5f805..f498a67 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -1,6 +1,6 @@ package me.Danker.gui; -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.commands.DisplayCommand; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; @@ -115,9 +115,9 @@ public class DisplayGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - TheMod.guiToOpen = "dankergui1"; + DankersSkyblockMod.guiToOpen = "dankergui1"; } else if (button == editLocations) { - TheMod.guiToOpen = "editlocations"; + DankersSkyblockMod.guiToOpen = "editlocations"; } else if (button == showSession) { addSession = !addSession; showSession.displayString = "Current Session Only: " + Utils.getColouredBoolean(addSession); diff --git a/src/main/java/me/Danker/gui/EditLocationsGui.java b/src/main/java/me/Danker/gui/EditLocationsGui.java index 75caf6a..63a47c0 100644 --- a/src/main/java/me/Danker/gui/EditLocationsGui.java +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -1,8 +1,6 @@ package me.Danker.gui; -import org.lwjgl.opengl.GL11; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; import me.Danker.gui.buttons.LocationButton; @@ -12,6 +10,7 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.opengl.GL11; public class EditLocationsGui extends GuiScreen { @@ -72,16 +71,16 @@ public class EditLocationsGui extends GuiScreen { EnumChatFormatting.YELLOW + 2 + "\n" + EnumChatFormatting.YELLOW + 1; - String skillTrackerText = TheMod.SKILL_TRACKER_COLOUR + "Farming XP Earned: 462,425.3\n" + - TheMod.SKILL_TRACKER_COLOUR + "Time Elapsed: " + Utils.getTimeBetween(0, 3602) + "\n" + - TheMod.SKILL_TRACKER_COLOUR + "XP Per Hour: 462,168"; + String skillTrackerText = DankersSkyblockMod.SKILL_TRACKER_COLOUR + "Farming XP Earned: 462,425.3\n" + + DankersSkyblockMod.SKILL_TRACKER_COLOUR + "Time Elapsed: " + Utils.getTimeBetween(0, 3602) + "\n" + + DankersSkyblockMod.SKILL_TRACKER_COLOUR + "XP Per Hour: 462,168"; display = new LocationButton(0, MoveCommand.displayXY[0], MoveCommand.displayXY[1], 145 * ScaleCommand.displayScale, 102 * ScaleCommand.displayScale, ScaleCommand.displayScale, displayText, displayNums, 110); dungeonTimer = new LocationButton(0, MoveCommand.dungeonTimerXY[0], MoveCommand.dungeonTimerXY[1], 113 * ScaleCommand.dungeonTimerScale, 57 * ScaleCommand.dungeonTimerScale, ScaleCommand.dungeonTimerScale, dungeonTimerText, dungeonTimerNums, 80); - coords = new LocationButton(0, MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], 141 * ScaleCommand.coordsScale, 12 * ScaleCommand.coordsScale, ScaleCommand.coordsScale, TheMod.COORDS_COLOUR + "74 / 14 / -26 (141.1 / 6.7)", null, null); - skill50 = new LocationButton(0, MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], 233 * ScaleCommand.skill50Scale, 12 * ScaleCommand.skill50Scale, ScaleCommand.skill50Scale, TheMod.SKILL_50_COLOUR + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", null, null); + coords = new LocationButton(0, MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], 141 * ScaleCommand.coordsScale, 12 * ScaleCommand.coordsScale, ScaleCommand.coordsScale, DankersSkyblockMod.COORDS_COLOUR + "74 / 14 / -26 (141.1 / 6.7)", null, null); + skill50 = new LocationButton(0, MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], 233 * ScaleCommand.skill50Scale, 12 * ScaleCommand.skill50Scale, ScaleCommand.skill50Scale, DankersSkyblockMod.SKILL_50_COLOUR + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", null, null); lividHP = new LocationButton(0, MoveCommand.lividHpXY[0], MoveCommand.lividHpXY[1], 85 * ScaleCommand.lividHpScale, 12 * ScaleCommand.lividHpScale, ScaleCommand.lividHpScale, EnumChatFormatting.WHITE + "﴾ Livid " + EnumChatFormatting.YELLOW + "6.9M" + EnumChatFormatting.RED + "❤ " + EnumChatFormatting.WHITE + "﴿", null, null); - cakeTimer = new LocationButton(0, MoveCommand.cakeTimerXY[0], MoveCommand.cakeTimerXY[1] + 5, 85 * ScaleCommand.cakeTimerScale, 18 * ScaleCommand.cakeTimerScale, ScaleCommand.cakeTimerScale, TheMod.CAKE_COLOUR + " 11h16m", null, null); + cakeTimer = new LocationButton(0, MoveCommand.cakeTimerXY[0], MoveCommand.cakeTimerXY[1] + 5, 85 * ScaleCommand.cakeTimerScale, 18 * ScaleCommand.cakeTimerScale, ScaleCommand.cakeTimerScale, DankersSkyblockMod.CAKE_COLOUR + " 11h16m", null, null); skillTracker = new LocationButton(0, MoveCommand.skillTrackerXY[0], MoveCommand.skillTrackerXY[1], 150 * ScaleCommand.skillTrackerScale, 28 * ScaleCommand.skillTrackerScale, ScaleCommand.skillTrackerScale, skillTrackerText, null, null); this.buttonList.add(coords); @@ -99,9 +98,9 @@ public class EditLocationsGui extends GuiScreen { mouseMoved(mouseX, mouseY); double scale = ScaleCommand.cakeTimerScale; - double scaleReset = (double) Math.pow(scale, -1); + double scaleReset = Math.pow(scale, -1); GL11.glScaled(scale, scale, scale); - mc.getTextureManager().bindTexture(TheMod.CAKE_ICON); + mc.getTextureManager().bindTexture(DankersSkyblockMod.CAKE_ICON); Gui.drawModalRectWithCustomSizedTexture(MoveCommand.cakeTimerXY[0], MoveCommand.cakeTimerXY[1], 0, 0, 16, 16, 16, 16); GL11.glScaled(scaleReset, scaleReset, scaleReset); @@ -113,41 +112,49 @@ public class EditLocationsGui extends GuiScreen { int yMoved = mouseY - lastMouseY; if (moving != null) { - if (moving.equals("display")) { - MoveCommand.displayXY[0] += xMoved; - MoveCommand.displayXY[1] += yMoved; - display.xPosition = MoveCommand.displayXY[0]; - display.yPosition = MoveCommand.displayXY[1]; - } else if (moving.equals("dungeonTimer")) { - MoveCommand.dungeonTimerXY[0] += xMoved; - MoveCommand.dungeonTimerXY[1] += yMoved; - dungeonTimer.xPosition = MoveCommand.dungeonTimerXY[0]; - dungeonTimer.yPosition = MoveCommand.dungeonTimerXY[1]; - } else if (moving.equals("coords")) { - MoveCommand.coordsXY[0] += xMoved; - MoveCommand.coordsXY[1] += yMoved; - coords.xPosition = MoveCommand.coordsXY[0]; - coords.yPosition = MoveCommand.coordsXY[1]; - } else if (moving.equals("skill50")) { - MoveCommand.skill50XY[0] += xMoved; - MoveCommand.skill50XY[1] += yMoved; - skill50.xPosition = MoveCommand.skill50XY[0]; - skill50.yPosition = MoveCommand.skill50XY[1]; - } else if (moving.equals("lividHP")) { - MoveCommand.lividHpXY[0] += xMoved; - MoveCommand.lividHpXY[1] += yMoved; - lividHP.xPosition = MoveCommand.lividHpXY[0]; - lividHP.yPosition = MoveCommand.lividHpXY[1]; - } else if (moving.equals("cakeTimer")) { - MoveCommand.cakeTimerXY[0] += xMoved; - MoveCommand.cakeTimerXY[1] += yMoved; - cakeTimer.xPosition = MoveCommand.cakeTimerXY[0]; - cakeTimer.yPosition = MoveCommand.cakeTimerXY[1]; - } else if (moving.equals("skillTracker")) { - MoveCommand.skillTrackerXY[0] += xMoved; - MoveCommand.skillTrackerXY[1] += yMoved; - skillTracker.xPosition = MoveCommand.skillTrackerXY[0]; - skillTracker.yPosition = MoveCommand.skillTrackerXY[1]; + switch (moving) { + case "display": + MoveCommand.displayXY[0] += xMoved; + MoveCommand.displayXY[1] += yMoved; + display.xPosition = MoveCommand.displayXY[0]; + display.yPosition = MoveCommand.displayXY[1]; + break; + case "dungeonTimer": + MoveCommand.dungeonTimerXY[0] += xMoved; + MoveCommand.dungeonTimerXY[1] += yMoved; + dungeonTimer.xPosition = MoveCommand.dungeonTimerXY[0]; + dungeonTimer.yPosition = MoveCommand.dungeonTimerXY[1]; + break; + case "coords": + MoveCommand.coordsXY[0] += xMoved; + MoveCommand.coordsXY[1] += yMoved; + coords.xPosition = MoveCommand.coordsXY[0]; + coords.yPosition = MoveCommand.coordsXY[1]; + break; + case "skill50": + MoveCommand.skill50XY[0] += xMoved; + MoveCommand.skill50XY[1] += yMoved; + skill50.xPosition = MoveCommand.skill50XY[0]; + skill50.yPosition = MoveCommand.skill50XY[1]; + break; + case "lividHP": + MoveCommand.lividHpXY[0] += xMoved; + MoveCommand.lividHpXY[1] += yMoved; + lividHP.xPosition = MoveCommand.lividHpXY[0]; + lividHP.yPosition = MoveCommand.lividHpXY[1]; + break; + case "cakeTimer": + MoveCommand.cakeTimerXY[0] += xMoved; + MoveCommand.cakeTimerXY[1] += yMoved; + cakeTimer.xPosition = MoveCommand.cakeTimerXY[0]; + cakeTimer.yPosition = MoveCommand.cakeTimerXY[1]; + break; + case "skillTracker": + MoveCommand.skillTrackerXY[0] += xMoved; + MoveCommand.skillTrackerXY[1] += yMoved; + skillTracker.xPosition = MoveCommand.skillTrackerXY[0]; + skillTracker.yPosition = MoveCommand.skillTrackerXY[1]; + break; } this.buttonList.clear(); initGui(); diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java index c96bfd6..89c701d 100644 --- a/src/main/java/me/Danker/gui/OnlySlayerGui.java +++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java @@ -1,6 +1,6 @@ package me.Danker.gui; -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.commands.BlockSlayerCommand; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; @@ -38,14 +38,19 @@ public class OnlySlayerGui extends GuiScreen { int width = sr.getScaledWidth(); onlyName = BlockSlayerCommand.onlySlayerName; - if (BlockSlayerCommand.onlySlayerNumber.equals("I")) { - onlyNumberInt = 1; - } else if (BlockSlayerCommand.onlySlayerNumber.equals("II")) { - onlyNumberInt = 2; - } else if (BlockSlayerCommand.onlySlayerNumber.equals("III")) { - onlyNumberInt = 3; - } else { - onlyNumberInt = 4; + switch (BlockSlayerCommand.onlySlayerNumber) { + case "I": + onlyNumberInt = 1; + break; + case "II": + onlyNumberInt = 2; + break; + case "III": + onlyNumberInt = 3; + break; + default: + onlyNumberInt = 4; + break; } goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); @@ -89,7 +94,7 @@ public class OnlySlayerGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - TheMod.guiToOpen = "dankergui1"; + DankersSkyblockMod.guiToOpen = "dankergui1"; } else if (button == off) { BlockSlayerCommand.onlySlayerName = ""; BlockSlayerCommand.onlySlayerNumber = ""; diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index 6826c56..059d41d 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -1,6 +1,6 @@ package me.Danker.gui; -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; @@ -85,7 +85,7 @@ public class PuzzleSolversGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - TheMod.guiToOpen = "dankergui1"; + DankersSkyblockMod.guiToOpen = "dankergui1"; } else if (button == backPage) { Minecraft.getMinecraft().displayGuiScreen(new PuzzleSolversGui(page - 1)); } else if (button == nextPage) { diff --git a/src/main/java/me/Danker/gui/SkillTrackerGui.java b/src/main/java/me/Danker/gui/SkillTrackerGui.java index 9672890..4b38f2e 100644 --- a/src/main/java/me/Danker/gui/SkillTrackerGui.java +++ b/src/main/java/me/Danker/gui/SkillTrackerGui.java @@ -1,14 +1,13 @@ package me.Danker.gui; -import org.apache.commons.lang3.time.StopWatch; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; +import org.apache.commons.lang3.time.StopWatch; public class SkillTrackerGui extends GuiScreen { @@ -51,12 +50,12 @@ public class SkillTrackerGui extends GuiScreen { public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); String stateText = ""; - if (TheMod.skillStopwatch.isStarted() && !TheMod.skillStopwatch.isSuspended()) { + if (DankersSkyblockMod.skillStopwatch.isStarted() && !DankersSkyblockMod.skillStopwatch.isSuspended()) { stateText = "Timer: Running"; - } else if (!TheMod.skillStopwatch.isStarted() || TheMod.skillStopwatch.isSuspended()) { + } else if (!DankersSkyblockMod.skillStopwatch.isStarted() || DankersSkyblockMod.skillStopwatch.isSuspended()) { stateText = "Timer: Paused"; } - if (!TheMod.showSkillTracker) { + if (!DankersSkyblockMod.showSkillTracker) { stateText += " (Hidden)"; } int stateTextWidth = mc.fontRendererObj.getStringWidth(stateText); @@ -67,31 +66,31 @@ public class SkillTrackerGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - TheMod.guiToOpen = "dankergui1"; + DankersSkyblockMod.guiToOpen = "dankergui1"; } else if (button == start) { - if (TheMod.skillStopwatch.isStarted() && TheMod.skillStopwatch.isSuspended()) { - TheMod.skillStopwatch.resume(); - } else if (!TheMod.skillStopwatch.isStarted()) { - TheMod.skillStopwatch.start(); + if (DankersSkyblockMod.skillStopwatch.isStarted() && DankersSkyblockMod.skillStopwatch.isSuspended()) { + DankersSkyblockMod.skillStopwatch.resume(); + } else if (!DankersSkyblockMod.skillStopwatch.isStarted()) { + DankersSkyblockMod.skillStopwatch.start(); } } else if (button == stop) { - if (TheMod.skillStopwatch.isStarted() && !TheMod.skillStopwatch.isSuspended()) { - TheMod.skillStopwatch.suspend(); + if (DankersSkyblockMod.skillStopwatch.isStarted() && !DankersSkyblockMod.skillStopwatch.isSuspended()) { + DankersSkyblockMod.skillStopwatch.suspend(); } } else if (button == reset) { - TheMod.skillStopwatch = new StopWatch(); - TheMod.farmingXPGained = 0; - TheMod.miningXPGained = 0; - TheMod.combatXPGained = 0; - TheMod.foragingXPGained = 0; - TheMod.fishingXPGained = 0; - TheMod.enchantingXPGained = 0; - TheMod.alchemyXPGained = 0; + DankersSkyblockMod.skillStopwatch = new StopWatch(); + DankersSkyblockMod.farmingXPGained = 0; + DankersSkyblockMod.miningXPGained = 0; + DankersSkyblockMod.combatXPGained = 0; + DankersSkyblockMod.foragingXPGained = 0; + DankersSkyblockMod.fishingXPGained = 0; + DankersSkyblockMod.enchantingXPGained = 0; + DankersSkyblockMod.alchemyXPGained = 0; } else if (button == hide) { - TheMod.showSkillTracker = false; + DankersSkyblockMod.showSkillTracker = false; ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", false); } else if (button == show) { - TheMod.showSkillTracker = true; + DankersSkyblockMod.showSkillTracker = true; ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", true); } } diff --git a/src/main/java/me/Danker/gui/buttons/LocationButton.java b/src/main/java/me/Danker/gui/buttons/LocationButton.java index 061f198..a8937fd 100644 --- a/src/main/java/me/Danker/gui/buttons/LocationButton.java +++ b/src/main/java/me/Danker/gui/buttons/LocationButton.java @@ -34,12 +34,11 @@ public class LocationButton extends GuiButton { } else { splitText = text2.split("\n"); } - int index = 0; + int longestText = -1; - for (int i = 0; i < splitText.length; i++) { - int stringLength = mc.fontRendererObj.getStringWidth(splitText[i]); + for (String s : splitText) { + int stringLength = mc.fontRendererObj.getStringWidth(s); if (stringLength > longestText) { - index = i; longestText = stringLength; } } -- cgit