aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/commands/SkillTrackerCommand.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-11-23 09:57:06 -0500
committerbowser0000 <bowser0000@gmail.com>2020-11-23 09:57:06 -0500
commitea9c0616fd3406c3a93995f6ab28309fe6cd8e05 (patch)
tree7b70a262a6be2b72205ce27da02cb7d3bda2dbf7 /src/main/java/me/Danker/commands/SkillTrackerCommand.java
parentb89d16855374a3e75c4c1279226d23d923821084 (diff)
downloadSkyblockMod-ea9c0616fd3406c3a93995f6ab28309fe6cd8e05.tar.gz
SkyblockMod-ea9c0616fd3406c3a93995f6ab28309fe6cd8e05.tar.bz2
SkyblockMod-ea9c0616fd3406c3a93995f6ab28309fe6cd8e05.zip
Add skill xp/hour tracker, add Necron's Handle and bug fixes
Fix F7 loot not saving to config Fix water puzzle variant 3 solution
Diffstat (limited to 'src/main/java/me/Danker/commands/SkillTrackerCommand.java')
-rw-r--r--src/main/java/me/Danker/commands/SkillTrackerCommand.java94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/commands/SkillTrackerCommand.java b/src/main/java/me/Danker/commands/SkillTrackerCommand.java
new file mode 100644
index 0000000..6e6d742
--- /dev/null
+++ b/src/main/java/me/Danker/commands/SkillTrackerCommand.java
@@ -0,0 +1,94 @@
+package me.Danker.commands;
+
+import java.util.List;
+
+import org.apache.commons.lang3.time.StopWatch;
+
+import me.Danker.TheMod;
+import me.Danker.handlers.ConfigHandler;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+
+public class SkillTrackerCommand extends CommandBase {
+
+ @Override
+ public String getCommandName() {
+ return "skilltracker";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return "/" + getCommandName() + " <start/stop/reset>";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length == 1) {
+ return getListOfStringsMatchingLastWord(args, "start", "resume", "pause", "stop", "reset", "hide", "show");
+ }
+ return null;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ EntityPlayer player = (EntityPlayer) arg0;
+
+ if (arg1.length < 1) {
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0)));
+ return;
+ }
+
+ switch (arg1[0].toLowerCase()) {
+ case "start":
+ case "resume":
+ if (TheMod.skillStopwatch.isStarted() && TheMod.skillStopwatch.isSuspended()) {
+ TheMod.skillStopwatch.resume();
+ } else if (!TheMod.skillStopwatch.isStarted()) {
+ TheMod.skillStopwatch.start();
+ }
+ player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker started."));
+ break;
+ case "pause":
+ case "stop":
+ if (TheMod.skillStopwatch.isStarted() && !TheMod.skillStopwatch.isSuspended()) {
+ TheMod.skillStopwatch.suspend();
+ } else {
+ player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker paused."));
+ }
+ break;
+ case "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;
+ player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker reset."));
+ break;
+ case "hide":
+ TheMod.showSkillTracker = false;
+ ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", false);
+ player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker hidden."));
+ break;
+ case "show":
+ TheMod.showSkillTracker = true;
+ ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", true);
+ player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker shown."));
+ break;
+ default:
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0)));
+ }
+ }
+
+}