diff options
author | HacktheTime <l4bg0jb7@duck.com> | 2023-10-23 21:57:14 +0200 |
---|---|---|
committer | HacktheTime <l4bg0jb7@duck.com> | 2023-10-23 21:57:14 +0200 |
commit | 80ffe4a632c9d1cc2c7021b990939916fd0155e0 (patch) | |
tree | f14e131235d14f99b5cfb91a2672b10d969f3d8f /common/src/main | |
parent | d9501d4927e89da37274c3f20da2ecb657a7ae1f (diff) | |
download | BBsentials-80ffe4a632c9d1cc2c7021b990939916fd0155e0.tar.gz BBsentials-80ffe4a632c9d1cc2c7021b990939916fd0155e0.tar.bz2 BBsentials-80ffe4a632c9d1cc2c7021b990939916fd0155e0.zip |
added Numpad codes.
limitations:
currently missing scroll pane so youre limited because you cant edit the lower ones
commands are sent to the server so client side commands do not work unfortunately.
Diffstat (limited to 'common/src/main')
4 files changed, 26 insertions, 9 deletions
diff --git a/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java b/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java index 0d3662d..000cd70 100644 --- a/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java +++ b/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java @@ -191,22 +191,28 @@ public class Chat { },10, TimeUnit.SECONDS); } - public Message onEvent(Message text) { + public Message onEvent(Message text, boolean actionbar) { if (!isSpam(text.getString())) { if (BBsentials.getConfig().isDetailedDevModeEnabled()) { System.out.println("got a message: " + text.getJson()); } BBsentials.executionService.execute(() -> processThreaded(text)); - return processNotThreaded(text); + return processNotThreaded(text, actionbar); } return text; // Return the original message if it is spam } //Handle in the messages which need to be modified here - public Message processNotThreaded(Message message) { + public Message processNotThreaded(Message message, boolean actionbar) { // if (message.isFromParty()) { // message.replaceInJson("\"action\":\"run_command\",\"value\":\"/viewprofile", "\"action\":\"run_command\",\"value\":\"/bviewprofile " + messageUnformatted.split(">", 1)[1].trim()); // } + if (actionbar && !BBsentials.config.overwriteActionBar.isEmpty()) { + if (message.getUnformattedString().equals(BBsentials.config.overwriteActionBar.replaceAll("ยง.", ""))) { + return message; + } + return null; + } if (message.isFromReportedUser()) { sendPrivateMessageToSelfBase(Formatting.RED + "B: " + message.getUnformattedString()); return null; diff --git a/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java b/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java index 9344c4c..173d8d0 100644 --- a/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java +++ b/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java @@ -18,6 +18,7 @@ public class BBsentials { public static SplashStatusUpdateListener splashStatusUpdateListener; private static Thread bbthread; private static boolean initialised = false; + public static Chat chat = new Chat(); public static Config getConfig() { return config; @@ -78,7 +79,6 @@ public class BBsentials { config = Config.load(); executionService.scheduleAtFixedRate(EnvironmentCore.debug, 0, 20, TimeUnit.SECONDS); if (config.doGammaOverride) EnvironmentCore.mcoptions.setGamma(10); - Chat chat = new Chat(); if (Config.isBingoTime() || config.overrideBingoTime()) { connectToBBserver(); } diff --git a/common/src/main/java/de/hype/bbsentials/common/client/Config.java b/common/src/main/java/de/hype/bbsentials/common/client/Config.java index ee74855..62e5c16 100644 --- a/common/src/main/java/de/hype/bbsentials/common/client/Config.java +++ b/common/src/main/java/de/hype/bbsentials/common/client/Config.java @@ -20,7 +20,9 @@ public class Config implements Serializable { //You can change again // set automatically - private transient boolean isLeader; + private transient boolean isPartyLeader; + public transient String overwriteActionBar = ""; + public transient String alreadyReported = ""; public String[] bbsentialsRoles = {""}; public static List<String> partyMembers = new ArrayList<>(); @@ -127,11 +129,11 @@ public class Config implements Serializable { } public boolean isPartyLeader() { - return isLeader; + return isPartyLeader; } public void setIsLeader(boolean value) { - isLeader = value; + isPartyLeader = value; } public String getNickname() { @@ -193,6 +195,8 @@ public class Config implements Serializable { } public boolean hasBBRoles(String roleName) { + if (roleName == null) return true; + if (roleName.isEmpty()) return true; for (String role : bbsentialsRoles) { if (role.equalsIgnoreCase(roleName)) { return true; diff --git a/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCChat.java b/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCChat.java index 08cbff8..de46f84 100644 --- a/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCChat.java +++ b/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCChat.java @@ -1,13 +1,20 @@ package de.hype.bbsentials.common.mclibraries; import de.hype.bbsentials.common.chat.Message; +import de.hype.bbsentials.common.client.BBsentials; public interface MCChat { void init(); void sendChatMessage(String message); void sendClientSideMessage(Message message); - void sendClientSideMessage(Message message, boolean actionbar); - + default void sendClientSideMessage(Message message, boolean actionbar) { + if (BBsentials.config.swapActionBarChat && !BBsentials.config.swapOnlyNormal) { + actionbar = !actionbar; + } + else { + sendClientSideMessage(message); + } + } void showActionBar(Message message); } |