aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDoKM <mcazzyman@gmail.com>2021-08-29 16:13:49 +0200
committerDoKM <mcazzyman@gmail.com>2021-08-29 16:13:49 +0200
commit5ff913b685316c23317193cfeb30ae51f1a47f1d (patch)
tree11877a81b4f4a310e3cb6418361a0f22e6818aae /src
parentb9525a3419d695ce8b10e8da76ba61c0c6be54e2 (diff)
downloadNotEnoughUpdates-5ff913b685316c23317193cfeb30ae51f1a47f1d.tar.gz
NotEnoughUpdates-5ff913b685316c23317193cfeb30ae51f1a47f1d.tar.bz2
NotEnoughUpdates-5ff913b685316c23317193cfeb30ae51f1a47f1d.zip
Add Replace Social options chat with PV
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java5
3 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index ea9994a7..84c58aeb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -776,6 +776,20 @@ public class NEUEventListener {
return Utils.trimIgnoreColour(text.replaceAll(EnumChatFormatting.DARK_GREEN+"\\S+ Drill Fuel", ""));
}
+
+ private IChatComponent replaceSocialControlsWithPV(IChatComponent chatComponent){
+
+ if(NotEnoughUpdates.INSTANCE.config.misc.replaceSocialOptions && chatComponent.getChatStyle() != null && chatComponent.getChatStyle().getChatClickEvent() != null && chatComponent.getChatStyle().getChatClickEvent().getAction() == ClickEvent.Action.RUN_COMMAND){
+ if(chatComponent.getChatStyle().getChatClickEvent().getValue().startsWith("/socialoptions")){
+ String username = chatComponent.getChatStyle().getChatClickEvent().getValue().substring(15);
+
+ chatComponent.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/pv "+username, ""+EnumChatFormatting.YELLOW+"Click to open "+EnumChatFormatting.AQUA+EnumChatFormatting.BOLD+username+EnumChatFormatting.RESET+EnumChatFormatting.YELLOW+"'s profile in "+EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD+"NEU's"+EnumChatFormatting.RESET+EnumChatFormatting.YELLOW+ " profile viewer."));
+ return chatComponent;
+ }
+ }
+ return chatComponent;
+ }
+
/**
* 1) When receiving "You are playing on profile" messages, will set the current profile.
* 2) When a /viewrecipe command fails (i.e. player does not have recipe unlocked, will open the custom recipe GUI)
@@ -787,6 +801,8 @@ public class NEUEventListener {
CrystalMetalDetectorSolver.process(e.message);
e.message = processChatComponent(e.message);
return;
+ } else if(e.type == 0){
+ e.message = replaceSocialControlsWithPV(e.message);
}
DungeonWin.onChatMessage(e);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
index 6a083cae..b38e7fd5 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
@@ -38,6 +38,17 @@ public class Misc {
@ConfigEditorBoolean
public boolean guiButtonClicks = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Replace Chat Social Options",
+ desc = "Replace Hypixel's chat social options with NEU's profile viewer."
+ )
+ @ConfigEditorBoolean
+ public boolean replaceSocialOptions = true;
+
+
+
@Expose
@ConfigOption(
name = "Damage Indicator Style",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
index 3e84261c..7f1c20d3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -1045,6 +1045,11 @@ public class Utils {
style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.YELLOW+value)));
return style;
}
+ public static ChatStyle createClickStyle(ClickEvent.Action action, String value, String message) {
+ ChatStyle style = createClickStyle(action, value);
+ style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(message)));
+ return style;
+ }
public static void recursiveDelete(File file) {
if(file.isDirectory() && !Files.isSymbolicLink(file.toPath())) {