diff options
Diffstat (limited to 'common/src/main')
-rw-r--r-- | common/src/main/java/de/hype/bbsentials/common/client/DebugThread.java | 5 | ||||
-rw-r--r-- | common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/common/src/main/java/de/hype/bbsentials/common/client/DebugThread.java b/common/src/main/java/de/hype/bbsentials/common/client/DebugThread.java index d51fcec..eaf3ee1 100644 --- a/common/src/main/java/de/hype/bbsentials/common/client/DebugThread.java +++ b/common/src/main/java/de/hype/bbsentials/common/client/DebugThread.java @@ -1,13 +1,14 @@ package de.hype.bbsentials.common.client; +import java.util.Collections; import java.util.List; public interface DebugThread extends Runnable { @Override public default void run() { - loop(); + loop(); //place a breakpoint for only this thread here. } @@ -15,6 +16,6 @@ public interface DebugThread extends Runnable { } public default List<String> test() { - return List.of(""); + return Collections.singletonList(""); } } diff --git a/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java b/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java index 76ee4bd..6dd9edb 100644 --- a/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java +++ b/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java @@ -29,6 +29,7 @@ import java.security.cert.X509Certificate; import java.util.Arrays; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; public class BBsentialConnection { private Socket socket; @@ -325,7 +326,13 @@ public class BBsentialConnection { if (isCommandSafe(packet.bbcommand)) { if (showChChest(packet.items)) { String tellrawText = ("{\"text\":\"BB: @username found @item in a chest at (@coords). Click here to get a party invite @extramessage\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"@inviteCommand\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"On clicking you will get invited to a party. Command executed: @inviteCommand\"]}}"); - tellrawText = tellrawText.replace("@username", packet.announcerUsername).replace("@item", Arrays.stream(packet.items).map(ChChestItem::getDisplayName).toList().toString()).replace("@coords", packet.locationCoords).replace("@inviteCommand", packet.bbcommand); + tellrawText = tellrawText.replace("@username", packet.announcerUsername); + tellrawText = tellrawText.replace("@item", Arrays.stream(packet.items) + .map(ChChestItem::getDisplayName) + .collect(Collectors.toList()) + .toString()); + tellrawText = tellrawText.replace("@coords", packet.locationCoords); + tellrawText = tellrawText.replace("@inviteCommand", packet.bbcommand); if (!(packet.extraMessage == null || packet.extraMessage.isEmpty())) { tellrawText = tellrawText.replace("@extramessage", " : " + packet.extraMessage); } |