aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java2
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java6
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java60
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java6
4 files changed, 65 insertions, 9 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java
index d5ffbf9..ad986c7 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java
@@ -43,7 +43,7 @@ public class ComponentHandler {
if (formattedTabListPlayer.toLowerCase().contains("secrets found:")) DungeonHandler.parseTotalSecrets(formattedTabListPlayer);
if (formattedTabListPlayer.toLowerCase().contains("deaths:")) DungeonHandler.parseDeaths(formattedTabListPlayer);
if (formattedTabListPlayer.toLowerCase().contains("crypts:")) DungeonHandler.parseCrypts(formattedTabListPlayer);
- } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.DWARVENMINES)) {
+ } else if (LocationHandler.getCurrentLocation().getCategory().isMiningCategory()) {
if (formattedTabListPlayer.toLowerCase().contains("mithril powder:")) {
MinesHandler.parseMithril(formattedTabListPlayer);
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java
index 04d4a8c..c04bccc 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java
@@ -334,6 +334,12 @@ public class SBHConfig extends Config {
@ConfigOption(name = "Auto Waypoint", desc = "Turns on auto waypoints for the main areas of crystal hollows.")
@ConfigEditorBoolean
public boolean autoWaypoint = true;
+
+ @Expose
+ @ConfigOption(name = "Chat Waypoint Mode", desc = "Change the mode of the chat waypoint In Chat Bar will allow you to edit it before adding it to your waypoints.")
+ @ConfigEditorDropdown(values = { "Instant Add", "In chat bar" })
+ public int chatWaypointMode = 1;
+
}
public static class Trackers {
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java
index 54986e0..690f7b3 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java
@@ -15,18 +15,26 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.command.ICommandSender;
+import net.minecraft.event.ClickEvent;
+import net.minecraft.event.HoverEvent;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class CrystalWaypoints {
+ public static final Pattern LOCATION_MESSAGE_REGEX = Pattern.compile("\\{(.*) : \\((-?\\d+)/(-?\\d+)/(-?\\d+)\\)}");
+
public static final HashMap<String, BlockPos> waypoints = new HashMap<>();
private static final Set<Locations> IMPORTANT_WAYPOINTS = Sets.newHashSet(Locations.GOBLINQUEENSDEN, Locations.LOSTPRECURSORCITY, Locations.JUNGLETEMPLE, Locations.MINESOFDIVAN, Locations.KHAZADDM, Locations.FAIRYGROTTO);
@@ -61,6 +69,34 @@ public class CrystalWaypoints {
}
}
+ @SubscribeEvent
+ public void onChatMessage(ClientChatReceivedEvent event){
+ if (event.type != 2 && LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) {
+ Matcher matcher = LOCATION_MESSAGE_REGEX.matcher(event.message.getUnformattedText());
+ if (!matcher.find()) return;
+ ChatStyle style = new ChatStyle();
+ style.setParentStyle(event.message.getChatStyle());
+ ClickEvent.Action action = SkyblockHud.config.mining.chatWaypointMode == 0 ? ClickEvent.Action.RUN_COMMAND : ClickEvent.Action.SUGGEST_COMMAND;
+ style.setChatClickEvent(new ClickEvent(
+ action,
+ "/sbhpoints addat " + matcher.group(2) + " " + matcher.group(3) + " " + matcher.group(4) + " " + matcher.group(1)
+ ));
+ style.setChatHoverEvent(new HoverEvent(
+ HoverEvent.Action.SHOW_TEXT,
+ new ChatComponentText("Click to add waypoint!").setChatStyle(new ChatStyle().setBold(true))
+ ));
+ event.message.setChatStyle(style);
+ }
+ }
+
+ private static String copyWayPoint(String name){
+ BlockPos pos = waypoints.get(name);
+ if (pos == null) {
+ return null;
+ }
+ return "{" + name + " : (" + pos.getX() + "/" + pos.getY() + "/" + pos.getZ() + ")}";
+ }
+
public static class WaypointCommand extends SimpleCommand {
public WaypointCommand() {
@@ -84,6 +120,7 @@ public class CrystalWaypoints {
}
}
break;
+
case "remove":
if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) {
if (CrystalWaypoints.waypoints.containsKey(name)) {
@@ -93,6 +130,7 @@ public class CrystalWaypoints {
}
}
break;
+
case "move":
if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) {
if (CrystalWaypoints.waypoints.containsKey(name)) {
@@ -102,9 +140,11 @@ public class CrystalWaypoints {
}
}
break;
+
case "clear":
CrystalWaypoints.waypoints.clear();
break;
+
case "addat":
if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) {
name = String.join(" ", Arrays.copyOfRange(args, 4, args.length));
@@ -121,26 +161,36 @@ public class CrystalWaypoints {
}
}
break;
+
case "copy":
- BlockPos pos = waypoints.get(name);
- if (pos == null) {
+ String copyText = copyWayPoint(name);
+ if (copyText == null) {
sbhMessage(sender, "No waypoint with that name!");
break;
}
- StringSelection clipboard = new StringSelection(name + " : (" + pos.getX() + "/" + pos.getY() + "/" + pos.getZ() + ")");
+ StringSelection clipboard = new StringSelection(copyText);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard);
break;
+
+ case "send":
+ String sendText = copyWayPoint(name);
+ if (sendText == null) {
+ sbhMessage(sender, "No waypoint with that name!");
+ break;
+ }
+ Minecraft.getMinecraft().thePlayer.sendChatMessage(sendText);
+ break;
}
}
},
new TabCompleteRunnable() {
@Override
public List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos) {
- if (args.length == 2 && Utils.equalsIgnoreCaseAnyOf(args[0], "remove", "copy", "move")) {
+ if (args.length == 2 && Utils.equalsIgnoreCaseAnyOf(args[0], "remove", "copy", "move", "send")) {
return getListOfStringsMatchingLastWord(args, waypoints.keySet());
}
if (args.length == 1) {
- return getListOfStringsMatchingLastWord(args, Lists.newArrayList("add", "clear", "remove", "copy", "addat", "move"));
+ return getListOfStringsMatchingLastWord(args, Lists.newArrayList("add", "clear", "remove", "copy", "addat", "move", "send"));
}
if (args.length > 1 && args[0].equalsIgnoreCase("addat")) {
return func_175771_a(args, 1, pos);
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java
index 35791e8..e4994d1 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java
@@ -16,8 +16,8 @@ public class MinesHandler {
NONE(0, "Unknown", false, false),
TICKET(107, "Raffle", true, true),
GOBLIN(99, "Goblin Raid", true, true),
- WIND(107, "Gone With The Wind", false, false),
- TOGETHER(107, "Better Together", false, true);
+ WIND(0, "Gone With The Wind", false, false),
+ TOGETHER(171, "Better Together", false, true);
public int x;
public String displayName;
@@ -108,7 +108,7 @@ public class MinesHandler {
if (event.formattedLine.toLowerCase(Locale.ENGLISH).contains("nearby players")) {
MinesHandler.currentEvent = Event.TOGETHER;
try {
- MinesHandler.eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("nearby players", ""));
+ MinesHandler.eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("nearby players:", ""));
} catch (Exception ignored) {}
}