aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2022-04-16 20:52:59 -0400
committerbowser0000 <bowser0000@gmail.com>2022-04-16 20:52:59 -0400
commit637d39e2dad83b29503a1b12fc8e2f7f9e1489fa (patch)
treeaa910a2906cbd618f6ea26552b36281e01d28388 /src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java
parent7af45a9bee936d6da43e8b9ee6473a8ecbcb3d7f (diff)
downloadSkyblockMod-637d39e2dad83b29503a1b12fc8e2f7f9e1489fa.tar.gz
SkyblockMod-637d39e2dad83b29503a1b12fc8e2f7f9e1489fa.tar.bz2
SkyblockMod-637d39e2dad83b29503a1b12fc8e2f7f9e1489fa.zip
Add auto add player waypoints
Diffstat (limited to 'src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java')
-rw-r--r--src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java b/src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java
index 1aacf50..f5dea9b 100644
--- a/src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java
+++ b/src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java
@@ -2,6 +2,7 @@ package me.Danker.commands;
import me.Danker.DankersSkyblockMod;
import me.Danker.features.CrystalHollowWaypoints;
+import net.minecraft.client.Minecraft;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
@@ -28,11 +29,13 @@ public class CrystalHollowWaypointCommand extends CommandBase {
@Override
public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
- EntityPlayer player = (EntityPlayer) arg0;
-
if (arg1.length == 0) return;
+ addWaypoints(String.join(" ", arg1), false);
+ }
- String[] waypoints = String.join(" ", arg1).split("\\\\n");
+ public static void addWaypoints(String list, boolean auto) {
+ EntityPlayer player = Minecraft.getMinecraft().thePlayer;
+ String[] waypoints = list.split("\\\\n");
for (String waypoint : waypoints) {
String[] parts = waypoint.split("@-");
@@ -42,6 +45,17 @@ public class CrystalHollowWaypointCommand extends CommandBase {
BlockPos pos = new BlockPos(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2]));
CrystalHollowWaypoints.Waypoint newWaypoint = new CrystalHollowWaypoints.Waypoint(location, pos);
+ if (auto) {
+ boolean contains = false;
+ for (CrystalHollowWaypoints.Waypoint existing : CrystalHollowWaypoints.waypoints) {
+ if (existing.location.equals(location)) {
+ contains = true;
+ break;
+ }
+ }
+ if (contains) continue;
+ }
+
CrystalHollowWaypoints.waypoints.add(newWaypoint);
player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Added " + newWaypoint.location + " @ " + newWaypoint.getPos()));
}