aboutsummaryrefslogtreecommitdiff
path: root/src/main/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
parent7af45a9bee936d6da43e8b9ee6473a8ecbcb3d7f (diff)
downloadSkyblockMod-637d39e2dad83b29503a1b12fc8e2f7f9e1489fa.tar.gz
SkyblockMod-637d39e2dad83b29503a1b12fc8e2f7f9e1489fa.tar.bz2
SkyblockMod-637d39e2dad83b29503a1b12fc8e2f7f9e1489fa.zip
Add auto add player waypoints
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java20
-rw-r--r--src/main/java/me/Danker/commands/ToggleCommand.java1
-rw-r--r--src/main/java/me/Danker/features/CrystalHollowWaypoints.java12
-rw-r--r--src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java8
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java3
5 files changed, 38 insertions, 6 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()));
}
diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java
index 9c56958..c8f37d6 100644
--- a/src/main/java/me/Danker/commands/ToggleCommand.java
+++ b/src/main/java/me/Danker/commands/ToggleCommand.java
@@ -44,6 +44,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
public static boolean gemstoneLore;
public static boolean crystalHollowWaypoints;
public static boolean crystalAutoWaypoints;
+ public static boolean crystalAutoPlayerWaypoints;
public static boolean autoAcceptReparty;
public static boolean abilityCooldowns;
public static boolean alerts;
diff --git a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java
index 1ce4150..f367877 100644
--- a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java
+++ b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java
@@ -1,6 +1,7 @@
package me.Danker.features;
import me.Danker.DankersSkyblockMod;
+import me.Danker.commands.CrystalHollowWaypointCommand;
import me.Danker.commands.ToggleCommand;
import me.Danker.handlers.ScoreboardHandler;
import me.Danker.utils.RenderUtils;
@@ -88,7 +89,7 @@ public class CrystalHollowWaypoints {
if (!king && entity.getCustomNameTag().endsWith("King Yolkar")) {
king = found = true;
waypoints.add(new Waypoint("King Yolkar", entity.getPosition()));
- } else if (!corleone && entity.getCustomNameTag().endsWith("Boss Corleone")) {
+ } else if (!corleone && entity.getCustomNameTag().contains("Boss Corleone")) {
corleone = found = true;
waypoints.add(new Waypoint("Boss Corleone", entity.getPosition()));
} else if (!guardian && entity.getCustomNameTag().contains("Key Guardian")) {
@@ -123,8 +124,15 @@ public class CrystalHollowWaypoints {
*/
if (ToggleCommand.crystalHollowWaypoints && Utils.tabLocation.equals("Crystal Hollows")) {
if (!message.contains(player.getName()) && (message.contains(": $DSMCHWP:") || message.contains(": $SBECHWP:"))) {
+ String waypoints = message.substring(message.lastIndexOf(":") + 1);
+
+ if (ToggleCommand.crystalAutoPlayerWaypoints) {
+ CrystalHollowWaypointCommand.addWaypoints(waypoints, true);
+ return;
+ }
+
ChatComponentText add = new ChatComponentText(EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + " [ADD]\n");
- add.setChatStyle(add.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/dsmaddcrystalhollowwaypoints " + message.substring(message.lastIndexOf(":") + 1))));
+ add.setChatStyle(add.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/dsmaddcrystalhollowwaypoints " + waypoints)));
new Thread(() -> {
try {
diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java
index fc0f108..7c54c98 100644
--- a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java
+++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java
@@ -1,5 +1,6 @@
package me.Danker.gui.crystalhollowwaypoints;
+import javafx.scene.control.Toggle;
import me.Danker.commands.ToggleCommand;
import me.Danker.features.CrystalHollowWaypoints;
import me.Danker.gui.DankerGui;
@@ -29,6 +30,7 @@ public class CrystalHollowWaypointsGui extends GuiScreen {
private GuiButton add;
private FeatureButton crystalHollowWaypoints;
private FeatureButton crystalAutoWaypoints;
+ private FeatureButton crystalAutoPlayerWaypoints;
public CrystalHollowWaypointsGui(int page) {
this.page = page;
@@ -55,11 +57,13 @@ public class CrystalHollowWaypointsGui extends GuiScreen {
add = new GuiButton(0, 0, 0, "Add Waypoint");
crystalHollowWaypoints = new FeatureButton("Crystal Hollows Waypoints: " + Utils.getColouredBoolean(ToggleCommand.crystalHollowWaypoints), "Shows waypoints to various places in the Crystal Hollows.");
crystalAutoWaypoints = new FeatureButton("Auto Waypoints: " + Utils.getColouredBoolean(ToggleCommand.crystalAutoWaypoints), "Automatically creates waypoints when you visit a special place in the Crystal Hollows.");
+ crystalAutoPlayerWaypoints = new FeatureButton("Auto Add Player Waypoints: " + Utils.getColouredBoolean(ToggleCommand.crystalAutoPlayerWaypoints), "Automatically adds waypoints sent from players.");
allButtons.clear();
allButtons.add(add);
allButtons.add(crystalHollowWaypoints);
allButtons.add(crystalAutoWaypoints);
+ allButtons.add(crystalAutoPlayerWaypoints);
for (int i = 0; i < CrystalHollowWaypoints.waypoints.size(); i++) {
CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(i);
GuiButton button = new GuiButton(i, 0, 0, waypoint.location + " >");
@@ -135,6 +139,10 @@ public class CrystalHollowWaypointsGui extends GuiScreen {
ToggleCommand.crystalAutoWaypoints = !ToggleCommand.crystalAutoWaypoints;
ConfigHandler.writeBooleanConfig("toggles", "CrystalAutoWaypoints", ToggleCommand.crystalAutoWaypoints);
crystalAutoWaypoints.displayString = "Auto Waypoints: " + Utils.getColouredBoolean(ToggleCommand.crystalAutoWaypoints);
+ } else if (button == crystalAutoPlayerWaypoints) {
+ ToggleCommand.crystalAutoPlayerWaypoints = !ToggleCommand.crystalAutoPlayerWaypoints;
+ ConfigHandler.writeBooleanConfig("toggles", "CrystalAutoPlayerWaypoints", ToggleCommand.crystalAutoPlayerWaypoints);
+ crystalAutoPlayerWaypoints.displayString = "Auto Add Player Waypoints: " + Utils.getColouredBoolean(ToggleCommand.crystalAutoPlayerWaypoints);
} else {
mc.displayGuiScreen(new CrystalHollowWaypointActionGui(button.id));
}
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index 21fa57f..b042177 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -221,11 +221,12 @@ public class ConfigHandler {
ToggleCommand.teammatesInRadius = initBoolean("toggles", "TeammatesInRadius", false);
ToggleCommand.giantHP = initBoolean("toggles", "GiantHP", false);
ToggleCommand.hidePetCandy = initBoolean("toggles", "HidePetCandy", false);
- ToggleCommand.customColouredNames = initBoolean("toggles", "CustomColouredNames", true);
+ ToggleCommand.customColouredNames = initBoolean("toggles", "CustomColouredNames", true); // enabled by default
ToggleCommand.endOfFarmAlert = initBoolean("toggles", "EndOfFarmAlert", false);
ToggleCommand.gemstoneLore = initBoolean("toggles", "GemstoneLore", false);
ToggleCommand.crystalHollowWaypoints = initBoolean("toggles", "CrystalHollowWaypoints", false);
ToggleCommand.crystalAutoWaypoints = initBoolean("toggles", "CrystalAutoWaypoints", true); // enabled by default
+ ToggleCommand.crystalAutoPlayerWaypoints = initBoolean("toggles", "CrystalAutoPlayerWaypoints", false);
ToggleCommand.autoAcceptReparty = initBoolean("toggles", "AutoAcceptReparty", false);
ToggleCommand.abilityCooldowns = initBoolean("toggles", "AbilityCooldowns", false);
ToggleCommand.dungeonTimerToggled = initBoolean("toggles", "DungeonTimer", false);