aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/hype/bbsentials/client/BBsentials.java2
-rw-r--r--src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java5
-rw-r--r--src/main/java/de/hype/bbsentials/client/ToDisplayConfig.java2
-rw-r--r--src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java28
4 files changed, 30 insertions, 7 deletions
diff --git a/src/main/java/de/hype/bbsentials/client/BBsentials.java b/src/main/java/de/hype/bbsentials/client/BBsentials.java
index 6641c10..70384f6 100644
--- a/src/main/java/de/hype/bbsentials/client/BBsentials.java
+++ b/src/main/java/de/hype/bbsentials/client/BBsentials.java
@@ -219,7 +219,7 @@ public class BBsentials implements ClientModInitializer {
bbthread = new Thread(() -> {
bbserver = new BBsentialConnection();
coms = new CommandsOLD();
- bbserver.setMessageReceivedCallback(message -> bbserver.onMessageReceived(message));
+ bbserver.setMessageReceivedCallback(message -> executionService.execute(()->bbserver.onMessageReceived(message)));
if (beta) {
bbserver.connect(config.getBBServerURL(), 5011);
}
diff --git a/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java b/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java
index 4719557..2d0039c 100644
--- a/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java
+++ b/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java
@@ -172,6 +172,11 @@ public class BBsentialsConfigScreemFactory {
.setTooltip(Text.of("Select to receive notifications when any Flawless Gemstone is found"))
.setSaveConsumer(newValue -> config.toDisplayConfig.flawlessGemstone = newValue)
.build());
+ chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("Jungle Heart"), config.toDisplayConfig.jungleHeart)
+ .setDefaultValue(false)
+ .setTooltip(Text.of("Select to receive notifications when a JungleHeart is found"))
+ .setSaveConsumer(newValue -> config.toDisplayConfig.jungleHeart = newValue)
+ .build());
}//CHChestItems
ConfigCategory miningEvents = builder.getOrCreateCategory(Text.of("Mining Events"));
{
diff --git a/src/main/java/de/hype/bbsentials/client/ToDisplayConfig.java b/src/main/java/de/hype/bbsentials/client/ToDisplayConfig.java
index d3a1707..4a048ab 100644
--- a/src/main/java/de/hype/bbsentials/client/ToDisplayConfig.java
+++ b/src/main/java/de/hype/bbsentials/client/ToDisplayConfig.java
@@ -25,6 +25,8 @@ public class ToDisplayConfig {
public boolean superliteMotor = false;
public boolean syntheticHeart = false;
public boolean flawlessGemstone = false;
+ public boolean jungleHeart = false;
+
//Mining Events.
public boolean allEvents = true;
public boolean blockChEvents = false;
diff --git a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
index e70d0ad..4a8fb50 100644
--- a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
+++ b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
@@ -2,10 +2,7 @@ package de.hype.bbsentials.communication;
import de.hype.bbsentials.chat.Chat;
import de.hype.bbsentials.client.BBsentials;
-import de.hype.bbsentials.constants.enviromentShared.AuthenticationConstants;
-import de.hype.bbsentials.constants.enviromentShared.ChChestItem;
-import de.hype.bbsentials.constants.enviromentShared.Islands;
-import de.hype.bbsentials.constants.enviromentShared.MiningEvents;
+import de.hype.bbsentials.constants.enviromentShared.*;
import de.hype.bbsentials.packets.AbstractPacket;
import de.hype.bbsentials.packets.PacketManager;
import de.hype.bbsentials.packets.PacketUtils;
@@ -36,6 +33,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;
public class BBsentialConnection {
private Socket socket;
@@ -377,12 +375,13 @@ 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);
}
- 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,...");
@@ -393,6 +392,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 (packet.event.equals(MiningEvents.RAFFLE)) {
if (!config.toDisplayConfig.raffle) return;
}
@@ -477,9 +477,25 @@ 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;
+ }
+ return false;
+ }
public interface MessageReceivedCallback {
void onMessageReceived(String message);
}
-
} \ No newline at end of file