aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackthetime <l4bg0jb7@duck.com>2023-09-22 15:44:55 +0200
committerhackthetime <l4bg0jb7@duck.com>2023-09-22 15:44:55 +0200
commit0426478c522d7878c53e5c373d88022f357e1e74 (patch)
treeb45967b1d062e9e50abfaf6fbfad83cca868eed5
parentac682a3b1d956ae209dfe4d4e9126bb2261f955e (diff)
downloadBBsentials-0426478c522d7878c53e5c373d88022f357e1e74.tar.gz
BBsentials-0426478c522d7878c53e5c373d88022f357e1e74.tar.bz2
BBsentials-0426478c522d7878c53e5c373d88022f357e1e74.zip
added more Server Util methods too BBUtils.java.
-rw-r--r--src/main/java/de/hype/bbsentials/client/BBUtils.java29
-rw-r--r--src/main/java/de/hype/bbsentials/client/BBsentials.java286
-rw-r--r--src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java12
-rw-r--r--src/main/java/de/hype/bbsentials/client/DebugThread.java40
-rw-r--r--src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java99
-rw-r--r--src/main/java/de/hype/bbsentials/packets/packets/SplashUpdatePacket.java22
6 files changed, 302 insertions, 186 deletions
diff --git a/src/main/java/de/hype/bbsentials/client/BBUtils.java b/src/main/java/de/hype/bbsentials/client/BBUtils.java
index 284738a..984af72 100644
--- a/src/main/java/de/hype/bbsentials/client/BBUtils.java
+++ b/src/main/java/de/hype/bbsentials/client/BBUtils.java
@@ -12,10 +12,37 @@ public class BBUtils {
Chat.sendPrivateMessageToSelf("§4Could not get Area data. Are you in Skyblock?");
}
else {
- return Islands.getByDisplayName(string.replace("Area: ","").trim());
+ return Islands.getByDisplayName(string.replace("Area: ", "").trim());
}
} catch (Exception e) {
}
return null;
}
+
+ public static int getPlayerCount() {
+ return Integer.parseInt(MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!B-a").getDisplayName().getString().trim().replaceAll("[^0-9]", ""));
+ }
+
+ public static String getServer() {
+ return MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!C-c").getDisplayName().getString().replace("Server:", "").trim();
+ }
+
+ public static boolean isOnMegaServer() {
+ return getServer().toLowerCase().startsWith("mega");
+ }
+
+ public static boolean isOnMiniServer() {
+ return getServer().toLowerCase().startsWith("mini");
+ }
+
+ public static int getMaximumPlayerCount() {
+ boolean mega = isOnMegaServer();
+ Islands island = getCurrentIsland();
+ if (island == null) return 100;
+ if (island.equals(Islands.HUB)) {
+ if (mega) return 80;
+ else return 24;
+ }
+ return 24;
+ }
}
diff --git a/src/main/java/de/hype/bbsentials/client/BBsentials.java b/src/main/java/de/hype/bbsentials/client/BBsentials.java
index 70384f6..5c14c2e 100644
--- a/src/main/java/de/hype/bbsentials/client/BBsentials.java
+++ b/src/main/java/de/hype/bbsentials/client/BBsentials.java
@@ -28,139 +28,177 @@ import java.util.concurrent.TimeUnit;
import static de.hype.bbsentials.chat.Chat.*;
public class BBsentials implements ClientModInitializer {
- private boolean initialised = false;
public static Config config;
public static BBsentialConnection bbserver;
public static CommandsOLD coms;
public static ScheduledExecutorService executionService = Executors.newScheduledThreadPool(1000);
+ public static boolean splashLobby;
private static Thread bbthread;
+ private boolean initialised = false;
+
+ public static Config getConfig() {
+ return config;
+ }
+
+ public static void connectToBBserver() {
+ connectToBBserver(config.connectToBeta);
+ }
+
+ public static void connectToBBserver(boolean beta) {
+ if (bbserver != null) {
+ bbserver.sendHiddenMessage("exit");
+ }
+ if (bbthread != null) {
+ if (bbthread.isAlive()) {
+ bbthread.interrupt();
+ }
+ }
+ bbthread = new Thread(() -> {
+ bbserver = new BBsentialConnection();
+ coms = new CommandsOLD();
+ bbserver.setMessageReceivedCallback(message -> executionService.execute(() -> bbserver.onMessageReceived(message)));
+ if (beta) {
+ bbserver.connect(config.getBBServerURL(), 5011);
+ }
+ else {
+ bbserver.connect(config.getBBServerURL(), 5000);
+ }
+ executionService.scheduleAtFixedRate(new DebugThread(), 0, 20, TimeUnit.SECONDS);
+ });
+ bbthread.start();
+ }
+
+ public static void refreshCommands() {
+ Chat.sendPrivateMessageToSelf("Setting up commands");
+ coms = new CommandsOLD();
+ }
/**
* Runs the mod initializer on the client environment.
*/
@Override
public void onInitializeClient() {
- System.out.println("ide: " + Boolean.getBoolean("runningFromIDE"));
ClientPlayConnectionEvents.JOIN.register((a, b, c) -> {
+ splashLobby = false;
if (!initialised) {
config = Config.load();
Options.setGamma(10);
Chat chat = new Chat();
- ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
- dispatcher.register(ClientCommandManager.literal("bbi")
- .then(ClientCommandManager.literal("reconnect")
- .executes((context) -> {
- connectToBBserver();
- return 1;
- }))
- .then(ClientCommandManager.literal("reconnect-stable-server")
- .executes((context) -> {
- connectToBBserver(false);
- return 1;
- }))
- .then(ClientCommandManager.literal("reconnect-test-server")
- .executes((context) -> {
- connectToBBserver(true);
+ if (Config.isBingoTime() || config.overrideBingoTime()) {
+ connectToBBserver();
+ }
+ initialised = true;
+ }
+ });
+ }
+ {
+ ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
+ dispatcher.register(ClientCommandManager.literal("bbi")
+ .then(ClientCommandManager.literal("reconnect")
+ .executes((context) -> {
+ connectToBBserver();
+ return 1;
+ }))
+ .then(ClientCommandManager.literal("reconnect-stable-server")
+ .executes((context) -> {
+ connectToBBserver(false);
+ return 1;
+ }))
+ .then(ClientCommandManager.literal("reconnect-test-server")
+ .executes((context) -> {
+ connectToBBserver(true);
+ return 1;
+ }))
+ .then(ClientCommandManager.literal("config")
+ .then(ClientCommandManager.argument("category", StringArgumentType.string())
+ .suggests((context, builder) -> {
+ // Provide tab-completion options for config subfolder
+ return CommandSource.suggestMatching(new String[]{"save", "reset", "load"}, builder);
+ }).executes((context) -> {
+ String category = StringArgumentType.getString(context, "category");
+ switch (category) {
+ case "save":
+ getConfig().save();
+ sendPrivateMessageToSelf(Formatting.GREEN + "Saved config successfully");
+ break;
+ case "load":
+ BBsentials.config = Config.load();
+ break;
+ case "reset":
+ // Reset logic here
+ break;
+ }
return 1;
}))
- .then(ClientCommandManager.literal("config")
- .then(ClientCommandManager.argument("category", StringArgumentType.string())
+ .then(ClientCommandManager.literal("set-value")
+ .then(ClientCommandManager.argument("className", StringArgumentType.string())
.suggests((context, builder) -> {
- // Provide tab-completion options for config subfolder
- return CommandSource.suggestMatching(new String[]{"save", "reset", "load"}, builder);
- }).executes((context) -> {
- String category = StringArgumentType.getString(context, "category");
- switch (category) {
- case "save":
- getConfig().save();
- sendPrivateMessageToSelf(Formatting.GREEN + "Saved config successfully");
- break;
- case "load":
- BBsentials.config = Config.load();
- break;
- case "reset":
- // Reset logic here
- break;
- }
- return 1;
- }))
- .then(ClientCommandManager.literal("set-value")
- .then(ClientCommandManager.argument("className", StringArgumentType.string())
+ // Provide tab-completion options for classes
+ ArrayList<String> classNames = new ArrayList<>();
+ classNames.add("Config");
+ // Replace with your own logic to retrieve class names
+ return CommandSource.suggestMatching(classNames, builder);
+ })
+ .then(ClientCommandManager.argument("variableName", StringArgumentType.string())
.suggests((context, builder) -> {
- // Provide tab-completion options for classes
- ArrayList<String> classNames = new ArrayList<>();
- classNames.add("Config");
- // Replace with your own logic to retrieve class names
- return CommandSource.suggestMatching(classNames, builder);
+ // Provide tab-completion options for variable names
+ List<String> variableNames;
+ variableNames = List.of(getVariableInfo("de.hype.bbsentials.client", "Config"));
+ return CommandSource.suggestMatching(variableNames, builder);
})
- .then(ClientCommandManager.argument("variableName", StringArgumentType.string())
- .suggests((context, builder) -> {
- // Provide tab-completion options for variable names
- List<String> variableNames;
- variableNames = List.of(getVariableInfo("de.hype.bbsentials.client", "Config"));
- return CommandSource.suggestMatching(variableNames, builder);
- })
- .then(ClientCommandManager.argument("variableValue", StringArgumentType.string())
- .executes((context) -> {
- // Handle "variableName" and "variableValue" logic here
- String variableName = StringArgumentType.getString(context, "variableName");
- String variableValue = StringArgumentType.getString(context, "variableValue");
- try {
- if (!variableName.toLowerCase().contains("dev") || config.hasBBRoles("dev")) {
- setVariableValue(getConfig(), variableName, variableValue);
- }
- getConfig().save();
- } catch (ClassNotFoundException |
- NoSuchFieldException |
- IllegalAccessException |
- InstantiationException |
- InvocationTargetException |
- NoSuchMethodException e) {
- Chat.sendPrivateMessageToSelf("§cInvalid variable or value");
- }
- return 1;
- })))))
- .then(ClientCommandManager.literal("get-value")
- .then(ClientCommandManager.argument("className", StringArgumentType.string())
- .suggests((context, builder) -> {
- // Provide tab-completion options for classes
- ArrayList<String> classNames = new ArrayList<>();
- classNames.add("Config");
- // Replace with your own logic to retrieve class names
- return CommandSource.suggestMatching(classNames, builder);
- })
- .then(ClientCommandManager.argument("variableName", StringArgumentType.string())
- .suggests((context, builder) -> {
- // Provide tab-completion options for variable names
- List<String> variableNames;
- variableNames = List.of(getVariableInfo("de.hype.bbsentials.client", "Config"));
- return CommandSource.suggestMatching(variableNames, builder);
- })
+ .then(ClientCommandManager.argument("variableValue", StringArgumentType.string())
.executes((context) -> {
// Handle "variableName" and "variableValue" logic here
String variableName = StringArgumentType.getString(context, "variableName");
+ String variableValue = StringArgumentType.getString(context, "variableValue");
try {
- Chat.getVariableValue(getConfig(), variableName);
- } catch (Exception e) {
- e.printStackTrace();
+ if (!variableName.toLowerCase().contains("dev") || config.hasBBRoles("dev")) {
+ setVariableValue(getConfig(), variableName, variableValue);
+ }
+ getConfig().save();
+ } catch (ClassNotFoundException |
+ NoSuchFieldException |
+ IllegalAccessException |
+ InstantiationException |
+ InvocationTargetException |
+ NoSuchMethodException e) {
+ Chat.sendPrivateMessageToSelf("§cInvalid variable or value");
}
return 1;
- }))).executes((context) -> {
- // Handle the case when "config" argument is not provided
- // ...
- return 1;
- })))
- );
- }); //bbi
- if (Config.isBingoTime() || config.overrideBingoTime()) {
- connectToBBserver();
- }
- initialised = true;
- }
- });
- }
+ })))))
+ .then(ClientCommandManager.literal("get-value")
+ .then(ClientCommandManager.argument("className", StringArgumentType.string())
+ .suggests((context, builder) -> {
+ // Provide tab-completion options for classes
+ ArrayList<String> classNames = new ArrayList<>();
+ classNames.add("Config");
+ // Replace with your own logic to retrieve class names
+ return CommandSource.suggestMatching(classNames, builder);
+ })
+ .then(ClientCommandManager.argument("variableName", StringArgumentType.string())
+ .suggests((context, builder) -> {
+ // Provide tab-completion options for variable names
+ List<String> variableNames;
+ variableNames = List.of(getVariableInfo("de.hype.bbsentials.client", "Config"));
+ return CommandSource.suggestMatching(variableNames, builder);
+ })
+ .executes((context) -> {
+ // Handle "variableName" and "variableValue" logic here
+ String variableName = StringArgumentType.getString(context, "variableName");
+ try {
+ Chat.getVariableValue(getConfig(), variableName);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return 1;
+ }))).executes((context) -> {
+ // Handle the case when "config" argument is not provided
+ // ...
+ return 1;
+ })))
+ );
+ }); //bbi
- {
KeyBinding devKeyBind = new KeyBinding("Open Mod Menu Config", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_ADD, "BBsentials: Developing Tools");
KeyBindingHelper.registerKeyBinding(devKeyBind);
ClientTickEvents.END_CLIENT_TICK.register(client -> {
@@ -198,42 +236,4 @@ public class BBsentials implements ClientModInitializer {
});
}
} // KeyBinds
-
- public static Config getConfig() {
- return config;
- }
-
- public static void connectToBBserver() {
- connectToBBserver(config.connectToBeta);
- }
-
- public static void connectToBBserver(boolean beta) {
- if (bbserver != null) {
- bbserver.sendHiddenMessage("exit");
- }
- if (bbthread != null) {
- if (bbthread.isAlive()) {
- bbthread.interrupt();
- }
- }
- bbthread = new Thread(() -> {
- bbserver = new BBsentialConnection();
- coms = new CommandsOLD();
- bbserver.setMessageReceivedCallback(message -> executionService.execute(()->bbserver.onMessageReceived(message)));
- if (beta) {
- bbserver.connect(config.getBBServerURL(), 5011);
- }
- else {
- bbserver.connect(config.getBBServerURL(), 5000);
- }
- executionService.scheduleAtFixedRate(new DebugThread(), 0, 20, TimeUnit.SECONDS);
- });
- bbthread.start();
- }
-
- public static void refreshCommands() {
- Chat.sendPrivateMessageToSelf("Setting up commands");
- coms = new CommandsOLD();
- }
-
} \ No newline at end of file
diff --git a/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java b/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java
index ebd6498..11b3dda 100644
--- a/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java
+++ b/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java
@@ -177,7 +177,7 @@ public class CommandsOLD {
)
)
);
- }); /*chchest*/
+ });/*chchest*/
event.register((dispatcher, registryAccess) -> {
dispatcher.register(
ClientCommandManager.literal("bbserver")
@@ -277,7 +277,7 @@ public class CommandsOLD {
String extramessage = StringArgumentType.getString(context, "extramessage");
String location = StringArgumentType.getString(context, "location");
boolean lessWaste = Boolean.parseBoolean(StringArgumentType.getString(context, "lasswaste"));
- sendPacket(new SplashNotifyPacket(0,hub, config.getUsername(), location, BBUtils.getCurrentIsland() , extramessage, lessWaste));
+ splashAnnounce(hub, location, extramessage, lessWaste);
return 1;
})
)
@@ -285,14 +285,14 @@ public class CommandsOLD {
int hub = IntegerArgumentType.getInteger(context, "Hub");
String location = "bea";
boolean lessWaste = Boolean.parseBoolean(StringArgumentType.getString(context, "lasswaste"));
- sendPacket(new SplashNotifyPacket(0,hub, config.getUsername(), location, BBUtils.getCurrentIsland(), "", lessWaste));
+ splashAnnounce(hub, location, "", lessWaste);
return 1;
})
))
.executes((context) -> {
int hub = IntegerArgumentType.getInteger(context, "Hub");
String location = StringArgumentType.getString(context, "location");
- sendPacket(new SplashNotifyPacket(0,hub, config.getUsername(), location, BBUtils.getCurrentIsland(), "", true));
+ splashAnnounce(hub, location, "", true);
return 1;
})
@@ -330,6 +330,10 @@ public class CommandsOLD {
);
}
+ public void splashAnnounce(int hubNumber, String locationInHub, String extramessage, boolean lessWaste) {
+ sendPacket(new SplashNotifyPacket(0, hubNumber, config.getUsername(), locationInHub, BBUtils.getCurrentIsland(), extramessage, lessWaste));
+ }
+
public void sendCommand(String message) {
BBsentials.bbserver.sendCommand(message);
diff --git a/src/main/java/de/hype/bbsentials/client/DebugThread.java b/src/main/java/de/hype/bbsentials/client/DebugThread.java
index 280ab7d..418cb2d 100644
--- a/src/main/java/de/hype/bbsentials/client/DebugThread.java
+++ b/src/main/java/de/hype/bbsentials/client/DebugThread.java
@@ -1,16 +1,54 @@
package de.hype.bbsentials.client;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.scoreboard.Scoreboard;
+import java.util.ArrayList;
+import java.util.List;
+
public class DebugThread implements Runnable {
Scoreboard temp;
+
@Override
public void run() {
- loop();
+ loop();
//place a breakpoint for only this thread here.
}
public void loop() {
}
+
+ public static List<String> test() {
+ List<PlayerListEntry> tabList = MinecraftClient.getInstance().player.networkHandler.getPlayerList().stream().toList();
+ List<PlayerListEntry> goodTabList = MinecraftClient.getInstance().player.networkHandler.getPlayerList().stream().toList();
+ for (PlayerListEntry playerListEntry : tabList) {
+ try {
+ if (!playerListEntry.getProfile().getName().startsWith("!")) {
+ goodTabList.add(playerListEntry);
+ }
+ } catch (Exception ignored) {
+
+ }
+ }
+ List<String> stringList = new ArrayList<>();
+ for (PlayerListEntry playerListEntry : goodTabList) {
+ try {
+ String string = playerListEntry.getDisplayName().getString();
+ String string2 = (string.replaceAll("\\[\\d+\\]", ""));
+ if (!string.isEmpty()) {
+ if (!string.equals(string2)) {
+ stringList.add(string2);
+ }
+ }
+ } catch (Exception ignored) {
+ }
+ }
+ return stringList;
+ }
+
+ public static List<String> playersOnTabList() {
+ return test().stream().map((string) -> string.replaceAll("[^\\p{L}\\p{N}]+", "")).toList();
+ }
}
diff --git a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
index 8df4fc5..68ce520 100644
--- a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
+++ b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
@@ -1,6 +1,7 @@
package de.hype.bbsentials.communication;
import de.hype.bbsentials.chat.Chat;
+import de.hype.bbsentials.client.BBUtils;
import de.hype.bbsentials.client.BBsentials;
import de.hype.bbsentials.constants.enviromentShared.*;
import de.hype.bbsentials.packets.AbstractPacket;
@@ -33,7 +34,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import static de.hype.bbsentials.client.BBsentials.config;
-import static de.hype.bbsentials.client.BBsentials.executionService;
+import static de.hype.bbsentials.client.BBsentials.splashLobby;
public class BBsentialConnection {
private Socket socket;
@@ -126,7 +127,7 @@ public class BBsentialConnection {
PublicKey serverPublicKey = serverCertificate.getPublicKey();
// Create a TrustManager that trusts only the server's public key
- TrustManager[] trustManagers = new TrustManager[] {new X509TrustManager() {
+ TrustManager[] trustManagers = new TrustManager[]{new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null; // We don't need to check the client's certificates
}
@@ -344,27 +345,49 @@ public class BBsentialConnection {
public void onSplashNotifyPacket(SplashNotifyPacket packet) {
int waitTime;
- if (packet.lessWaste) {
- waitTime = Math.min(((getPotTime() * 1000) / 80),25*1000);
- }
- else {
- waitTime = 0;
- }
- String where;
- if (packet.hubType.equals(Islands.DUNGEON_HUB)) {
- where = "§5DUNGEON HUB§6";
+
+ if (packet.splasherUsername.equals(config.getUsername())) {
+ BBsentials.splashLobby = true;
+ String status = SplashUpdatePacket.STATUS_WAITING;
+ String newStatus = SplashUpdatePacket.STATUS_WAITING;
+ int maxPlayerCount = BBUtils.getMaximumPlayerCount() - 5;
+ while (splashLobby && !status.equals(SplashUpdatePacket.STATUS_DONE)) {
+ if (BBUtils.getPlayerCount() >= maxPlayerCount) {
+ newStatus = SplashUpdatePacket.STATUS_FULL;
+ }
+ if (!status.equals(newStatus)) {
+ status = newStatus;
+ sendPacket(new SplashUpdatePacket(packet.splashId, status));
+ }
+ }
+ if (!status.equals(newStatus)) {
+ status = newStatus;
+ sendPacket(new SplashUpdatePacket(packet.splashId, status));
+ }
}
else {
- where = "Hub";
- }
- BBsentials.executionService.schedule(() -> {
- splashHighlightItem("HUB #" + packet.hub, 20);
- String timeLoss = "";
if (packet.lessWaste) {
- timeLoss = "§c(" + waitTime + ")";
+ waitTime = Math.min(((getPotTime() * 1000) / 80), 25 * 1000);
+ }
+ else {
+ waitTime = 0;
}
- Chat.sendPrivateMessageToSelf("§6" + packet.splasherUsername + " is Splashing in " + where + " #" + packet.hub + " at " + packet.location + ":" + packet.extraMessage + " | " + timeLoss);
- }, waitTime, TimeUnit.MILLISECONDS);
+ String where;
+ if (packet.hubType.equals(Islands.DUNGEON_HUB)) {
+ where = "§5DUNGEON HUB§6";
+ }
+ else {
+ where = "Hub";
+ }
+ BBsentials.executionService.schedule(() -> {
+ splashHighlightItem("HUB #" + packet.hub, 20);
+ String timeLoss = "";
+ if (packet.lessWaste) {
+ timeLoss = "§c(" + waitTime + ")";
+ }
+ Chat.sendPrivateMessageToSelf("§6" + packet.splasherUsername + " is Splashing in " + where + " #" + packet.hub + " at " + packet.location + ":" + packet.extraMessage + " | " + timeLoss);
+ }, waitTime, TimeUnit.MILLISECONDS);
+ }
}
public void onBingoChatMessagePacket(BingoChatMessagePacket packet) {
@@ -375,13 +398,14 @@ public class BBsentialConnection {
public void onChChestPacket(ChChestPacket packet) {
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);
- if (!(packet.extraMessage == null || packet.extraMessage.isEmpty())) {
- tellrawText = tellrawText.replace("@extramessage", " : " + packet.extraMessage);
+ 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);
+ if (!(packet.extraMessage == null || packet.extraMessage.isEmpty())) {
+ tellrawText = tellrawText.replace("@extramessage", " : " + packet.extraMessage);
+ }
+ Chat.sendPrivateMessageToSelfText(Chat.createClientSideTellraw(tellrawText));
}
- Chat.sendPrivateMessageToSelfText(Chat.createClientSideTellraw(tellrawText));}
}
else {
Chat.sendPrivateMessageToSelf("§cFiltered out a suspicious packet! Please send a screenshot of this message with ping Hype_the_Time (hackthetime) in Bingo Apothecary, BB, SBZ, offical Hypixel,...");
@@ -392,7 +416,7 @@ public class BBsentialConnection {
public void onMiningEventPacket(MiningEventPacket packet) {
if (config.toDisplayConfig.getValue("disableAll")) {
//its will returns false cause disabled is checked already before.
- if (config.toDisplayConfig.blockChEvents&&packet.island.equals(Islands.CRYSTAL_HOLLOWS)) return;
+ if (config.toDisplayConfig.blockChEvents && packet.island.equals(Islands.CRYSTAL_HOLLOWS)) return;
if (packet.event.equals(MiningEvents.RAFFLE)) {
if (!config.toDisplayConfig.raffle) return;
}
@@ -480,17 +504,18 @@ public class BBsentialConnection {
public boolean showChChest(ChChestItem[] items) {
if (config.toDisplayConfig.allChChestItem) return true;
for (ChChestItem item : items) {
- if (config.toDisplayConfig.customChChestItem&&item.isCustom()) return true;
- if (config.toDisplayConfig.allRoboPart&&item.isRoboPart()) return true;
- if (config.toDisplayConfig.prehistoricEgg&&item.equals(ChChestItems.PrehistoricEgg)) return true;
- if (config.toDisplayConfig.pickonimbus2000&&item.equals(ChChestItems.Pickonimbus2000)) return true;
- if (config.toDisplayConfig.controlSwitch&&item.equals(ChChestItems.ControlSwitch)) return true;
- if (config.toDisplayConfig.electronTransmitter&&item.equals(ChChestItems.ElectronTransmitter)) return true;
- if (config.toDisplayConfig.robotronReflector&&item.equals(ChChestItems.RobotronReflector)) return true;
- if (config.toDisplayConfig.superliteMotor&&item.equals(ChChestItems.SuperliteMotor)) return true;
- if (config.toDisplayConfig.syntheticHeart&&item.equals(ChChestItems.SyntheticHeart)) return true;
- if (config.toDisplayConfig.flawlessGemstone&&item.equals(ChChestItems.FlawlessGemstone)) return true;
- if (config.toDisplayConfig.jungleHeart&&item.equals(ChChestItems.JungleHeart)) return true;
+ if (config.toDisplayConfig.customChChestItem && item.isCustom()) return true;
+ if (config.toDisplayConfig.allRoboPart && item.isRoboPart()) return true;
+ if (config.toDisplayConfig.prehistoricEgg && item.equals(ChChestItems.PrehistoricEgg)) return true;
+ if (config.toDisplayConfig.pickonimbus2000 && item.equals(ChChestItems.Pickonimbus2000)) return true;
+ if (config.toDisplayConfig.controlSwitch && item.equals(ChChestItems.ControlSwitch)) return true;
+ if (config.toDisplayConfig.electronTransmitter && item.equals(ChChestItems.ElectronTransmitter))
+ return true;
+ if (config.toDisplayConfig.robotronReflector && item.equals(ChChestItems.RobotronReflector)) return true;
+ if (config.toDisplayConfig.superliteMotor && item.equals(ChChestItems.SuperliteMotor)) return true;
+ if (config.toDisplayConfig.syntheticHeart && item.equals(ChChestItems.SyntheticHeart)) return true;
+ if (config.toDisplayConfig.flawlessGemstone && item.equals(ChChestItems.FlawlessGemstone)) return true;
+ if (config.toDisplayConfig.jungleHeart && item.equals(ChChestItems.JungleHeart)) return true;
}
return false;
}
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/SplashUpdatePacket.java b/src/main/java/de/hype/bbsentials/packets/packets/SplashUpdatePacket.java
new file mode 100644
index 0000000..201ff37
--- /dev/null
+++ b/src/main/java/de/hype/bbsentials/packets/packets/SplashUpdatePacket.java
@@ -0,0 +1,22 @@
+package de.hype.bbsentials.packets.packets;
+
+
+import de.hype.bbsentials.packets.AbstractPacket;
+
+public class SplashUpdatePacket extends AbstractPacket {
+ public static final String STATUS_WAITING = "Waiting";
+ public static final String STATUS_FULL = "Full";
+ public static final String STATUS_SPLASHING = "Splashing";
+ public static final String STATUS_CANCELED = "Canceled";
+ public static final String STATUS_DONE = "Done";
+
+
+ public SplashUpdatePacket(int splashId, String status) {
+ super(1, 1); //Min and Max supported Version
+ this.splashId = splashId;
+ this.status = status;
+ }
+
+ public final int splashId;
+ public final String status;
+}