diff options
author | ThatGravyBoat <thatgravyboat@gmail.com> | 2021-07-15 21:29:51 -0230 |
---|---|---|
committer | ThatGravyBoat <thatgravyboat@gmail.com> | 2021-07-15 21:29:51 -0230 |
commit | 9c759882a1a92593fae687d19106b4a348fc7a4b (patch) | |
tree | b29343929ef2fb617a47ba07d2c0e1160f820741 /src/main/java | |
parent | c63a02e77465296e9b6b099ff61451ee67c8c850 (diff) | |
download | SkyblockHud-Death-Defied-9c759882a1a92593fae687d19106b4a348fc7a4b.tar.gz SkyblockHud-Death-Defied-9c759882a1a92593fae687d19106b4a348fc7a4b.tar.bz2 SkyblockHud-Death-Defied-9c759882a1a92593fae687d19106b4a348fc7a4b.zip |
Added move command for waypoints and updated trackers thanks Jani
Diffstat (limited to 'src/main/java')
3 files changed, 20 insertions, 10 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/Utils.java b/src/main/java/com/thatgravyboat/skyblockhud/Utils.java index f65af86..b190673 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/Utils.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/Utils.java @@ -363,4 +363,9 @@ public class Utils { formatter.setRoundingMode(RoundingMode.FLOOR); return number > numberToFormatAt - 1 ? formatter.format((double) number / 1000) + "k" : String.valueOf(number); } + + public static boolean equalsIgnoreCaseAnyOf(String string, String... strings){ + for (String o : strings) if (string.equalsIgnoreCase(o)) return true; + return false; + } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java b/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java index c13a7b8..bc98672 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java @@ -54,10 +54,8 @@ public class KillTracking { @SubscribeEvent public void onWorldChange(EntityJoinWorldEvent event) { - if (event.entity != null) { - if (event.entity.getUniqueID().equals(Minecraft.getMinecraft().thePlayer.getUniqueID())) { - attackedEntities.clear(); - } + if (event.entity == Minecraft.getMinecraft().thePlayer) { + attackedEntities.clear(); } } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java index 6354591..1e63a0b 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java @@ -42,10 +42,8 @@ public class CrystalWaypoints { @SubscribeEvent public void onWorldChange(EntityJoinWorldEvent event) { - if (event.entity != null) { - if (event.entity.getUniqueID().equals(Minecraft.getMinecraft().thePlayer.getUniqueID())) { - waypoints.clear(); - } + if (event.entity == Minecraft.getMinecraft().thePlayer) { + waypoints.clear(); } } @@ -95,6 +93,15 @@ public class CrystalWaypoints { } } break; + case "move": + if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { + if (CrystalWaypoints.waypoints.containsKey(name)) { + CrystalWaypoints.waypoints.put(name, sender.getPosition().add(0.5, 0.5, 0.5)); + } else { + sbhMessage(sender, "Waypoint doesnt exist!"); + } + } + break; case "clear": CrystalWaypoints.waypoints.clear(); break; @@ -129,11 +136,11 @@ public class CrystalWaypoints { new TabCompleteRunnable() { @Override public List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos) { - if (args.length == 2 && (args[0].equalsIgnoreCase("remove") || args[0].equalsIgnoreCase("copy"))) { + if (args.length == 2 && Utils.equalsIgnoreCaseAnyOf (args[0], "remove","copy", "move")) { return getListOfStringsMatchingLastWord(args, waypoints.keySet()); } if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, Lists.newArrayList("add", "clear", "remove", "copy", "addat")); + return getListOfStringsMatchingLastWord(args, Lists.newArrayList("add", "clear", "remove", "copy", "addat", "move")); } if (args.length > 1 && args[0].equalsIgnoreCase("addat")) { return func_175771_a(args, 1, pos); |