diff options
author | bowser0000 <bowser0000@gmail.com> | 2021-02-24 20:11:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-24 20:11:04 -0500 |
commit | 435d8dfd5a7f36803ceefcbd245e814ec735aced (patch) | |
tree | ae0d424b6e7692e3c011988800fd6e64b7033686 /src/main/java/me/Danker/commands/SkillTrackerCommand.java | |
parent | 0bd7c6336f5866ea5513f85a3cedf5c48e375ab2 (diff) | |
parent | a2f85ba6b9d80be3026aa906783a21c0b05cb681 (diff) | |
download | SkyblockMod-435d8dfd5a7f36803ceefcbd245e814ec735aced.tar.gz SkyblockMod-435d8dfd5a7f36803ceefcbd245e814ec735aced.tar.bz2 SkyblockMod-435d8dfd5a7f36803ceefcbd245e814ec735aced.zip |
1.8.5v1.8.5
Merge pull request #79 from bowser0000/development
Diffstat (limited to 'src/main/java/me/Danker/commands/SkillTrackerCommand.java')
-rw-r--r-- | src/main/java/me/Danker/commands/SkillTrackerCommand.java | 107 |
1 files changed, 58 insertions, 49 deletions
diff --git a/src/main/java/me/Danker/commands/SkillTrackerCommand.java b/src/main/java/me/Danker/commands/SkillTrackerCommand.java index 7642070..03753aa 100644 --- a/src/main/java/me/Danker/commands/SkillTrackerCommand.java +++ b/src/main/java/me/Danker/commands/SkillTrackerCommand.java @@ -13,6 +13,7 @@ import org.apache.commons.lang3.time.StopWatch; import java.util.List; public class SkillTrackerCommand extends CommandBase { + public static boolean running = false; @Override public String getCommandName() { @@ -39,55 +40,63 @@ public class SkillTrackerCommand extends CommandBase { @Override public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { - EntityPlayer player = (EntityPlayer) arg0; - - if (arg1.length < 1) { - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); - return; - } - - switch (arg1[0].toLowerCase()) { - case "start": - case "resume": - if (DankersSkyblockMod.skillStopwatch.isStarted() && DankersSkyblockMod.skillStopwatch.isSuspended()) { - DankersSkyblockMod.skillStopwatch.resume(); - } else if (!DankersSkyblockMod.skillStopwatch.isStarted()) { - DankersSkyblockMod.skillStopwatch.start(); - } - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker started.")); - break; - case "pause": - case "stop": - if (DankersSkyblockMod.skillStopwatch.isStarted() && !DankersSkyblockMod.skillStopwatch.isSuspended()) { - DankersSkyblockMod.skillStopwatch.suspend(); - } else { - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker paused.")); - } - break; - case "reset": - 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; - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker reset.")); - break; - case "hide": - DankersSkyblockMod.showSkillTracker = false; - ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", false); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker hidden.")); - break; - case "show": - DankersSkyblockMod.showSkillTracker = true; - ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", true); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker shown.")); - break; - default: + // MULTI THREAD DRIFTING + new Thread(() -> { + EntityPlayer player = (EntityPlayer) arg0; + + if (arg1.length < 1) { player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); - } - } + return; + } + + try { + Thread.sleep(50); + switch (arg1[0].toLowerCase()) { + case "start": + case "resume": + if (DankersSkyblockMod.skillStopwatch.isStarted() && DankersSkyblockMod.skillStopwatch.isSuspended()) { + DankersSkyblockMod.skillStopwatch.resume(); + } else if (!DankersSkyblockMod.skillStopwatch.isStarted()) { + DankersSkyblockMod.skillStopwatch.start(); + } + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker started.")); + break; + case "pause": + case "stop": + if (DankersSkyblockMod.skillStopwatch.isStarted() && !DankersSkyblockMod.skillStopwatch.isSuspended()) { + DankersSkyblockMod.skillStopwatch.suspend(); + } else { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker paused.")); + } + break; + case "reset": + 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; + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker reset.")); + break; + case "hide": + DankersSkyblockMod.showSkillTracker = false; + ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", false); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker hidden.")); + break; + case "show": + DankersSkyblockMod.showSkillTracker = true; + ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", true); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker shown.")); + break; + default: + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + } + } catch (InterruptedException e) { + e.printStackTrace(); + } + }).start(); + } } |