aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/commands/SkillTrackerCommand.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/Danker/commands/SkillTrackerCommand.java')
-rw-r--r--src/main/java/me/Danker/commands/SkillTrackerCommand.java107
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();
+ }
}