aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHacktheTime <l4bg0jb7@duck.com>2023-10-12 20:17:28 +0200
committerHacktheTime <l4bg0jb7@duck.com>2023-10-12 20:17:28 +0200
commitdba4a297e295d68980da31264b0069fe9b18a13e (patch)
treec7e0a99968ef34509037f969ab7b1beba04a996d
parente111619d66346a2309b86a00420681f4cddf3cea (diff)
downloadBBsentials-dba4a297e295d68980da31264b0069fe9b18a13e.tar.gz
BBsentials-dba4a297e295d68980da31264b0069fe9b18a13e.tar.bz2
BBsentials-dba4a297e295d68980da31264b0069fe9b18a13e.zip
preperations to have a common code and different implementations for forge and fabric to ease up maintaining both versions
-rw-r--r--common/build.gradle (renamed from build.gradle)5
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/api/Discord.java (renamed from src/main/java/de/hype/bbsentials/api/Discord.java)6
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/api/Formatting.java36
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/api/ISimpleOption.java (renamed from src/main/java/de/hype/bbsentials/api/ISimpleOption.java)2
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/chat/Chat.java (renamed from src/main/java/de/hype/bbsentials/chat/Chat.java)63
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/chat/Message.java (renamed from src/main/java/de/hype/bbsentials/chat/Message.java)35
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/chat/Sender.java (renamed from src/main/java/de/hype/bbsentials/chat/Sender.java)14
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java (renamed from src/main/java/de/hype/bbsentials/client/BBsentials.java)40
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/client/Commands/CommandsOLD.java (renamed from src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java)40
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/client/Config.java (renamed from src/main/java/de/hype/bbsentials/client/Config.java)23
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/client/CustomGson.java (renamed from src/main/java/de/hype/bbsentials/client/CustomGson.java)2
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/client/DebugThread.java (renamed from src/main/java/de/hype/bbsentials/client/DebugThread.java)2
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/client/SplashManager.java (renamed from src/main/java/de/hype/bbsentials/client/SplashManager.java)10
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java (renamed from src/main/java/de/hype/bbsentials/client/SplashStatusUpdateListener.java)15
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/client/ToDisplayConfig.java (renamed from src/main/java/de/hype/bbsentials/client/ToDisplayConfig.java)8
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java (renamed from src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java)134
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/constants/BBDisplayNameProvider.java (renamed from src/main/java/de/hype/bbsentials/constants/BBDisplayNameProvider.java)2
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/constants/BBDisplayNameProviderWithCustom.java (renamed from src/main/java/de/hype/bbsentials/constants/BBDisplayNameProviderWithCustom.java)2
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/AuthenticationConstants.java (renamed from src/main/java/de/hype/bbsentials/constants/enviromentShared/AuthenticationConstants.java)2
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/ChChestItem.java (renamed from src/main/java/de/hype/bbsentials/constants/enviromentShared/ChChestItem.java)2
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/ChChestItems.java (renamed from src/main/java/de/hype/bbsentials/constants/enviromentShared/ChChestItems.java)2
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/EnumUtils.java (renamed from src/main/java/de/hype/bbsentials/constants/enviromentShared/EnumUtils.java)6
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/InternalReasonConstants.java (renamed from src/main/java/de/hype/bbsentials/constants/enviromentShared/InternalReasonConstants.java)2
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/Islands.java (renamed from src/main/java/de/hype/bbsentials/constants/enviromentShared/Islands.java)4
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/MiningEvents.java (renamed from src/main/java/de/hype/bbsentials/constants/enviromentShared/MiningEvents.java)4
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/mclibraries/BBUtils.java21
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/AbstractPacket.java (renamed from src/main/java/de/hype/bbsentials/packets/AbstractPacket.java)12
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/EnviromentPacketConfig.java (renamed from src/main/java/de/hype/bbsentials/packets/EnviromentPacketConfig.java)2
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/Packet.java (renamed from src/main/java/de/hype/bbsentials/packets/Packet.java)2
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/PacketManager.java (renamed from src/main/java/de/hype/bbsentials/packets/PacketManager.java)6
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/PacketUtils.java (renamed from src/main/java/de/hype/bbsentials/packets/PacketUtils.java)10
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/BingoChatMessagePacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/BingoChatMessagePacket.java)4
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/BroadcastMessagePacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/BroadcastMessagePacket.java)4
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/ChChestPacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/ChChestPacket.java)6
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/DisconnectPacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/DisconnectPacket.java)6
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/DisplayTellrawMessagePacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/DisplayTellrawMessagePacket.java)4
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/InternalCommandPacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/InternalCommandPacket.java)4
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/InvalidCommandFeedbackPacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/InvalidCommandFeedbackPacket.java)4
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/MiningEventPacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/MiningEventPacket.java)8
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/PartyPacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/PartyPacket.java)4
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/PunishUserPacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/PunishUserPacket.java)4
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/RequestConnectPacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/RequestConnectPacket.java)4
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/SplashNotifyPacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/SplashNotifyPacket.java)6
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/SplashUpdatePacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/SplashUpdatePacket.java)4
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/SystemMessagePacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/SystemMessagePacket.java)4
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/packets/packets/WelcomeClientPacket.java (renamed from src/main/java/de/hype/bbsentials/packets/packets/WelcomeClientPacket.java)4
-rw-r--r--common/src/main/resources/assets/bbsentials/textures/item/splash_hub.png (renamed from src/main/resources/assets/bbsentials/textures/item/splash_hub.png)bin5537 -> 5537 bytes
-rw-r--r--common/src/main/resources/assets/public_bbsentials_cert.crt (renamed from src/main/resources/assets/public_bbsentials_cert.crt)bin1431 -> 1431 bytes
-rw-r--r--common/src/main/resources/bbsentials.mixins.json16
-rw-r--r--common/src/main/resources/fabric.mod.json (renamed from src/main/resources/fabric.mod.json)6
-rw-r--r--common/src/main/resources/logo.png (renamed from src/main/resources/logo.png)bin2092 -> 2092 bytes
-rw-r--r--common/src/main/resources/sounds/mixkit-gaming-lock-2848.wav (renamed from src/main/resources/sounds/mixkit-gaming-lock-2848.wav)bin201240 -> 201240 bytes
-rw-r--r--common/src/main/resources/sounds/mixkit-interface-option-select-2573.wav (renamed from src/main/resources/sounds/mixkit-interface-option-select-2573.wav)bin274068 -> 274068 bytes
-rw-r--r--common/src/main/resources/sounds/mixkit-long-pop-2358.wav (renamed from src/main/resources/sounds/mixkit-long-pop-2358.wav)bin226002 -> 226002 bytes
-rw-r--r--common/src/main/resources/sounds/mixkit-sci-fi-click-900.wav (renamed from src/main/resources/sounds/mixkit-sci-fi-click-900.wav)bin184244 -> 184244 bytes
-rw-r--r--common/src/main/resources/sounds/mixkit-sci-fi-confirmation-914.wav (renamed from src/main/resources/sounds/mixkit-sci-fi-confirmation-914.wav)bin276320 -> 276320 bytes
-rw-r--r--fabric/build.gradle95
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/BBUtils.java (renamed from src/main/java/de/hype/bbsentials/client/BBUtils.java)20
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/BBsentialsConfigScreemFactory.java (renamed from src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java)165
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/FabricChat.java26
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java55
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/ModInitialiser.java14
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/ModMenueScreen.java (renamed from src/main/java/de/hype/bbsentials/client/ModMenueScreen.java)2
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/Options.java (renamed from src/main/java/de/hype/bbsentials/api/Options.java)3
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/mixins/ClientCommandSourceMixin.java (renamed from src/main/java/de/hype/bbsentials/mixins/ClientCommandSourceMixin.java)2
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/mixins/ItemRendererMixin.java (renamed from src/main/java/de/hype/bbsentials/mixins/ItemRendererMixin.java)4
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/mixins/ScreenMixin.java (renamed from src/main/java/de/hype/bbsentials/mixins/ScreenMixin.java)2
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/mixins/SimpleOptionMixin.java (renamed from src/main/java/de/hype/bbsentials/mixins/SimpleOptionMixin.java)4
-rw-r--r--fabric/src/main/resources/assets/bbsentials/textures/item/splash_hub.pngbin0 -> 5537 bytes
-rw-r--r--fabric/src/main/resources/assets/public_bbsentials_cert.crtbin0 -> 1431 bytes
-rw-r--r--fabric/src/main/resources/bbsentials.mixins.json16
-rw-r--r--fabric/src/main/resources/fabric.mod.json45
-rw-r--r--fabric/src/main/resources/logo.pngbin0 -> 2092 bytes
-rw-r--r--fabric/src/main/resources/sounds/mixkit-gaming-lock-2848.wavbin0 -> 201240 bytes
-rw-r--r--fabric/src/main/resources/sounds/mixkit-interface-option-select-2573.wavbin0 -> 274068 bytes
-rw-r--r--fabric/src/main/resources/sounds/mixkit-long-pop-2358.wavbin0 -> 226002 bytes
-rw-r--r--fabric/src/main/resources/sounds/mixkit-sci-fi-click-900.wavbin0 -> 184244 bytes
-rw-r--r--fabric/src/main/resources/sounds/mixkit-sci-fi-confirmation-914.wavbin0 -> 276320 bytes
-rw-r--r--settings.gradle1
-rw-r--r--src/main/resources/bbsentials.mixins.json16
80 files changed, 656 insertions, 420 deletions
diff --git a/build.gradle b/common/build.gradle
index 49c5e5c..3aaffbf 100644
--- a/build.gradle
+++ b/common/build.gradle
@@ -16,15 +16,12 @@ repositories {
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}
-
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation 'com.terraformersmc:modmenu:8.0.0'
- //https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu/7.2.2/modmenu-7.2.2.pom
- // Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modApi("me.shedaniel.cloth:cloth-config-fabric:12.0.109") {
exclude(group: "net.fabricmc.fabric-api")
@@ -94,4 +91,4 @@ publishing {
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
-}
+} \ No newline at end of file
diff --git a/src/main/java/de/hype/bbsentials/api/Discord.java b/common/src/main/java/de/hype/bbsentials/common/api/Discord.java
index 3f47439..6b2f468 100644
--- a/src/main/java/de/hype/bbsentials/api/Discord.java
+++ b/common/src/main/java/de/hype/bbsentials/common/api/Discord.java
@@ -1,7 +1,7 @@
-package de.hype.bbsentials.api;
+package de.hype.bbsentials.common.api;
-import de.hype.bbsentials.chat.Chat;
-import de.hype.bbsentials.client.BBsentials;
+import de.hype.bbsentials.common.chat.Chat;
+import de.hype.bbsentials.common.client.BBsentials;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
diff --git a/common/src/main/java/de/hype/bbsentials/common/api/Formatting.java b/common/src/main/java/de/hype/bbsentials/common/api/Formatting.java
new file mode 100644
index 0000000..c8702d4
--- /dev/null
+++ b/common/src/main/java/de/hype/bbsentials/common/api/Formatting.java
@@ -0,0 +1,36 @@
+package de.hype.bbsentials.common.api;
+
+public enum Formatting{
+ BLACK("§0"),
+ DARK_BLUE("§1"),
+ DARK_GREEN("§2"),
+ DARK_AQUA("§3"),
+ DARK_RED("§4"),
+ DARK_PURPLE("§5"),
+ GOLD("§6"),
+ GRAY("§7"),
+ DARK_GRAY("§8"),
+ BLUE("§9"),
+ GREEN("§a"),
+ AQUA("§b"),
+ RED("§c"),
+ LIGHT_PURPLE("§d"),
+ YELLOW("§e"),
+ BOLD("§l"),
+ ITALIC("§o"),
+ UNDERLINE("§n"),
+ STRIKETHROUGH("§m"),
+ RESET("§r"),
+ WHITE("§f");
+
+ private final String code;
+
+ Formatting(String code) {
+ this.code = code;
+ }
+
+ @Override
+ public String toString() {
+ return code;
+ }
+}
diff --git a/src/main/java/de/hype/bbsentials/api/ISimpleOption.java b/common/src/main/java/de/hype/bbsentials/common/api/ISimpleOption.java
index c6e1158..28808d9 100644
--- a/src/main/java/de/hype/bbsentials/api/ISimpleOption.java
+++ b/common/src/main/java/de/hype/bbsentials/common/api/ISimpleOption.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.api;
+package de.hype.bbsentials.common.api;
public interface ISimpleOption {
void set(Object value);
diff --git a/src/main/java/de/hype/bbsentials/chat/Chat.java b/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java
index ac5f892..1d7aef1 100644
--- a/src/main/java/de/hype/bbsentials/chat/Chat.java
+++ b/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java
@@ -1,13 +1,10 @@
-package de.hype.bbsentials.chat;
-
-import de.hype.bbsentials.client.BBsentials;
-import de.hype.bbsentials.client.Config;
-import de.hype.bbsentials.packets.packets.SplashUpdatePacket;
-import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents;
-import net.fabricmc.fabric.api.client.message.v1.ClientSendMessageEvents;
-import net.minecraft.client.MinecraftClient;
+package de.hype.bbsentials.common.chat;
+
+import de.hype.bbsentials.common.api.Formatting;
+import de.hype.bbsentials.common.client.BBsentials;
+import de.hype.bbsentials.common.client.Config;
+import de.hype.bbsentials.common.packets.packets.SplashUpdatePacket;
import net.minecraft.text.Text;
-import net.minecraft.util.Formatting;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
@@ -25,12 +22,9 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import static de.hype.bbsentials.client.BBsentials.*;
+import static de.hype.bbsentials.common.client.BBsentials.*;
public class Chat {
- public Chat() {
- init();
- }
public static String[] getVariableInfo(String packageName, String className) {
List<String> variableInfoList = new ArrayList<>();
@@ -123,25 +117,12 @@ public class Chat {
sendPrivateMessageToSelfSuccess("The variable " + field.getName() + " is: " + field.get(object));
}
- private void init() {
- // Register a callback for a custom message type
- ClientReceiveMessageEvents.CHAT.register((message, signedMessage, sender, params, receptionTimestamp) -> {
- onEvent(message);
- });
- ClientReceiveMessageEvents.MODIFY_GAME.register((message, overlay) -> (onEvent(message)));
- ClientSendMessageEvents.CHAT.register(message -> {
- if (message.startsWith("/")) {
- System.out.println("Sent command: " + message);
- }
- });
- }
-
- private Text onEvent(Text text) {
+ public Message onEvent(Message text) {
if (!isSpam(text.toString())) {
if (getConfig().isDetailedDevModeEnabled()) {
- System.out.println("got a message: " + Text.Serializer.toJson(text));
+ System.out.println("got a message: " + text.getJson());
}
- Message message = new Message(text);
+ Message message = new Message(text.toString(),text.getString());
executionService.execute(() -> processThreaded(message));
return processNotThreaded(message);
}
@@ -149,7 +130,7 @@ public class Chat {
}
//Handle in the messages which need to be modified here
- public Text processNotThreaded(Message message) {
+ public Message processNotThreaded(Message message) {
// if (message.isFromParty()) {
// message.replaceInJson("\"action\":\"run_command\",\"value\":\"/viewprofile", "\"action\":\"run_command\",\"value\":\"/bviewprofile " + messageUnformatted.split(">", 1)[1].trim());
// }
@@ -168,7 +149,7 @@ public class Chat {
message.replaceInJson("/socialoptions " + message.getPlayerName(), "/socialoptions sb " + message.getPlayerName() + " " + message.getUnformattedString());
}
- return message.text;
+ return message;
}
public void processThreaded(Message message) {
@@ -178,9 +159,9 @@ public class Chat {
if (message.isFromReportedUser()) {
}
- else if (!MinecraftClient.getInstance().isWindowFocused()) {
+ else if (!MCUtils.isWindowFocused()) {
if (config.doDesktopNotifications) {
- if ((messageUnformatted.endsWith("is visiting Your Garden !") || messageUnformatted.endsWith("is visiting Your Island !")) && !MinecraftClient.getInstance().isWindowFocused() && config.doDesktopNotifications) {
+ if ((messageUnformatted.endsWith("is visiting Your Garden !") || messageUnformatted.endsWith("is visiting Your Island !")) && !MCUtils.isWindowFocused() && config.doDesktopNotifications) {
sendNotification("BBsentials Visit-Watcher", messageUnformatted);
}
else if (message.isMsg()) {
@@ -210,7 +191,7 @@ public class Chat {
}
}
}
- if (!MinecraftClient.getInstance().isWindowFocused()) {
+ if (!MCUtils.isWindowFocused()) {
sendNotification("BBsentials Party Notifier", "You got invited too a party by: " + username);
}
}
@@ -288,7 +269,7 @@ public class Chat {
}
else {
if (message.contains("[OPEN MENU]") || message.contains("[YES]")) {
- setChatPromtId(message.getText().toString());
+ setChatPromtId(message.getJson());
}
}
}
@@ -338,17 +319,11 @@ public class Chat {
}
private static void sendPrivateMessageToSelfBase(String message) {
- MinecraftClient client = MinecraftClient.getInstance();
- if (client.player != null) {
- client.player.sendMessage(Text.of(Formatting.RED + message));
- }
+ MCUtils.sendClientSideMessage(Message.of(message));
}
- public static void sendPrivateMessageToSelfText(Text message) {
- MinecraftClient client = MinecraftClient.getInstance();
- if (client.player != null) {
- client.player.sendMessage(message);
- }
+ public static void sendPrivateMessageToSelfText(Message message) {
+ MCUtils.sendClientSideMessage(message);
}
public static void sendCommand(String s) {
diff --git a/src/main/java/de/hype/bbsentials/chat/Message.java b/common/src/main/java/de/hype/bbsentials/common/chat/Message.java
index 42d1b2e..506146f 100644
--- a/src/main/java/de/hype/bbsentials/chat/Message.java
+++ b/common/src/main/java/de/hype/bbsentials/common/chat/Message.java
@@ -1,28 +1,32 @@
-package de.hype.bbsentials.chat;
+package de.hype.bbsentials.common.chat;
-import de.hype.bbsentials.client.BBsentials;
-import net.minecraft.text.Text;
+import de.hype.bbsentials.common.client.BBsentials;
public class Message {
- public Text text;
+ private String text;
private String unformattedString = null;
private String playerName = null;
+ private String string;
- public Message(Text text) {
+ public Message(String textJson,String string) {
this.text = text;
+ this.string=string;
}
-
- public Text getText() {
+ public static Message of(String string){
+ return new Message("{\"text\":\""+string+"\"}",string);
+ }
+ //
+ public String getJson() {
return text;
}
public String getString() {
- return text.getString();
+ return string;
}
public String getUnformattedString() {
if (unformattedString != null) return unformattedString;
- unformattedString = text.getString().replaceAll("§.", "").trim();
+ unformattedString = string.replaceAll("§.", "").trim();
return unformattedString;
}
@@ -85,19 +89,8 @@ public class Message {
}
public void replaceInJson(String replace, String replaceWith) {
- String textString = toJson();
- textString = textString.replaceFirst(replace, replaceWith);
- text = Text.Serializer.fromJson(textString);
- }
-
- public static Message fromJson(String json) {
- return new Message(Text.Serializer.fromJson(json));
+ text = text.replaceFirst(replace, replaceWith);
}
-
- public String toJson() {
- return Text.Serializer.toJson(text);
- }
-
public boolean isFromReportedUser() {
return BBsentials.config.alreadyReported.contains(getPlayerName()) && !getPlayerName().isEmpty();
}
diff --git a/src/main/java/de/hype/bbsentials/chat/Sender.java b/common/src/main/java/de/hype/bbsentials/common/chat/Sender.java
index eef2469..3dfb13c 100644
--- a/src/main/java/de/hype/bbsentials/chat/Sender.java
+++ b/common/src/main/java/de/hype/bbsentials/common/chat/Sender.java
@@ -1,14 +1,12 @@
-package de.hype.bbsentials.chat;
+package de.hype.bbsentials.common.chat;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.text.Text;
-import net.minecraft.util.Formatting;
+import de.hype.bbsentials.common.api.Formatting;
import java.util.ArrayList;
import java.util.List;
-import static de.hype.bbsentials.chat.Chat.sendPrivateMessageToSelfInfo;
-import static de.hype.bbsentials.chat.Chat.sendPrivateMessageToSelfText;
+import static de.hype.bbsentials.common.chat.Chat.sendPrivateMessageToSelfInfo;
+import static de.hype.bbsentials.common.chat.Chat.sendPrivateMessageToSelfText;
public class Sender {
private final List<String> sendQueue;
@@ -25,7 +23,7 @@ public class Sender {
public void addSendTask(String task, double timing) {
synchronized (sendQueue) {
- sendPrivateMessageToSelfText(Text.literal(Formatting.GREEN + "Scheduled send-task (as " + sendQueueTiming.size() + " in line): " + task + " | Delay: " + timing));
+ sendPrivateMessageToSelfText(Message.of(Formatting.GREEN + "Scheduled send-task (as " + sendQueueTiming.size() + " in line): " + task + " | Delay: " + timing));
sendQueueTiming.add(timing);
sendQueue.add(task);
hidden.add(false);
@@ -97,7 +95,7 @@ public class Sender {
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
- MinecraftClient.getInstance().getNetworkHandler().sendChatMessage(toSend);
+ MC.sendChatMessage(toSend);
if (!hidden) {
sendPrivateMessageToSelfInfo("Sent Command to Server: " + toSend);
}
diff --git a/src/main/java/de/hype/bbsentials/client/BBsentials.java b/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java
index fe51139..0d5535f 100644
--- a/src/main/java/de/hype/bbsentials/client/BBsentials.java
+++ b/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java
@@ -1,20 +1,11 @@
-package de.hype.bbsentials.client;
+package de.hype.bbsentials.common.client;
import com.mojang.brigadier.arguments.StringArgumentType;
-import de.hype.bbsentials.api.Options;
-import de.hype.bbsentials.chat.Chat;
-import de.hype.bbsentials.client.Commands.CommandsOLD;
-import de.hype.bbsentials.communication.BBsentialConnection;
-import net.fabricmc.api.ClientModInitializer;
-import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
-import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
-import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
-import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
-import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.option.KeyBinding;
-import net.minecraft.client.util.InputUtil;
-import net.minecraft.command.CommandSource;
+import de.hype.bbsentials.common.chat.Chat;
+import de.hype.bbsentials.common.client.Commands.CommandsOLD;
+import de.hype.bbsentials.common.communication.BBsentialConnection;
+import de.hype.bbsentials.fabric.BBsentialsConfigScreemFactory;
+import de.hype.bbsentials.fabric.Options;
import org.lwjgl.glfw.GLFW;
import java.lang.reflect.InvocationTargetException;
@@ -24,16 +15,14 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import static de.hype.bbsentials.chat.Chat.*;
-
-public class BBsentials implements ClientModInitializer {
+public class BBsentials {
public static Config config;
public static BBsentialConnection connection;
public static CommandsOLD coms;
public static ScheduledExecutorService executionService = Executors.newScheduledThreadPool(1000);
public static boolean splashLobby;
private static Thread bbthread;
- private boolean initialised = false;
+ private static boolean initialised = false;
public static SplashStatusUpdateListener splashStatusUpdateListener;
public static Config getConfig() {
@@ -86,9 +75,7 @@ public class BBsentials implements ClientModInitializer {
* Runs the mod initializer on the client environment.
*/
- @Override
- public void onInitializeClient() {
- ClientPlayConnectionEvents.JOIN.register((a, b, c) -> {
+ public static void onServerSwap() {
splashLobby = false;
if (!initialised) {
config = Config.load();
@@ -99,7 +86,6 @@ public class BBsentials implements ClientModInitializer {
}
initialised = true;
}
- });
}
{
@@ -130,7 +116,7 @@ public class BBsentials implements ClientModInitializer {
switch (category) {
case "save":
getConfig().save();
- sendPrivateMessageToSelfSuccess("Saved config successfully");
+ Chat.sendPrivateMessageToSelfSuccess("Saved config successfully");
break;
case "load":
BBsentials.config = Config.load();
@@ -154,7 +140,7 @@ public class BBsentials implements ClientModInitializer {
.suggests((context, builder) -> {
// Provide tab-completion options for variable names
List<String> variableNames;
- variableNames = List.of(getVariableInfo("de.hype.bbsentials.client", "Config"));
+ variableNames = List.of(Chat.getVariableInfo("de.hype.bbsentials.client", "Config"));
return CommandSource.suggestMatching(variableNames, builder);
})
.then(ClientCommandManager.argument("variableValue", StringArgumentType.string())
@@ -164,7 +150,7 @@ public class BBsentials implements ClientModInitializer {
String variableValue = StringArgumentType.getString(context, "variableValue");
try {
if (!variableName.toLowerCase().contains("dev") || config.hasBBRoles("dev")) {
- setVariableValue(getConfig(), variableName, variableValue);
+ Chat.setVariableValue(getConfig(), variableName, variableValue);
}
getConfig().save();
} catch (ClassNotFoundException |
@@ -190,7 +176,7 @@ public class BBsentials implements ClientModInitializer {
.suggests((context, builder) -> {
// Provide tab-completion options for variable names
List<String> variableNames;
- variableNames = List.of(getVariableInfo("de.hype.bbsentials.client", "Config"));
+ variableNames = List.of(Chat.getVariableInfo("de.hype.bbsentials.client", "Config"));
return CommandSource.suggestMatching(variableNames, builder);
})
.executes((context) -> {
diff --git a/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java b/common/src/main/java/de/hype/bbsentials/common/client/Commands/CommandsOLD.java
index d42dc8d..92e801c 100644
--- a/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java
+++ b/common/src/main/java/de/hype/bbsentials/common/client/Commands/CommandsOLD.java
@@ -1,15 +1,15 @@
-package de.hype.bbsentials.client.Commands;
+package de.hype.bbsentials.common.client.Commands;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.StringArgumentType;
-import de.hype.bbsentials.chat.Chat;
-import de.hype.bbsentials.client.BBUtils;
-import de.hype.bbsentials.client.BBsentials;
-import de.hype.bbsentials.constants.enviromentShared.ChChestItems;
-import de.hype.bbsentials.constants.enviromentShared.MiningEvents;
-import de.hype.bbsentials.packets.AbstractPacket;
-import de.hype.bbsentials.packets.packets.*;
+import de.hype.bbsentials.common.chat.Chat;
+import de.hype.bbsentials.common.client.BBsentials;
+import de.hype.bbsentials.common.constants.enviromentShared.ChChestItems;
+import de.hype.bbsentials.common.constants.enviromentShared.MiningEvents;
+import de.hype.bbsentials.common.packets.AbstractPacket;
+import de.hype.bbsentials.common.packets.packets.*;
+import de.hype.bbsentials.fabric.BBUtils;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
@@ -20,8 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
-import static de.hype.bbsentials.client.BBsentials.*;
-
public class CommandsOLD {
public CommandsOLD() {
Event<ClientCommandRegistrationCallback> event = ClientCommandRegistrationCallback.EVENT;
@@ -30,8 +28,8 @@ public class CommandsOLD {
.then(ClientCommandManager.argument("Player_Name", StringArgumentType.string())
.executes((context) -> {
String playerName = StringArgumentType.getString(context, "Player_Name");
- getConfig().sender.addSendTask("/creport " + playerName, 0);
- getConfig().addReported(playerName);
+ BBsentials.getConfig().sender.addSendTask("/creport " + playerName, 0);
+ BBsentials.getConfig().addReported(playerName);
return 1;
})));
});//creport helper → no double report during same launch
@@ -52,7 +50,7 @@ public class CommandsOLD {
//{"jformat":8,"jobject":[{"bold":false,"italic":false,"underlined":true,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the username"}],"text":"$username"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gold","insertion":"","click_event_type":"run_command","click_event_value":"/p invite $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to party player"}],"text":"[Party]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":"run_command","click_event_value":"/socialoptions sb $username $message","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to open the SB options"}],"text":"[SB Options]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_aqua","insertion":"","click_event_type":"run_command","click_event_value":"/g member $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Show guild info about the user."}],"text":"[Member info]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gray","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$messagecontent","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the message content"}],"text":"[Copy content]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$message","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the exact message"}],"text":"[Copy message]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_purple","insertion":"","click_event_type":"suggest_command","click_event_value":"/msg $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to msg the user"}],"text":"[Msg]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"suggest_command","click_event_value":"/ignore add $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to ignore add the user"}],"text":"[Ignore add]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"\n"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_red","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"G Admin: "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_purple","insertion":"","click_event_type":"suggest_command","click_event_value":"/g kick $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"suggest the command to kick the user"}],"text":"[kick]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"suggest_command","click_event_value":"/g mute $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Suggest a mute command for the user."}],"text":"[mute]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_green","insertion":"","click_event_type":"suggest_command","click_event_value":"/g promote $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to promote the user"}],"text":"[promote]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"suggest_command","click_event_value":"/g demote $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to demote the user"}],"text":"[demote]"}],"command":"%s","jtemplate":"tellraw"}
}
else if (parameters[0].equals("party")) {
- if (config.isLeader()) {
+ if (BBsentials.config.isLeader()) {
tellrawjson = "[\"\",{\"text\":\"\n\n$username\",\"underlined\":true,\"color\":\"blue\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[{\"text\":\"Click to copy the username\",\"color\":\"blue\"}]}},\" \",{\"text\":\"[Party]\",\"color\":\"gold\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/p invite $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to party player\"]}},\" \",{\"text\":\"[SB Options]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/socialoptions sb $username $message\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to open the SB options\"]}},\" \",{\"text\":\"[Copy content]\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$messagecontent\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to copy the message content\"]}},\" \",{\"text\":\"[Copy message]\",\"color\":\"blue\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$message\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to copy the exact message\"]}},\" \",{\"text\":\"[Msg]\",\"color\":\"dark_purple\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/msg $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to msg the user\"]}},\" \",{\"text\":\"[Ignore add]\",\"color\":\"red\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/ignore add $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to ignore add the user\"]}},\"\\n\",\"\\n\",{\"text\":\"P Leader: \",\"color\":\"dark_red\"},{\"text\":\"[kick]\",\"color\":\"dark_purple\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/p kick $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"suggest the command to kick the user\"]}},\" \",{\"text\":\"[transfer]\",\"color\":\"dark_red\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/p transfer $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Suggest a mute command for the user.\"]}},\" \",{\"text\":\"[promote]\",\"color\":\"dark_green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/p promote $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to promote the user\"]}},\" \",{\"text\":\"[demote]\",\"color\":\"red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/p demote $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to demote the user\"]}}]";
//{"jformat":8,"jobject":[{"bold":false,"italic":false,"underlined":true,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the username"}],"text":"$username"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gold","insertion":"","click_event_type":"run_command","click_event_value":"/p invite $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to party player"}],"text":"[Party]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":"run_command","click_event_value":"/socialoptions sb $username $message","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to open the SB options"}],"text":"[SB Options]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gray","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$messagecontent","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the message content"}],"text":"[Copy content]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$message","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the exact message"}],"text":"[Copy message]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_purple","insertion":"","click_event_type":"suggest_command","click_event_value":"/msg $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to msg the user"}],"text":"[Msg]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"suggest_command","click_event_value":"/ignore add $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to ignore add the user"}],"text":"[Ignore add]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"\n"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"\n"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_red","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"P Leader: "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_purple","insertion":"","click_event_type":"run_command","click_event_value":"/p kick $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"suggest the command to kick the user"}],"text":"[kick]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_red","insertion":"","click_event_type":"suggest_command","click_event_value":"/p transfer $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Suggest a mute command for the user."}],"text":"[transfer]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_green","insertion":"","click_event_type":"run_command","click_event_value":"/p promote $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to promote the user"}],"text":"[promote]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"run_command","click_event_value":"/p demote $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to demote the user"}],"text":"[demote]"}],"command":"%s","jtemplate":"tellraw"}
}
@@ -117,7 +115,7 @@ public class CommandsOLD {
.then(ClientCommandManager.argument("Z", IntegerArgumentType.integer())
.then(ClientCommandManager.argument("ContactWay", StringArgumentType.string())
.suggests(((context, builder) -> {
- return CommandSource.suggestMatching(new String[]{"\"/msg " + getConfig().getUsername() + " bb:party me\"", "\"/p join " + config.getUsername() + "\""}, builder);
+ return CommandSource.suggestMatching(new String[]{"\"/msg " + BBsentials.getConfig().getUsername() + " bb:party me\"", "\"/p join " + BBsentials.config.getUsername() + "\""}, builder);
}))
.executes((context) -> {
String item = StringArgumentType.getString(context, "Item");
@@ -126,7 +124,7 @@ public class CommandsOLD {
int z = IntegerArgumentType.getInteger(context, "Z");
String contactWay = StringArgumentType.getString(context, "ContactWay");
- connection.sendPacket(new ChChestPacket("", ChChestItems.getItem(item.split(";")), x + " " + y + " " + z, contactWay, ""));
+ BBsentials.connection.sendPacket(new ChChestPacket("", ChChestItems.getItem(item.split(";")), x + " " + y + " " + z, contactWay, ""));
return 1;
}
)
@@ -161,8 +159,8 @@ public class CommandsOLD {
)
);
});/*BingoChatLong*/
- if (getConfig().bbsentialsRoles != null) {
- if (getConfig().hasBBRoles("mod")) {
+ if (BBsentials.getConfig().bbsentialsRoles != null) {
+ if (BBsentials.getConfig().hasBBRoles("mod")) {
event.register((dispatcher, registryAccess) -> {
dispatcher.register(
ClientCommandManager.literal("bannounce")
@@ -237,7 +235,7 @@ public class CommandsOLD {
);
});/*getInfo*/
}
- if (getConfig().hasBBRoles("splasher")) {
+ if (BBsentials.getConfig().hasBBRoles("splasher")) {
event.register((dispatcher, registryAccess) -> {
dispatcher.register(
ClientCommandManager.literal("splashAnnounce")
@@ -288,7 +286,7 @@ public class CommandsOLD {
);
});/*requestpottimes*/
}
- if (getConfig().hasBBRoles("admin")) {
+ if (BBsentials.getConfig().hasBBRoles("admin")) {
event.register((dispatcher, registryAccess) -> {
dispatcher.register(
ClientCommandManager.literal("bshutdown")
@@ -341,7 +339,7 @@ public class CommandsOLD {
.executes((context) -> {
try {
BBsentials.connection.sendPacket(new MiningEventPacket(event,
- config.getUsername(), Objects.requireNonNull(BBUtils.getCurrentIsland())));
+ BBsentials.config.getUsername(), Objects.requireNonNull(BBUtils.getCurrentIsland())));
} catch (Exception e) {
Chat.sendPrivateMessageToSelfError(e.getMessage());
}
@@ -351,7 +349,7 @@ 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));
+ sendPacket(new SplashNotifyPacket(0, hubNumber, BBsentials.config.getUsername(), locationInHub, BBUtils.getCurrentIsland(), extramessage, lessWaste));
}
diff --git a/src/main/java/de/hype/bbsentials/client/Config.java b/common/src/main/java/de/hype/bbsentials/common/client/Config.java
index 4573b5f..f012c0c 100644
--- a/src/main/java/de/hype/bbsentials/client/Config.java
+++ b/common/src/main/java/de/hype/bbsentials/common/client/Config.java
@@ -1,10 +1,9 @@
-package de.hype.bbsentials.client;
+package de.hype.bbsentials.common.client;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import de.hype.bbsentials.chat.Sender;
-import net.fabricmc.loader.api.FabricLoader;
-import net.minecraft.client.MinecraftClient;
+import de.hype.bbsentials.common.chat.Sender;
+import de.hype.bbsentials.fabric.MCUtils;
import java.io.*;
import java.time.LocalDate;
@@ -15,8 +14,8 @@ public class Config implements Serializable {
//DO NOT Change any of the following unless you know what you are doing!
public int apiVersion = 1;
public boolean allowServerPartyInvite = true;
- boolean devMode = false;
- boolean detailedDevMode = false;
+ public boolean devMode = false;
+ public boolean detailedDevMode = false;
//You can change again
// set automatically
@@ -35,7 +34,7 @@ public class Config implements Serializable {
public boolean connectToBeta = false;
public String bbServerURL = "localhost";
- String apiKey = "";
+ public String apiKey = "";
public boolean showBingoChat = true;
public boolean doAllChatCustomMenu=true;
public boolean doPartyChatCustomMenu=true;
@@ -52,7 +51,7 @@ public class Config implements Serializable {
// Set default attribute values
private void setDefaults() {
- username = MinecraftClient.getInstance().player.getName().getString();
+ username = MCUtils.getUsername();
acceptReparty = true;
if (username.equals("Hype_the_Time")) {
nickname = "Hype";
@@ -68,7 +67,7 @@ public class Config implements Serializable {
// Gson object for serialization
private final transient Gson GSON = new GsonBuilder().setPrettyPrinting().create();
// File object for storing the config
- private final transient File CONFIG_FILE = new File(FabricLoader.getInstance().getConfigDir().toFile(), "BBsential_settings.json");
+ private final transient File CONFIG_FILE = new File(MCUtils.getConfigPath(), "BBsential_settings.json");
// Constructor
public Config() {
@@ -78,7 +77,7 @@ public class Config implements Serializable {
// Load the config from file
public static Config load() {
Config settings;
- File CONFIG_FILE = new File(FabricLoader.getInstance().getConfigDir().toFile(), "BBsential_settings.json");
+ File CONFIG_FILE = new File(MCUtils.getConfigPath(), "BBsential_settings.json");
Gson GSON = new GsonBuilder().setPrettyPrinting().create();
if (CONFIG_FILE.exists()) {
try (FileReader reader = new FileReader(CONFIG_FILE)) {
@@ -95,7 +94,7 @@ public class Config implements Serializable {
}
else {
settings = new Config(); // Use default values if the file doesn't exist
- settings.username = MinecraftClient.getInstance().player.getName().getString();
+ settings.username = MCUtils.getUsername();
}
if (!settings.hasBBRoles("dev")) {
settings.detailedDevMode = false;
@@ -200,6 +199,6 @@ public class Config implements Serializable {
}
public String getMCUUID() {
- return MinecraftClient.getInstance().player.getUuid().toString().replace("-", "");
+ return MCUtils.getMCUUID().replace("-", "");
}
}
diff --git a/src/main/java/de/hype/bbsentials/client/CustomGson.java b/common/src/main/java/de/hype/bbsentials/common/client/CustomGson.java
index e9a41da..31f2626 100644
--- a/src/main/java/de/hype/bbsentials/client/CustomGson.java
+++ b/common/src/main/java/de/hype/bbsentials/common/client/CustomGson.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.client;
+package de.hype.bbsentials.common.client;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
diff --git a/src/main/java/de/hype/bbsentials/client/DebugThread.java b/common/src/main/java/de/hype/bbsentials/common/client/DebugThread.java
index 3c853c2..18ef94d 100644
--- a/src/main/java/de/hype/bbsentials/client/DebugThread.java
+++ b/common/src/main/java/de/hype/bbsentials/common/client/DebugThread.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.client;
+package de.hype.bbsentials.common.client;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.PlayerListEntry;
diff --git a/src/main/java/de/hype/bbsentials/client/SplashManager.java b/common/src/main/java/de/hype/bbsentials/common/client/SplashManager.java
index aafec8e..5d7d464 100644
--- a/src/main/java/de/hype/bbsentials/client/SplashManager.java
+++ b/common/src/main/java/de/hype/bbsentials/common/client/SplashManager.java
@@ -1,9 +1,9 @@
-package de.hype.bbsentials.client;
+package de.hype.bbsentials.common.client;
-import de.hype.bbsentials.chat.Chat;
-import de.hype.bbsentials.constants.enviromentShared.Islands;
-import de.hype.bbsentials.packets.packets.SplashNotifyPacket;
-import de.hype.bbsentials.packets.packets.SplashUpdatePacket;
+import de.hype.bbsentials.common.chat.Chat;
+import de.hype.bbsentials.common.constants.enviromentShared.Islands;
+import de.hype.bbsentials.common.packets.packets.SplashNotifyPacket;
+import de.hype.bbsentials.common.packets.packets.SplashUpdatePacket;
import java.util.HashMap;
import java.util.Map;
diff --git a/src/main/java/de/hype/bbsentials/client/SplashStatusUpdateListener.java b/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java
index 95caab8..a250534 100644
--- a/src/main/java/de/hype/bbsentials/client/SplashStatusUpdateListener.java
+++ b/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java
@@ -1,14 +1,11 @@
-package de.hype.bbsentials.client;
+package de.hype.bbsentials.common.client;
-import de.hype.bbsentials.communication.BBsentialConnection;
-import de.hype.bbsentials.packets.packets.SplashNotifyPacket;
-import de.hype.bbsentials.packets.packets.SplashUpdatePacket;
+import de.hype.bbsentials.common.communication.BBsentialConnection;
+import de.hype.bbsentials.common.packets.packets.SplashNotifyPacket;
+import de.hype.bbsentials.common.packets.packets.SplashUpdatePacket;
import java.util.concurrent.TimeUnit;
-import static de.hype.bbsentials.client.BBsentials.executionService;
-import static de.hype.bbsentials.client.BBsentials.splashLobby;
-
public class SplashStatusUpdateListener implements Runnable {
BBsentialConnection connection;
SplashNotifyPacket packet;
@@ -56,9 +53,9 @@ public class SplashStatusUpdateListener implements Runnable {
this.newStatus = newStatus;
if (newStatus.equals(SplashUpdatePacket.STATUS_SPLASHING)) {
splashed=true;
- executionService.schedule(() -> {
+ BBsentials.executionService.schedule(() -> {
setStatus(SplashUpdatePacket.STATUS_DONE);
- splashLobby = false;
+ BBsentials.splashLobby = false;
}, 1, TimeUnit.MINUTES);
}
}
diff --git a/src/main/java/de/hype/bbsentials/client/ToDisplayConfig.java b/common/src/main/java/de/hype/bbsentials/common/client/ToDisplayConfig.java
index 4a048ab..0a046d9 100644
--- a/src/main/java/de/hype/bbsentials/client/ToDisplayConfig.java
+++ b/common/src/main/java/de/hype/bbsentials/common/client/ToDisplayConfig.java
@@ -1,8 +1,8 @@
-package de.hype.bbsentials.client;
+package de.hype.bbsentials.common.client;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import net.fabricmc.loader.api.FabricLoader;
+import de.hype.bbsentials.fabric.MCUtils;
import java.io.File;
import java.io.FileReader;
@@ -40,7 +40,7 @@ public class ToDisplayConfig {
// Serialize the object to JSON and save to file
public void saveToFile() {
- File configFile = new File(FabricLoader.getInstance().getConfigDirectory(), "BBsentials_display_Config.json");
+ File configFile = new File(MCUtils.getConfigPath(), "BBsentials_display_Config.json");
Gson gson = new GsonBuilder().setPrettyPrinting().create();
try (FileWriter writer = new FileWriter(configFile)) {
@@ -52,7 +52,7 @@ public class ToDisplayConfig {
// Deserialize the object from JSON file
public static ToDisplayConfig loadFromFile() {
- File configFile = new File(FabricLoader.getInstance().getConfigDirectory(), "BBsentials_display_Config.json");
+ File configFile = new File(MCUtils.getConfigPath(), "BBsentials_display_Config.json");
Gson gson = new Gson();
try (FileReader reader = new FileReader(configFile)) {
diff --git a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java b/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java
index 49353be..e7aa3a4 100644
--- a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
+++ b/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java
@@ -1,20 +1,17 @@
-package de.hype.bbsentials.communication;
-
-import de.hype.bbsentials.chat.Chat;
-import de.hype.bbsentials.client.BBsentials;
-import de.hype.bbsentials.client.SplashManager;
-import de.hype.bbsentials.client.SplashStatusUpdateListener;
-import de.hype.bbsentials.constants.enviromentShared.*;
-import de.hype.bbsentials.packets.AbstractPacket;
-import de.hype.bbsentials.packets.PacketManager;
-import de.hype.bbsentials.packets.PacketUtils;
-import de.hype.bbsentials.packets.packets.*;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.sound.PositionedSoundInstance;
-import net.minecraft.entity.effect.StatusEffectInstance;
-import net.minecraft.entity.effect.StatusEffects;
-import net.minecraft.sound.SoundEvent;
-import net.minecraft.sound.SoundEvents;
+package de.hype.bbsentials.common.communication;
+
+import de.hype.bbsentials.common.chat.Message;
+import de.hype.bbsentials.common.client.BBsentials;
+import de.hype.bbsentials.common.client.SplashManager;
+import de.hype.bbsentials.common.client.SplashStatusUpdateListener;
+import de.hype.bbsentials.common.constants.enviromentShared.ChChestItem;
+import de.hype.bbsentials.common.constants.enviromentShared.ChChestItems;
+import de.hype.bbsentials.common.constants.enviromentShared.Islands;
+import de.hype.bbsentials.common.constants.enviromentShared.MiningEvents;
+import de.hype.bbsentials.common.packets.AbstractPacket;
+import de.hype.bbsentials.common.packets.PacketManager;
+import de.hype.bbsentials.common.packets.PacketUtils;
+import de.hype.bbsentials.common.packets.packets.*;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
@@ -34,9 +31,6 @@ import java.util.Arrays;
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;
private BufferedReader reader;
@@ -50,16 +44,7 @@ public class BBsentialConnection {
packetManager = new PacketManager(this);
}
- public static int getPotTime() {
- int remainingDuration = 0;
- StatusEffectInstance potTimeRequest = MinecraftClient.getInstance().player.getStatusEffect(StatusEffects.STRENGTH);
- if (potTimeRequest != null) {
- if (potTimeRequest.getAmplifier() >= 7) {
- remainingDuration = (int) (potTimeRequest.getDuration() / 20.0);
- }
- }
- return remainingDuration;
- }
+
public static boolean isCommandSafe(String command) {
if (command.startsWith("/p ") || command.startsWith("/party ") || command.startsWith("/boop ") || command.startsWith("/msg ") || command.startsWith("/hub ")) {
@@ -80,10 +65,7 @@ public class BBsentialConnection {
return false;
}
- public static void playsound(SoundEvent event) {
- MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance
- .master(event, 1.0F, 1.0F));
- }
+
public void connect(String serverIP, int serverPort) {
// Enable SSL handshake debugging
@@ -259,7 +241,7 @@ public class BBsentialConnection {
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
- sendPacket(new RequestConnectPacket(config.getMCUUID(), BBsentials.getConfig().getApiKey(), BBsentials.getConfig().getApiVersion(), AuthenticationConstants.DATABASE));
+ sendPacket(new RequestConnectPacket(BBsentials.config.getMCUUID(), BBsentials.getConfig().getApiKey(), BBsentials.getConfig().getApiVersion(), AuthenticationConstants.DATABASE));
}
}
else {
@@ -274,9 +256,9 @@ public class BBsentialConnection {
public void splashHighlightItem(String itemName, long displayTimeInMilliseconds) {
this.itemName = itemName;
- config.highlightitem = true;
+ BBsentials.config.highlightitem = true;
BBsentials.executionService.schedule(() -> {
- config.highlightitem = false;
+ BBsentials.config.highlightitem = false;
try {
socket.setSoTimeout(0);
} catch (SocketException e) {
@@ -314,11 +296,11 @@ public class BBsentialConnection {
public void onSplashNotifyPacket(SplashNotifyPacket packet) {
int waitTime;
- if (packet.splasherUsername.equals(config.getUsername())&&config.autoSplashStatusUpdates) {
+ if (packet.splasherUsername.equals(BBsentials.config.getUsername())&& BBsentials.config.autoSplashStatusUpdates) {
Chat.sendPrivateMessageToSelfInfo("The Splash Update Statuses will be updatet automatically for you. If you need to do something manually go into Discord Splash Dashboard");
SplashStatusUpdateListener splashStatusUpdateListener = new SplashStatusUpdateListener(this, packet);
BBsentials.splashStatusUpdateListener = splashStatusUpdateListener;
- executionService.execute(splashStatusUpdateListener);
+ BBsentials.executionService.execute(splashStatusUpdateListener);
}
else {
SplashManager.addSplash(packet);
@@ -335,7 +317,7 @@ public class BBsentialConnection {
}
public void onBingoChatMessagePacket(BingoChatMessagePacket packet) {
- if (config.showBingoChat) {
+ if (BBsentials.config.showBingoChat) {
Chat.sendPrivateMessageToSelfInfo("[" + packet.prefix + "] " + packet.username + ": " + packet.message);
}
}
@@ -348,7 +330,7 @@ public class BBsentialConnection {
if (!(packet.extraMessage == null || packet.extraMessage.isEmpty())) {
tellrawText = tellrawText.replace("@extramessage", " : " + packet.extraMessage);
}
- Chat.sendPrivateMessageToSelfText(Chat.createClientSideTellraw(tellrawText));
+ Chat.sendPrivateMessageToSelfText(new Message(tellrawText,""));
}
}
else {
@@ -358,38 +340,38 @@ public class BBsentialConnection {
}
public void onMiningEventPacket(MiningEventPacket packet) {
- if (!config.toDisplayConfig.getValue("disableAll")) {
+ if (!BBsentials.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.allEvents)) {
+ if (BBsentials.config.toDisplayConfig.blockChEvents && packet.island.equals(Islands.CRYSTAL_HOLLOWS)) return;
+ if (!(BBsentials.config.toDisplayConfig.allEvents)) {
if (packet.event.equals(MiningEvents.RAFFLE)) {
- if (!config.toDisplayConfig.raffle) return;
+ if (!BBsentials.config.toDisplayConfig.raffle) return;
}
else if (packet.event.equals(MiningEvents.GOBLIN_RAID)) {
- if (!config.toDisplayConfig.goblinRaid) return;
+ if (!BBsentials.config.toDisplayConfig.goblinRaid) return;
}
else if (packet.event.equals(MiningEvents.MITHRIL_GOURMAND)) {
- if (!config.toDisplayConfig.mithrilGourmand) return;
+ if (!BBsentials.config.toDisplayConfig.mithrilGourmand) return;
}
else if (packet.event.equals(MiningEvents.BETTER_TOGETHER)) {
- if (config.toDisplayConfig.betterTogether.equals("none")) return;
- if (config.toDisplayConfig.betterTogether.equals(Islands.DWARVEN_MINES.getDisplayName()) && packet.island.equals(Islands.CRYSTAL_HOLLOWS))
+ if (BBsentials.config.toDisplayConfig.betterTogether.equals("none")) return;
+ if (BBsentials.config.toDisplayConfig.betterTogether.equals(Islands.DWARVEN_MINES.getDisplayName()) && packet.island.equals(Islands.CRYSTAL_HOLLOWS))
return;
- if (config.toDisplayConfig.betterTogether.equals(Islands.CRYSTAL_HOLLOWS.getDisplayName()) && packet.island.equals(Islands.DWARVEN_MINES))
+ if (BBsentials.config.toDisplayConfig.betterTogether.equals(Islands.CRYSTAL_HOLLOWS.getDisplayName()) && packet.island.equals(Islands.DWARVEN_MINES))
return;
}
else if (packet.event.equals(MiningEvents.DOUBLE_POWDER)) {
- if (config.toDisplayConfig.doublePowder.equals("none")) return;
- if (config.toDisplayConfig.doublePowder.equals(Islands.DWARVEN_MINES.getDisplayName()) && packet.island.equals(Islands.CRYSTAL_HOLLOWS))
+ if (BBsentials.config.toDisplayConfig.doublePowder.equals("none")) return;
+ if (BBsentials.config.toDisplayConfig.doublePowder.equals(Islands.DWARVEN_MINES.getDisplayName()) && packet.island.equals(Islands.CRYSTAL_HOLLOWS))
return;
- if (config.toDisplayConfig.doublePowder.equals(Islands.CRYSTAL_HOLLOWS.getDisplayName()) && packet.island.equals(Islands.DWARVEN_MINES))
+ if (BBsentials.config.toDisplayConfig.doublePowder.equals(Islands.CRYSTAL_HOLLOWS.getDisplayName()) && packet.island.equals(Islands.DWARVEN_MINES))
return;
}
else if (packet.event.equals(MiningEvents.GONE_WITH_THE_WIND)) {
- if (config.toDisplayConfig.goneWithTheWind.equals("none")) return;
- if (config.toDisplayConfig.goneWithTheWind.equals(Islands.DWARVEN_MINES.getDisplayName()) && packet.island.equals(Islands.CRYSTAL_HOLLOWS))
+ if (BBsentials.config.toDisplayConfig.goneWithTheWind.equals("none")) return;
+ if (BBsentials.config.toDisplayConfig.goneWithTheWind.equals(Islands.DWARVEN_MINES.getDisplayName()) && packet.island.equals(Islands.CRYSTAL_HOLLOWS))
return;
- if (config.toDisplayConfig.goneWithTheWind.equals(Islands.CRYSTAL_HOLLOWS.getDisplayName()) && packet.island.equals(Islands.DWARVEN_MINES))
+ if (BBsentials.config.toDisplayConfig.goneWithTheWind.equals(Islands.CRYSTAL_HOLLOWS.getDisplayName()) && packet.island.equals(Islands.DWARVEN_MINES))
return;
}
}
@@ -399,7 +381,7 @@ public class BBsentialConnection {
public void onWelcomePacket(WelcomeClientPacket packet) {
if (packet.success) {
- config.bbsentialsRoles = packet.roles;
+ BBsentials.config.bbsentialsRoles = packet.roles;
Chat.sendPrivateMessageToSelfSuccess("Login Success");
if (!packet.motd.isEmpty()) {
Chat.sendPrivateMessageToSelfImportantInfo(packet.motd);
@@ -415,7 +397,7 @@ public class BBsentialConnection {
BBsentials.connection = null;
for (int i = 0; i < packet.waitBeforeReconnect.length; i++) {
int finalI = i;
- executionService.schedule(() -> {
+ BBsentials.executionService.schedule(() -> {
if (finalI == 1) {
BBsentials.connectToBBserver();
}
@@ -442,7 +424,7 @@ public class BBsentialConnection {
playsound(SoundEvents.BLOCK_ANVIL_DESTROY);
for (int i = 0; i < 10; i++) {
int finalI = i;
- executionService.schedule(() -> Chat.sendPrivateMessageToSelfFatal("BB: Time till crash: " + finalI), i, TimeUnit.SECONDS);
+ BBsentials.executionService.schedule(() -> Chat.sendPrivateMessageToSelfFatal("BB: Time till crash: " + finalI), i, TimeUnit.SECONDS);
}
throw new RuntimeException("BBsentials: Self Remove was triggered");
}
@@ -453,16 +435,16 @@ public class BBsentialConnection {
playsound(SoundEvents.BLOCK_ANVIL_DESTROY);
}
else if (packet.command.equals(InternalCommandPacket.HUB)) {
- config.sender.addImmediateSendTask("/hub");
+ BBsentials.config.sender.addImmediateSendTask("/hub");
}
else if (packet.command.equals(InternalCommandPacket.PRIVATE_ISLAND)) {
- config.sender.addImmediateSendTask("/is");
+ BBsentials.config.sender.addImmediateSendTask("/is");
}
else if (packet.command.equals(InternalCommandPacket.HIDDEN_HUB)) {
- config.sender.addHiddenSendTask("/hub", 0);
+ BBsentials.config.sender.addHiddenSendTask("/hub", 0);
}
else if (packet.command.equals(InternalCommandPacket.HIDDEN_PRIVATE_ISLAND)) {
- config.sender.addHiddenSendTask("/is", 0);
+ BBsentials.config.sender.addHiddenSendTask("/is", 0);
}
else if (packet.command.equals(InternalCommandPacket.CRASH)) {
Chat.sendPrivateMessageToSelfFatal("BB: Stopping in 10 seconds.");
@@ -491,7 +473,7 @@ public class BBsentialConnection {
}
public void onPartyPacket(PartyPacket packet) {
- if (config.allowServerPartyInvite) {
+ if (BBsentials.config.allowServerPartyInvite) {
Chat.sendCommand("/p " + packet.type + String.join(" ", packet.users));
}
else {
@@ -512,20 +494,20 @@ public class BBsentialConnection {
}
public boolean showChChest(ChChestItem[] items) {
- if (config.toDisplayConfig.allChChestItem) return true;
+ if (BBsentials.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))
+ if (BBsentials.config.toDisplayConfig.customChChestItem && item.isCustom()) return true;
+ if (BBsentials.config.toDisplayConfig.allRoboPart && item.isRoboPart()) return true;
+ if (BBsentials.config.toDisplayConfig.prehistoricEgg && item.equals(ChChestItems.PrehistoricEgg)) return true;
+ if (BBsentials.config.toDisplayConfig.pickonimbus2000 && item.equals(ChChestItems.Pickonimbus2000)) return true;
+ if (BBsentials.config.toDisplayConfig.controlSwitch && item.equals(ChChestItems.ControlSwitch)) return true;
+ if (BBsentials.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 (BBsentials.config.toDisplayConfig.robotronReflector && item.equals(ChChestItems.RobotronReflector)) return true;
+ if (BBsentials.config.toDisplayConfig.superliteMotor && item.equals(ChChestItems.SuperliteMotor)) return true;
+ if (BBsentials.config.toDisplayConfig.syntheticHeart && item.equals(ChChestItems.SyntheticHeart)) return true;
+ if (BBsentials.config.toDisplayConfig.flawlessGemstone && item.equals(ChChestItems.FlawlessGemstone)) return true;
+ if (BBsentials.config.toDisplayConfig.jungleHeart && item.equals(ChChestItems.JungleHeart)) return true;
}
return false;
}
diff --git a/src/main/java/de/hype/bbsentials/constants/BBDisplayNameProvider.java b/common/src/main/java/de/hype/bbsentials/common/constants/BBDisplayNameProvider.java
index 308e705..ca3aa36 100644
--- a/src/main/java/de/hype/bbsentials/constants/BBDisplayNameProvider.java
+++ b/common/src/main/java/de/hype/bbsentials/common/constants/BBDisplayNameProvider.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.constants;
+package de.hype.bbsentials.common.constants;
public interface BBDisplayNameProvider {
String getDisplayName();
diff --git a/src/main/java/de/hype/bbsentials/constants/BBDisplayNameProviderWithCustom.java b/common/src/main/java/de/hype/bbsentials/common/constants/BBDisplayNameProviderWithCustom.java
index 4088443..43cb5ac 100644
--- a/src/main/java/de/hype/bbsentials/constants/BBDisplayNameProviderWithCustom.java
+++ b/common/src/main/java/de/hype/bbsentials/common/constants/BBDisplayNameProviderWithCustom.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.constants;
+package de.hype.bbsentials.common.constants;
public interface BBDisplayNameProviderWithCustom<T extends Enum<T>> extends BBDisplayNameProvider {
T setDisplayName(String displayname);
diff --git a/src/main/java/de/hype/bbsentials/constants/enviromentShared/AuthenticationConstants.java b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/AuthenticationConstants.java
index 878f303..52f1ea1 100644
--- a/src/main/java/de/hype/bbsentials/constants/enviromentShared/AuthenticationConstants.java
+++ b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/AuthenticationConstants.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.constants.enviromentShared;
+package de.hype.bbsentials.common.constants.enviromentShared;
public class AuthenticationConstants {
//Authentication Types
diff --git a/src/main/java/de/hype/bbsentials/constants/enviromentShared/ChChestItem.java b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/ChChestItem.java
index 3e6a346..b937367 100644
--- a/src/main/java/de/hype/bbsentials/constants/enviromentShared/ChChestItem.java
+++ b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/ChChestItem.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.constants.enviromentShared;
+package de.hype.bbsentials.common.constants.enviromentShared;
public class ChChestItem {
private String displayName;
diff --git a/src/main/java/de/hype/bbsentials/constants/enviromentShared/ChChestItems.java b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/ChChestItems.java
index a416f6e..0a12742 100644
--- a/src/main/java/de/hype/bbsentials/constants/enviromentShared/ChChestItems.java
+++ b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/ChChestItems.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.constants.enviromentShared;
+package de.hype.bbsentials.common.constants.enviromentShared;
import java.lang.reflect.Field;
import java.util.ArrayList;
diff --git a/src/main/java/de/hype/bbsentials/constants/enviromentShared/EnumUtils.java b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/EnumUtils.java
index fba8ff2..173d299 100644
--- a/src/main/java/de/hype/bbsentials/constants/enviromentShared/EnumUtils.java
+++ b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/EnumUtils.java
@@ -1,7 +1,7 @@
-package de.hype.bbsentials.constants.enviromentShared;
+package de.hype.bbsentials.common.constants.enviromentShared;
-import de.hype.bbsentials.constants.BBDisplayNameProvider;
-import de.hype.bbsentials.constants.BBDisplayNameProviderWithCustom;
+import de.hype.bbsentials.common.constants.BBDisplayNameProvider;
+import de.hype.bbsentials.common.constants.BBDisplayNameProviderWithCustom;
import java.util.ArrayList;
import java.util.Collection;
diff --git a/src/main/java/de/hype/bbsentials/constants/enviromentShared/InternalReasonConstants.java b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/InternalReasonConstants.java
index 79bf13a..43835c6 100644
--- a/src/main/java/de/hype/bbsentials/constants/enviromentShared/InternalReasonConstants.java
+++ b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/InternalReasonConstants.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.constants.enviromentShared;
+package de.hype.bbsentials.common.constants.enviromentShared;
public enum InternalReasonConstants {
INVALID_PARAMETER,
diff --git a/src/main/java/de/hype/bbsentials/constants/enviromentShared/Islands.java b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/Islands.java
index 2ab4e55..e2e914c 100644
--- a/src/main/java/de/hype/bbsentials/constants/enviromentShared/Islands.java
+++ b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/Islands.java
@@ -1,6 +1,6 @@
-package de.hype.bbsentials.constants.enviromentShared;
+package de.hype.bbsentials.common.constants.enviromentShared;
-import de.hype.bbsentials.constants.BBDisplayNameProvider;
+import de.hype.bbsentials.common.constants.BBDisplayNameProvider;
public enum Islands implements BBDisplayNameProvider {
CRYSTAL_HOLLOWS("crystal_hollows", "Crystal Hollows"),
diff --git a/src/main/java/de/hype/bbsentials/constants/enviromentShared/MiningEvents.java b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/MiningEvents.java
index 7ef4289..5f6e99e 100644
--- a/src/main/java/de/hype/bbsentials/constants/enviromentShared/MiningEvents.java
+++ b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/MiningEvents.java
@@ -1,6 +1,6 @@
-package de.hype.bbsentials.constants.enviromentShared;
+package de.hype.bbsentials.common.constants.enviromentShared;
-import de.hype.bbsentials.constants.BBDisplayNameProvider;
+import de.hype.bbsentials.common.constants.BBDisplayNameProvider;
// Mining Events
public enum MiningEvents implements BBDisplayNameProvider {
diff --git a/common/src/main/java/de/hype/bbsentials/common/mclibraries/BBUtils.java b/common/src/main/java/de/hype/bbsentials/common/mclibraries/BBUtils.java
new file mode 100644
index 0000000..6d4fdc2
--- /dev/null
+++ b/common/src/main/java/de/hype/bbsentials/common/mclibraries/BBUtils.java
@@ -0,0 +1,21 @@
+package de.hype.bbsentials.common.mclibraries;
+
+import de.hype.bbsentials.common.constants.enviromentShared.Islands;
+
+import java.util.List;
+
+public abstract class BBUtils {
+ public abstract Islands getCurrentIsland();
+
+ public abstract int getPlayerCount();
+
+ public abstract String getServer();
+
+ public abstract boolean isOnMegaServer();
+
+ public abstract boolean isOnMiniServer();
+
+ public abstract int getMaximumPlayerCount();
+
+ public abstract List<String> getPlayers();
+}
diff --git a/src/main/java/de/hype/bbsentials/packets/AbstractPacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/AbstractPacket.java
index 152e3d8..7328517 100644
--- a/src/main/java/de/hype/bbsentials/packets/AbstractPacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/AbstractPacket.java
@@ -1,10 +1,10 @@
-package de.hype.bbsentials.packets;
+package de.hype.bbsentials.common.packets;
-import de.hype.bbsentials.chat.Chat;
-import de.hype.bbsentials.client.BBsentials;
-import de.hype.bbsentials.client.Config;
-import de.hype.bbsentials.communication.BBsentialConnection;
-import de.hype.bbsentials.packets.packets.InvalidCommandFeedbackPacket;
+import de.hype.bbsentials.common.chat.Chat;
+import de.hype.bbsentials.common.client.BBsentials;
+import de.hype.bbsentials.common.client.Config;
+import de.hype.bbsentials.common.communication.BBsentialConnection;
+import de.hype.bbsentials.common.packets.packets.InvalidCommandFeedbackPacket;
import java.lang.reflect.Field;
diff --git a/src/main/java/de/hype/bbsentials/packets/EnviromentPacketConfig.java b/common/src/main/java/de/hype/bbsentials/common/packets/EnviromentPacketConfig.java
index da05704..ee82d32 100644
--- a/src/main/java/de/hype/bbsentials/packets/EnviromentPacketConfig.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/EnviromentPacketConfig.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.packets;
+package de.hype.bbsentials.common.packets;
public class EnviromentPacketConfig {
public static final String enviroment = "Client";
diff --git a/src/main/java/de/hype/bbsentials/packets/Packet.java b/common/src/main/java/de/hype/bbsentials/common/packets/Packet.java
index 6a4ecbf..f184578 100644
--- a/src/main/java/de/hype/bbsentials/packets/Packet.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/Packet.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.packets;
+package de.hype.bbsentials.common.packets;
import java.util.function.Consumer;
diff --git a/src/main/java/de/hype/bbsentials/packets/PacketManager.java b/common/src/main/java/de/hype/bbsentials/common/packets/PacketManager.java
index cda4315..23368d8 100644
--- a/src/main/java/de/hype/bbsentials/packets/PacketManager.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/PacketManager.java
@@ -1,7 +1,7 @@
-package de.hype.bbsentials.packets;
+package de.hype.bbsentials.common.packets;
-import de.hype.bbsentials.communication.BBsentialConnection;
-import de.hype.bbsentials.packets.packets.*;
+import de.hype.bbsentials.common.communication.BBsentialConnection;
+import de.hype.bbsentials.common.packets.packets.*;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/main/java/de/hype/bbsentials/packets/PacketUtils.java b/common/src/main/java/de/hype/bbsentials/common/packets/PacketUtils.java
index e9aeb27..bc5f9b0 100644
--- a/src/main/java/de/hype/bbsentials/packets/PacketUtils.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/PacketUtils.java
@@ -1,10 +1,10 @@
-package de.hype.bbsentials.packets;
+package de.hype.bbsentials.common.packets;
import com.google.gson.Gson;
-import de.hype.bbsentials.chat.Chat;
-import de.hype.bbsentials.client.BBsentials;
-import de.hype.bbsentials.client.CustomGson;
-import de.hype.bbsentials.communication.BBsentialConnection;
+import de.hype.bbsentials.common.chat.Chat;
+import de.hype.bbsentials.common.client.BBsentials;
+import de.hype.bbsentials.common.client.CustomGson;
+import de.hype.bbsentials.common.communication.BBsentialConnection;
import java.util.function.Consumer;
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/BingoChatMessagePacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/BingoChatMessagePacket.java
index b62db7d..c7432da 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/BingoChatMessagePacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/BingoChatMessagePacket.java
@@ -1,7 +1,7 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class BingoChatMessagePacket extends AbstractPacket {
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/BroadcastMessagePacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/BroadcastMessagePacket.java
index aa0cb89..bbd6d90 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/BroadcastMessagePacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/BroadcastMessagePacket.java
@@ -1,7 +1,7 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class BroadcastMessagePacket extends AbstractPacket {
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/ChChestPacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/ChChestPacket.java
index 4519b66..7355397 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/ChChestPacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/ChChestPacket.java
@@ -1,7 +1,7 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
-import de.hype.bbsentials.constants.enviromentShared.ChChestItem;
+import de.hype.bbsentials.common.constants.enviromentShared.ChChestItem;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class ChChestPacket extends AbstractPacket {
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/DisconnectPacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/DisconnectPacket.java
index 7cb461e..ca60a49 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/DisconnectPacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/DisconnectPacket.java
@@ -1,7 +1,7 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
-import de.hype.bbsentials.constants.enviromentShared.InternalReasonConstants;
+import de.hype.bbsentials.common.constants.enviromentShared.InternalReasonConstants;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class DisconnectPacket extends AbstractPacket {
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/DisplayTellrawMessagePacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/DisplayTellrawMessagePacket.java
index b0580e5..e3e7f70 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/DisplayTellrawMessagePacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/DisplayTellrawMessagePacket.java
@@ -1,6 +1,6 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class DisplayTellrawMessagePacket extends AbstractPacket {
public final String rawJson;
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/InternalCommandPacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/InternalCommandPacket.java
index a5ae416..fb7a774 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/InternalCommandPacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/InternalCommandPacket.java
@@ -1,6 +1,6 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
+import de.hype.bbsentials.common.packets.AbstractPacket;
//Only used for small things which don't really need an own Packet.
public class InternalCommandPacket extends AbstractPacket {
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/InvalidCommandFeedbackPacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/InvalidCommandFeedbackPacket.java
index d1173ea..2f4510e 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/InvalidCommandFeedbackPacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/InvalidCommandFeedbackPacket.java
@@ -1,6 +1,6 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class InvalidCommandFeedbackPacket extends AbstractPacket {
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/MiningEventPacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/MiningEventPacket.java
index ae2f436..9d9be62 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/MiningEventPacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/MiningEventPacket.java
@@ -1,8 +1,8 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
-import de.hype.bbsentials.constants.enviromentShared.Islands;
-import de.hype.bbsentials.constants.enviromentShared.MiningEvents;
+import de.hype.bbsentials.common.constants.enviromentShared.Islands;
+import de.hype.bbsentials.common.constants.enviromentShared.MiningEvents;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class MiningEventPacket extends AbstractPacket {
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/PartyPacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/PartyPacket.java
index 23325d9..48a36f4 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/PartyPacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/PartyPacket.java
@@ -1,6 +1,6 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class PartyPacket extends AbstractPacket {
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/PunishUserPacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/PunishUserPacket.java
index 43cb6e5..dce052f 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/PunishUserPacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/PunishUserPacket.java
@@ -1,6 +1,6 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class PunishUserPacket extends AbstractPacket {
public static final String PUNISHMENT_TYPE_BAN = "BAN";
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/RequestConnectPacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/RequestConnectPacket.java
index 6009de5..9ce468a 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/RequestConnectPacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/RequestConnectPacket.java
@@ -1,6 +1,6 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class RequestConnectPacket extends AbstractPacket {
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/SplashNotifyPacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/SplashNotifyPacket.java
index e0b4fa4..427e4f2 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/SplashNotifyPacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/SplashNotifyPacket.java
@@ -1,7 +1,7 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
-import de.hype.bbsentials.constants.enviromentShared.Islands;
+import de.hype.bbsentials.common.constants.enviromentShared.Islands;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class SplashNotifyPacket extends AbstractPacket {
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/SplashUpdatePacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/SplashUpdatePacket.java
index 201ff37..9645daf 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/SplashUpdatePacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/SplashUpdatePacket.java
@@ -1,7 +1,7 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class SplashUpdatePacket extends AbstractPacket {
public static final String STATUS_WAITING = "Waiting";
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/SystemMessagePacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/SystemMessagePacket.java
index c8ba534..13b92d4 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/SystemMessagePacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/SystemMessagePacket.java
@@ -1,6 +1,6 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class SystemMessagePacket extends AbstractPacket {
public final String message;
diff --git a/src/main/java/de/hype/bbsentials/packets/packets/WelcomeClientPacket.java b/common/src/main/java/de/hype/bbsentials/common/packets/packets/WelcomeClientPacket.java
index f1c80b3..00aa003 100644
--- a/src/main/java/de/hype/bbsentials/packets/packets/WelcomeClientPacket.java
+++ b/common/src/main/java/de/hype/bbsentials/common/packets/packets/WelcomeClientPacket.java
@@ -1,6 +1,6 @@
-package de.hype.bbsentials.packets.packets;
+package de.hype.bbsentials.common.packets.packets;
-import de.hype.bbsentials.packets.AbstractPacket;
+import de.hype.bbsentials.common.packets.AbstractPacket;
public class WelcomeClientPacket extends AbstractPacket {
diff --git a/src/main/resources/assets/bbsentials/textures/item/splash_hub.png b/common/src/main/resources/assets/bbsentials/textures/item/splash_hub.png
index 7929d1a..7929d1a 100644
--- a/src/main/resources/assets/bbsentials/textures/item/splash_hub.png
+++ b/common/src/main/resources/assets/bbsentials/textures/item/splash_hub.png
Binary files differ
diff --git a/src/main/resources/assets/public_bbsentials_cert.crt b/common/src/main/resources/assets/public_bbsentials_cert.crt
index 723fc34..723fc34 100644
--- a/src/main/resources/assets/public_bbsentials_cert.crt
+++ b/common/src/main/resources/assets/public_bbsentials_cert.crt
Binary files differ
diff --git a/common/src/main/resources/bbsentials.mixins.json b/common/src/main/resources/bbsentials.mixins.json
new file mode 100644
index 0000000..4467110
--- /dev/null
+++ b/common/src/main/resources/bbsentials.mixins.json
@@ -0,0 +1,16 @@
+{
+ "required": true,
+ "minVersion": "0.8",
+ "package": "de.hype.bbsentials.mixins",
+ "compatibilityLevel": "JAVA_8",
+ "mixins": [],
+ "client": [
+ "de.hype.bbsentials.common.mixins.ClientCommandSourceMixin",
+ "de.hype.bbsentials.common.mixins.ItemRendererMixin",
+ "de.hype.bbsentials.common.mixins.ScreenMixin",
+ "de.hype.bbsentials.common.mixins.SimpleOptionMixin"
+ ],
+ "injectors": {
+ "defaultRequire": 1
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/fabric.mod.json b/common/src/main/resources/fabric.mod.json
index 506dcba..d296d7c 100644
--- a/src/main/resources/fabric.mod.json
+++ b/common/src/main/resources/fabric.mod.json
@@ -19,9 +19,11 @@
"environment": "client",
"entrypoints": {
"client": [
- "de.hype.bbsentials.client.BBsentials"
+ "de.hype.bbsentials.common.client.BBsentials"
],
- "modmenu": [ "de.hype.bbsentials.client.ModMenueScreen" ]
+ "modmenu": [
+ "de.hype.bbsentials.fabric.ModMenueScreen"
+ ]
},
"depends": {
"fabricloader": ">=${loader_version}",
diff --git a/src/main/resources/logo.png b/common/src/main/resources/logo.png
index 407312a..407312a 100644
--- a/src/main/resources/logo.png
+++ b/common/src/main/resources/logo.png
Binary files differ
diff --git a/src/main/resources/sounds/mixkit-gaming-lock-2848.wav b/common/src/main/resources/sounds/mixkit-gaming-lock-2848.wav
index d079479..d079479 100644
--- a/src/main/resources/sounds/mixkit-gaming-lock-2848.wav
+++ b/common/src/main/resources/sounds/mixkit-gaming-lock-2848.wav
Binary files differ
diff --git a/src/main/resources/sounds/mixkit-interface-option-select-2573.wav b/common/src/main/resources/sounds/mixkit-interface-option-select-2573.wav
index f118ac5..f118ac5 100644
--- a/src/main/resources/sounds/mixkit-interface-option-select-2573.wav
+++ b/common/src/main/resources/sounds/mixkit-interface-option-select-2573.wav
Binary files differ
diff --git a/src/main/resources/sounds/mixkit-long-pop-2358.wav b/common/src/main/resources/sounds/mixkit-long-pop-2358.wav
index 4bed79a..4bed79a 100644
--- a/src/main/resources/sounds/mixkit-long-pop-2358.wav
+++ b/common/src/main/resources/sounds/mixkit-long-pop-2358.wav
Binary files differ
diff --git a/src/main/resources/sounds/mixkit-sci-fi-click-900.wav b/common/src/main/resources/sounds/mixkit-sci-fi-click-900.wav
index 582445e..582445e 100644
--- a/src/main/resources/sounds/mixkit-sci-fi-click-900.wav
+++ b/common/src/main/resources/sounds/mixkit-sci-fi-click-900.wav
Binary files differ
diff --git a/src/main/resources/sounds/mixkit-sci-fi-confirmation-914.wav b/common/src/main/resources/sounds/mixkit-sci-fi-confirmation-914.wav
index 37800c9..37800c9 100644
--- a/src/main/resources/sounds/mixkit-sci-fi-confirmation-914.wav
+++ b/common/src/main/resources/sounds/mixkit-sci-fi-confirmation-914.wav
Binary files differ
diff --git a/fabric/build.gradle b/fabric/build.gradle
new file mode 100644
index 0000000..4fa2a38
--- /dev/null
+++ b/fabric/build.gradle
@@ -0,0 +1,95 @@
+plugins {
+ id 'fabric-loom' version '1.2-SNAPSHOT'
+ id 'maven-publish'
+}
+
+version = project.mod_version
+group = project.maven_group
+
+repositories {
+ maven { url 'https://maven.terraformersmc.com/releases' }
+ maven { url "https://maven.shedaniel.me/" }
+
+ // Add repositories to retrieve artifacts from in here.
+ // You should only use this when depending on other mods because
+ // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
+ // See https://docs.gradle.org/current/userguide/declaring_repositories.html
+ // for more information about repositories.
+}
+dependencies {
+ implementation project(path: ':common')
+ // To change the versions see the gradle.properties file
+ minecraft "com.mojang:minecraft:${project.minecraft_version}"
+ mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
+ modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
+ modImplementation 'com.terraformersmc:modmenu:8.0.0'
+ modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
+ modApi("me.shedaniel.cloth:cloth-config-fabric:12.0.109") {
+ exclude(group: "net.fabricmc.fabric-api")
+ }
+}
+
+processResources {
+ inputs.property "version", project.version
+ inputs.property "minecraft_version", project.minecraft_version
+ inputs.property "loader_version", project.loader_version
+ //inputs.property "discord", project.discord
+ filteringCharset "UTF-8"
+
+ filesMatching("fabric.mod.json") {
+ expand "version": project.version,
+ "minecraft_version": project.minecraft_version,
+ "loader_version": project.loader_version
+ }
+}
+
+def targetJavaVersion = 17
+tasks.withType(JavaCompile).configureEach {
+ // ensure that the encoding is set to UTF-8, no matter what the system default is
+ // this fixes some edge cases with special characters not displaying correctly
+ // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
+ // If Javadoc is generated, this must be specified in that task too.
+ it.options.encoding = "UTF-8"
+ if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
+ it.options.release = targetJavaVersion
+ }
+}
+
+java {
+ def javaVersion = JavaVersion.toVersion(targetJavaVersion)
+ if (JavaVersion.current() < javaVersion) {
+ toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
+ }
+ archivesBaseName = project.archives_base_name
+ // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
+ // if it is present.
+ // If you remove this line, sources will not be generated.
+ withSourcesJar()
+}
+
+jar {
+ from("LICENSE") {
+ rename { "${it}_${project.archivesBaseName}" }
+ }
+ manifest {
+ attributes 'Fabric-MixinConfigs': 'modid.mixin.json',
+ 'MixinConfigs': 'modid.mixin.json'
+ }
+}
+
+// configure the maven publication
+publishing {
+ publications {
+ mavenJava(MavenPublication) {
+ from components.java
+ }
+ }
+
+ // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
+ repositories {
+ // Add repositories to publish to here.
+ // Notice: This block does NOT have the same function as the block in the top level.
+ // The repositories here will be used for publishing your artifact, not for
+ // retrieving dependencies.
+ }
+} \ No newline at end of file
diff --git a/src/main/java/de/hype/bbsentials/client/BBUtils.java b/fabric/src/main/java/de/hype/bbsentials/fabric/BBUtils.java
index 1b35fa6..c9261fe 100644
--- a/src/main/java/de/hype/bbsentials/client/BBUtils.java
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/BBUtils.java
@@ -1,16 +1,16 @@
-package de.hype.bbsentials.client;
+package de.hype.bbsentials.fabric;
import com.google.common.collect.Lists;
-import de.hype.bbsentials.chat.Chat;
-import de.hype.bbsentials.constants.enviromentShared.Islands;
+import de.hype.bbsentials.common.chat.Chat;
+import de.hype.bbsentials.common.constants.enviromentShared.Islands;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.PlayerListEntry;
import java.util.Iterator;
import java.util.List;
-public class BBUtils {
- public static Islands getCurrentIsland() {
+public class BBUtils extends de.hype.bbsentials.common.mclibraries.BBUtils {
+ public Islands getCurrentIsland() {
try {
String string = MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!C-b").getDisplayName().getString();
if (!string.startsWith("Area: ")) {
@@ -24,23 +24,23 @@ public class BBUtils {
return null;
}
- public static int getPlayerCount() {
+ public int getPlayerCount() {
return Integer.parseInt(MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!B-a").getDisplayName().getString().trim().replaceAll("[^0-9]", ""));
}
- public static String getServer() {
+ public String getServer() {
return MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!C-c").getDisplayName().getString().replace("Server:", "").trim();
}
- public static boolean isOnMegaServer() {
+ public boolean isOnMegaServer() {
return getServer().toLowerCase().startsWith("mega");
}
- public static boolean isOnMiniServer() {
+ public boolean isOnMiniServer() {
return getServer().toLowerCase().startsWith("mini");
}
- public static int getMaximumPlayerCount() {
+ public int getMaximumPlayerCount() {
boolean mega = isOnMegaServer();
Islands island = getCurrentIsland();
if (island == null) return 100;
diff --git a/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java b/fabric/src/main/java/de/hype/bbsentials/fabric/BBsentialsConfigScreemFactory.java
index d078b46..a723284 100644
--- a/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/BBsentialsConfigScreemFactory.java
@@ -1,6 +1,7 @@
-package de.hype.bbsentials.client;
+package de.hype.bbsentials.fabric;
-import de.hype.bbsentials.constants.enviromentShared.Islands;
+import de.hype.bbsentials.common.client.BBsentials;
+import de.hype.bbsentials.common.constants.enviromentShared.Islands;
import me.shedaniel.clothconfig2.api.ConfigBuilder;
import me.shedaniel.clothconfig2.api.ConfigCategory;
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
@@ -16,8 +17,6 @@ import net.minecraft.text.Text;
import java.util.List;
-import static de.hype.bbsentials.client.BBsentials.config;
-
public class BBsentialsConfigScreemFactory {
public static Screen create(Screen parent) {
if (BBsentials.config == null) {
@@ -30,8 +29,8 @@ public class BBsentialsConfigScreemFactory {
builder.setSavingRunnable(BBsentials.getConfig()::save);
ConfigEntryBuilder entryBuilder = builder.entryBuilder();
ConfigCategory server = builder.getOrCreateCategory(Text.of("Server"));
- if (config.getUsername().equalsIgnoreCase("Hype_the_Time")) {
- server.addEntry(entryBuilder.startTextField(Text.of("Server URL"), config.getBBServerURL().replaceAll(".", "*"))
+ if (BBsentials.config.getUsername().equalsIgnoreCase("Hype_the_Time")) {
+ server.addEntry(entryBuilder.startTextField(Text.of("Server URL"), BBsentials.config.getBBServerURL().replaceAll(".", "*"))
.setDefaultValue("localhost")
.setTooltip(Text.of("Place the Server URL of the BBsentials Server here"))
.setSaveConsumer((newValue) -> {
@@ -39,19 +38,19 @@ public class BBsentialsConfigScreemFactory {
return;
}
else {
- config.bbServerURL = newValue;
+ BBsentials.config.bbServerURL = newValue;
}
})
.build());
}
else {
- server.addEntry(entryBuilder.startTextField(Text.of("Server URL"), config.getBBServerURL())
+ server.addEntry(entryBuilder.startTextField(Text.of("Server URL"), BBsentials.config.getBBServerURL())
.setDefaultValue("localhost")
.setTooltip(Text.of("Place the Server URL of the BBsentials Server here"))
- .setSaveConsumer(newValue -> config.bbServerURL = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.bbServerURL = newValue)
.build());
}
- server.addEntry(entryBuilder.startStrField(Text.of("BBsentials API key"), config.apiKey.replaceAll(".", "*"))
+ server.addEntry(entryBuilder.startStrField(Text.of("BBsentials API key"), BBsentials.config.apiKey.replaceAll(".", "*"))
.setDefaultValue("unset")
.setTooltip(Text.of("Put you API Key here (the one generated in the Discord! with /link). §cThe Text is visually censored. Not saved unless you changed it."))
.setSaveConsumer((newValue) -> {
@@ -59,59 +58,59 @@ public class BBsentialsConfigScreemFactory {
return;
}
else {
- config.apiKey = newValue;
+ BBsentials.config.apiKey = newValue;
}
})
.build());
- server.addEntry(entryBuilder.startBooleanToggle(Text.of("Connect to Test Server"), config.connectToBeta)
+ server.addEntry(entryBuilder.startBooleanToggle(Text.of("Connect to Test Server"), BBsentials.config.connectToBeta)
.setDefaultValue(false)
.setTooltip(Text.of("Makes you connect to the Test Server instead of the Main Server. Keep in mind that all announces may be tests and the main announces are not transferred over to here!")) // Optional: Shown when the user hover over this option
- .setSaveConsumer(newValue -> config.connectToBeta = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.connectToBeta = newValue)
.build());
- server.addEntry(entryBuilder.startBooleanToggle(Text.of("Override Bingo Time"), config.overrideBingoTime)
+ server.addEntry(entryBuilder.startBooleanToggle(Text.of("Override Bingo Time"), BBsentials.config.overrideBingoTime)
.setDefaultValue(false)
.setTooltip(Text.of("Override the Bingo Time and connect always to the Server. (Bingo time is 14 days cause Extreme Bingo)"))
- .setSaveConsumer(newValue -> config.overrideBingoTime = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.overrideBingoTime = newValue)
.build());
- server.addEntry(entryBuilder.startBooleanToggle(Text.of("Allow Server Partying"), config.allowServerPartyInvite)
+ server.addEntry(entryBuilder.startBooleanToggle(Text.of("Allow Server Partying"), BBsentials.config.allowServerPartyInvite)
.setDefaultValue(true)
.setTooltip(Text.of("Allow the Server to party players for you automatically. (Convenience Feature. Is used for example for services to automatically party the persons which joined it)"))
- .setSaveConsumer(newValue -> config.allowServerPartyInvite = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.allowServerPartyInvite = newValue)
.build());
//Visual
ConfigCategory visual = builder.getOrCreateCategory(Text.of("Visual"));
- visual.addEntry(entryBuilder.startBooleanToggle(Text.of("Show Bingo Chat"), config.showBingoChat)
+ visual.addEntry(entryBuilder.startBooleanToggle(Text.of("Show Bingo Chat"), BBsentials.config.showBingoChat)
.setDefaultValue(true)
.setTooltip(Text.of("Select if you want the Bingo Chat to be show"))
- .setSaveConsumer(newValue -> config.showBingoChat = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.showBingoChat = newValue)
.build());
- visual.addEntry(entryBuilder.startBooleanToggle(Text.of("Show Splash Status Updates"), config.showSplashStatusUpdates)
+ visual.addEntry(entryBuilder.startBooleanToggle(Text.of("Show Splash Status Updates"), BBsentials.config.showSplashStatusUpdates)
.setDefaultValue(true)
.setTooltip(Text.of("Select if you want to see Splash Staus updates. Keep in mind that this will only send you status updates for the Splashes which you were shown.\nThose hidden due too too high Splash Time will still remain invisible"))
- .setSaveConsumer(newValue -> config.showSplashStatusUpdates = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.showSplashStatusUpdates = newValue)
.build());
//Notifications
ConfigCategory notifications = builder.getOrCreateCategory(Text.of("Notifications"));
- BooleanListEntry doNotifications = entryBuilder.startBooleanToggle(Text.of("Do Desktop Notifications"), config.doDesktopNotifications)
+ BooleanListEntry doNotifications = entryBuilder.startBooleanToggle(Text.of("Do Desktop Notifications"), BBsentials.config.doDesktopNotifications)
.setDefaultValue(true)
.setTooltip(Text.of("Select if you want BBsentials to automatically accept reparties"))
- .setSaveConsumer(newValue -> config.doDesktopNotifications = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.doDesktopNotifications = newValue)
.build();
- DropdownBoxEntry<String> notificationOn = entryBuilder.startStringDropdownMenu(Text.of("Notification on"), config.notifForMessagesType) // Start the StringDropdownMenu entry
+ DropdownBoxEntry<String> notificationOn = entryBuilder.startStringDropdownMenu(Text.of("Notification on"), BBsentials.config.notifForMessagesType) // Start the StringDropdownMenu entry
.setSelections(List.of("all", "nick", "none"))
.setTooltip(Text.of("When do you want to receive Desktop Notifications? on all party, messages containing nickname"))
.setDefaultValue("all")
.setRequirement(Requirement.isTrue(doNotifications))
.setSuggestionMode(false)
- .setSaveConsumer(newValue -> config.notifForMessagesType = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.notifForMessagesType = newValue)
.build();
- StringListEntry nickname = entryBuilder.startStrField(Text.of("Nickname"), config.nickname)
+ StringListEntry nickname = entryBuilder.startStrField(Text.of("Nickname"), BBsentials.config.nickname)
.setDefaultValue("")
.setTooltip(Text.of("Nickname. you will get send desktop notifications if a message contains one"))
.setRequirement(() -> {
return doNotifications.getValue() && notificationOn.getValue().equals("nick");
})
- .setSaveConsumer(newValue -> config.nickname = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.nickname = newValue)
.build();
notifications.addEntry(doNotifications);
@@ -119,182 +118,182 @@ public class BBsentialsConfigScreemFactory {
notifications.addEntry(nickname);
//other
ConfigCategory other = builder.getOrCreateCategory(Text.of("Other"));
- other.addEntry(entryBuilder.startBooleanToggle(Text.of("Gamma Override"), config.doGammaOverride)
+ other.addEntry(entryBuilder.startBooleanToggle(Text.of("Gamma Override"), BBsentials.config.doGammaOverride)
.setDefaultValue(true)
.setTooltip(Text.of("Select if you want BBsentials to enable full bright"))
- .setSaveConsumer(newValue -> config.doGammaOverride = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.doGammaOverride = newValue)
.build());
- other.addEntry(entryBuilder.startBooleanToggle(Text.of("Accept Reparties"), config.acceptReparty)
+ other.addEntry(entryBuilder.startBooleanToggle(Text.of("Accept Reparties"), BBsentials.config.acceptReparty)
.setDefaultValue(true)
.setTooltip(Text.of("Select if you want BBsentials to automatically accept reparties"))
- .setSaveConsumer(newValue -> config.showBingoChat = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.showBingoChat = newValue)
.build());
- other.addEntry(entryBuilder.startBooleanToggle(Text.of("Accept auto invite"), config.allowBBinviteMe)
+ other.addEntry(entryBuilder.startBooleanToggle(Text.of("Accept auto invite"), BBsentials.config.allowBBinviteMe)
.setDefaultValue(true)
.setTooltip(Text.of("Do you want that whenever someone sends you a msg ending with 'bb:party me' to send them a party invite automatically?"))
- .setSaveConsumer(newValue -> config.allowBBinviteMe = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.allowBBinviteMe = newValue)
.build());
ConfigCategory chChestItems = builder.getOrCreateCategory(Text.of("Ch Chest Items"));
{
- BooleanListEntry allItems = entryBuilder.startBooleanToggle(Text.of("All Chest Items"), config.toDisplayConfig.allChChestItem)
+ BooleanListEntry allItems = entryBuilder.startBooleanToggle(Text.of("All Chest Items"), BBsentials.config.toDisplayConfig.allChChestItem)
.setDefaultValue(true)
.setTooltip(Text.of("Select to receive notifications when an any Item is found"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.allChChestItem = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.allChChestItem = newValue)
.build();
chChestItems.addEntry(allItems);
Requirement notAllItemsRequirement = () -> !allItems.getValue();
- chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("ALL Robo Parts "), config.toDisplayConfig.allRoboPart)
+ chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("ALL Robo Parts "), BBsentials.config.toDisplayConfig.allRoboPart)
.setDefaultValue(false)
.setTooltip(Text.of("Select to receive notifications when an allRoboPartCustomChChestItem is found"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.allRoboPart = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.allRoboPart = newValue)
.setRequirement(notAllItemsRequirement)
.build());
- BooleanListEntry allRoboParts = (entryBuilder.startBooleanToggle(Text.of("Custom (Other) Items"), config.toDisplayConfig.customChChestItem)
+ BooleanListEntry allRoboParts = (entryBuilder.startBooleanToggle(Text.of("Custom (Other) Items"), BBsentials.config.toDisplayConfig.customChChestItem)
.setDefaultValue(false)
.setTooltip(Text.of("Select to receive notifications when any not already defined Item is found"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.customChChestItem = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.customChChestItem = newValue)
.setRequirement(notAllItemsRequirement)
.build());
chChestItems.addEntry(allRoboParts);
Requirement notAllRoboPartsRequirement = () -> !allRoboParts.getValue();
- chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("Prehistoric Egg"), config.toDisplayConfig.prehistoricEgg)
+ chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("Prehistoric Egg"), BBsentials.config.toDisplayConfig.prehistoricEgg)
.setDefaultValue(false)
.setTooltip(Text.of("Select to receive notifications when a Prehistoric Egg is found"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.prehistoricEgg = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.prehistoricEgg = newValue)
.setRequirement(notAllItemsRequirement)
.build());
- chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("Pickonimbus 2000"), config.toDisplayConfig.pickonimbus2000)
+ chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("Pickonimbus 2000"), BBsentials.config.toDisplayConfig.pickonimbus2000)
.setDefaultValue(false)
.setTooltip(Text.of("Select to receive notifications when a Pickonimbus 2000 is found"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.pickonimbus2000 = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.pickonimbus2000 = newValue)
.setRequirement(notAllItemsRequirement)
.build());
SubCategoryBuilder roboParts = entryBuilder.startSubCategory(Text.of("Robo Parts")).setRequirement(Requirement.all(notAllRoboPartsRequirement, notAllItemsRequirement)).setExpanded(true);
- roboParts.add(entryBuilder.startBooleanToggle(Text.of("Control Switch"), config.toDisplayConfig.controlSwitch)
+ roboParts.add(entryBuilder.startBooleanToggle(Text.of("Control Switch"), BBsentials.config.toDisplayConfig.controlSwitch)
.setDefaultValue(false)
.setTooltip(Text.of("Select to receive notifications when a Control Switch is found"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.controlSwitch = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.controlSwitch = newValue)
.build());
- roboParts.add(entryBuilder.startBooleanToggle(Text.of("Electron Transmitter"), config.toDisplayConfig.electronTransmitter)
+ roboParts.add(entryBuilder.startBooleanToggle(Text.of("Electron Transmitter"), BBsentials.config.toDisplayConfig.electronTransmitter)
.setDefaultValue(false)
.setTooltip(Text.of("Select to receive notifications when an Electron Transmitter is found"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.electronTransmitter = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.electronTransmitter = newValue)
.build());
- roboParts.add(entryBuilder.startBooleanToggle(Text.of("FTX 3070"), config.toDisplayConfig.ftx3070)
+ roboParts.add(entryBuilder.startBooleanToggle(Text.of("FTX 3070"), BBsentials.config.toDisplayConfig.ftx3070)
.setDefaultValue(false)
.setTooltip(Text.of("Select to receive notifications when a FTX 3070 is found"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.ftx3070 = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.ftx3070 = newValue)
.build());
- roboParts.add(entryBuilder.startBooleanToggle(Text.of("Robotron Reflector"), config.toDisplayConfig.robotronReflector)
+ roboParts.add(entryBuilder.startBooleanToggle(Text.of("Robotron Reflector"), BBsentials.config.toDisplayConfig.robotronReflector)
.setDefaultValue(false)
.setTooltip(Text.of("Select to receive notifications when a Robotron Reflector is found"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.robotronReflector = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.robotronReflector = newValue)
.build());
- roboParts.add(entryBuilder.startBooleanToggle(Text.of("Superlite Motor"), config.toDisplayConfig.superliteMotor)
+ roboParts.add(entryBuilder.startBooleanToggle(Text.of("Superlite Motor"), BBsentials.config.toDisplayConfig.superliteMotor)
.setDefaultValue(false)
.setTooltip(Text.of("Select to receive notifications when a Superlite Motor is found"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.superliteMotor = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.superliteMotor = newValue)
.build());
- roboParts.add(entryBuilder.startBooleanToggle(Text.of("Synthetic Heart"), config.toDisplayConfig.syntheticHeart)
+ roboParts.add(entryBuilder.startBooleanToggle(Text.of("Synthetic Heart"), BBsentials.config.toDisplayConfig.syntheticHeart)
.setDefaultValue(false)
.setTooltip(Text.of("Select to receive notifications when a Synthetic Heart is found"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.syntheticHeart = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.syntheticHeart = newValue)
.build());
chChestItems.addEntry(roboParts.build());
- chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("Flawless Gemstone"), config.toDisplayConfig.flawlessGemstone)
+ chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("Flawless Gemstone"), BBsentials.config.toDisplayConfig.flawlessGemstone)
.setDefaultValue(false)
.setTooltip(Text.of("Select to receive notifications when any Flawless Gemstone is found"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.flawlessGemstone = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.flawlessGemstone = newValue)
.setRequirement(notAllItemsRequirement)
.build());
- chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("Jungle Heart"), config.toDisplayConfig.jungleHeart)
+ chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("Jungle Heart"), BBsentials.config.toDisplayConfig.jungleHeart)
.setDefaultValue(false)
.setTooltip(Text.of("Select to receive notifications when a JungleHeart is found"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.jungleHeart = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.jungleHeart = newValue)
.setRequirement(notAllItemsRequirement)
.build());
}//CHChestItems
ConfigCategory miningEvents = builder.getOrCreateCategory(Text.of("Mining Events"));
{
- BooleanListEntry allEvents = entryBuilder.startBooleanToggle(Text.of("All Events"), config.toDisplayConfig.allEvents)
+ BooleanListEntry allEvents = entryBuilder.startBooleanToggle(Text.of("All Events"), BBsentials.config.toDisplayConfig.allEvents)
.setDefaultValue(true)
.setTooltip(Text.of("Get updated for any Mining Event"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.allEvents = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.allEvents = newValue)
.build();
miningEvents.addEntry(allEvents);
- miningEvents.addEntry(entryBuilder.startBooleanToggle(Text.of("§cBlock Crystal Hollow Events"), config.toDisplayConfig.blockChEvents)
+ miningEvents.addEntry(entryBuilder.startBooleanToggle(Text.of("§cBlock Crystal Hollow Events"), BBsentials.config.toDisplayConfig.blockChEvents)
.setDefaultValue(false)
.setTooltip(Text.of("Block getting Crystal Hollow Events. Maybe if you haven't accessed Crystal Hollows yet "))
- .setSaveConsumer(newValue -> config.toDisplayConfig.blockChEvents = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.blockChEvents = newValue)
.build());
- miningEvents.addEntry(entryBuilder.startStringDropdownMenu(Text.of("Gone with the Wind"), config.toDisplayConfig.goneWithTheWind) // Start the StringDropdownMenu entry
+ miningEvents.addEntry(entryBuilder.startStringDropdownMenu(Text.of("Gone with the Wind"), BBsentials.config.toDisplayConfig.goneWithTheWind) // Start the StringDropdownMenu entry
.setSelections(List.of("both", Islands.DWARVEN_MINES.getDisplayName(), Islands.CRYSTAL_HOLLOWS.getDisplayName(), "none"))
.setTooltip(Text.of("Get notified when a Gone with the Wind happens in the specified Island"))
.setDefaultValue("none")
.setSuggestionMode(false)
.setRequirement(() -> !allEvents.getValue())
- .setSaveConsumer(newValue -> config.toDisplayConfig.goneWithTheWind = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.goneWithTheWind = newValue)
.build());
- miningEvents.addEntry(entryBuilder.startStringDropdownMenu(Text.of("Better Together"), config.toDisplayConfig.betterTogether) // Start the StringDropdownMenu entry
+ miningEvents.addEntry(entryBuilder.startStringDropdownMenu(Text.of("Better Together"), BBsentials.config.toDisplayConfig.betterTogether) // Start the StringDropdownMenu entry
.setSelections(List.of("both", Islands.DWARVEN_MINES.getDisplayName(), Islands.CRYSTAL_HOLLOWS.getDisplayName(), "none"))
.setTooltip(Text.of("Get notified when a Better Together happens in the specified Island"))
.setDefaultValue("none")
.setSuggestionMode(false)
.setRequirement(() -> !allEvents.getValue())
- .setSaveConsumer(newValue -> config.toDisplayConfig.betterTogether = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.betterTogether = newValue)
.build());
- miningEvents.addEntry(entryBuilder.startStringDropdownMenu(Text.of("Double Powder"), config.toDisplayConfig.doublePowder) // Start the StringDropdownMenu entry
+ miningEvents.addEntry(entryBuilder.startStringDropdownMenu(Text.of("Double Powder"), BBsentials.config.toDisplayConfig.doublePowder) // Start the StringDropdownMenu entry
.setSelections(List.of("both", Islands.DWARVEN_MINES.getDisplayName(), Islands.CRYSTAL_HOLLOWS.getDisplayName(), "none"))
.setTooltip(Text.of("Get notified when a Double Powder happens in the specified Island"))
.setDefaultValue("none")
.setRequirement(() -> !allEvents.getValue())
.setSuggestionMode(false)
- .setSaveConsumer(newValue -> config.toDisplayConfig.doublePowder = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.doublePowder = newValue)
.build());
- miningEvents.addEntry(entryBuilder.startBooleanToggle(Text.of("Mithril Gourmand"), config.toDisplayConfig.mithrilGourmand)
+ miningEvents.addEntry(entryBuilder.startBooleanToggle(Text.of("Mithril Gourmand"), BBsentials.config.toDisplayConfig.mithrilGourmand)
.setDefaultValue(false)
.setTooltip(Text.of("Get notified when a Mithril Gourmand happens"))
.setRequirement(() -> !allEvents.getValue())
- .setSaveConsumer(newValue -> config.toDisplayConfig.mithrilGourmand = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.mithrilGourmand = newValue)
.build());
- miningEvents.addEntry(entryBuilder.startBooleanToggle(Text.of("Raffle"), config.toDisplayConfig.raffle)
+ miningEvents.addEntry(entryBuilder.startBooleanToggle(Text.of("Raffle"), BBsentials.config.toDisplayConfig.raffle)
.setDefaultValue(false)
.setTooltip(Text.of("Get notified when a Raffle happens"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.raffle = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.raffle = newValue)
.setRequirement(() -> !allEvents.getValue())
.build());
- miningEvents.addEntry(entryBuilder.startBooleanToggle(Text.of("Goblin Raid"), config.toDisplayConfig.goblinRaid)
+ miningEvents.addEntry(entryBuilder.startBooleanToggle(Text.of("Goblin Raid"), BBsentials.config.toDisplayConfig.goblinRaid)
.setDefaultValue(false)
.setTooltip(Text.of("Get notified when a Goblin Raid happens"))
- .setSaveConsumer(newValue -> config.toDisplayConfig.goblinRaid = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.toDisplayConfig.goblinRaid = newValue)
.setRequirement(() -> !allEvents.getValue())
.build());
} //Mining Events
- if (config.hasBBRoles("dev")) {
+ if (BBsentials.config.hasBBRoles("dev")) {
ConfigCategory dev = builder.getOrCreateCategory(Text.of("§3Developing"));
- dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Dev Mode"), config.devMode)
+ dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Dev Mode"), BBsentials.config.devMode)
.setDefaultValue(false)
.setTooltip(Text.of("Dev Mode"))
- .setSaveConsumer(newValue -> config.devMode = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.devMode = newValue)
.build());
- dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Detailed Dev Mode"), config.detailedDevMode)
+ dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Detailed Dev Mode"), BBsentials.config.detailedDevMode)
.setDefaultValue(false)
.setTooltip(Text.of("Detailed Dev Mode"))
- .setSaveConsumer(newValue -> config.detailedDevMode = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.detailedDevMode = newValue)
.build());
}
- if (config.hasBBRoles("splasher")) {
+ if (BBsentials.config.hasBBRoles("splasher")) {
ConfigCategory dev = builder.getOrCreateCategory(Text.of("§dSplashes"));
- dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Auto Update Statuses"), config.autoSplashStatusUpdates)
+ dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Auto Update Statuses"), BBsentials.config.autoSplashStatusUpdates)
.setDefaultValue(true)
.setTooltip(Text.of("Automatically updates the Status of the Splash by sending packets to the Server"))
- .setSaveConsumer(newValue -> config.autoSplashStatusUpdates = newValue)
+ .setSaveConsumer(newValue -> BBsentials.config.autoSplashStatusUpdates = newValue)
.build());
}
diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/FabricChat.java b/fabric/src/main/java/de/hype/bbsentials/fabric/FabricChat.java
new file mode 100644
index 0000000..e67a6e9
--- /dev/null
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/FabricChat.java
@@ -0,0 +1,26 @@
+package de.hype.bbsentials.fabric;
+
+import de.hype.bbsentials.common.chat.Chat;
+import de.hype.bbsentials.common.chat.Message;
+import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents;
+import net.fabricmc.fabric.api.client.message.v1.ClientSendMessageEvents;
+import net.minecraft.text.Text;
+
+public class FabricChat {
+ public FabricChat() {
+ init();
+ }
+ public Chat chat = new Chat();
+ private void init() {
+ // Register a callback for a custom message type
+ ClientReceiveMessageEvents.CHAT.register((message, signedMessage, sender, params, receptionTimestamp) -> {
+ chat.onEvent(new Message(Text.Serializer.toJson(message),message.getString()));
+ });
+ ClientReceiveMessageEvents.MODIFY_GAME.register((message, overlay) -> (Text.Serializer.fromJson(chat.onEvent(new Message(Text.Serializer.toJson(message),message.getString())).getJson())));
+ ClientSendMessageEvents.CHAT.register(message -> {
+ if (message.startsWith("/")) {
+ System.out.println("Sent command: " + message);
+ }
+ });
+ }
+}
diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java b/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java
new file mode 100644
index 0000000..6cb206d
--- /dev/null
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java
@@ -0,0 +1,55 @@
+package de.hype.bbsentials.fabric;
+
+import de.hype.bbsentials.common.chat.Message;
+import net.fabricmc.loader.api.FabricLoader;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.sound.PositionedSoundInstance;
+import net.minecraft.entity.effect.StatusEffectInstance;
+import net.minecraft.entity.effect.StatusEffects;
+import net.minecraft.sound.SoundEvent;
+import net.minecraft.text.Text;
+
+import java.io.File;
+
+public class MCUtils {
+ public static boolean isWindowFocused() {
+ return MinecraftClient.getInstance().isWindowFocused();
+ }
+
+ public static File getConfigPath() {
+ return FabricLoader.getInstance().getConfigDir().toFile();
+ }
+
+ public static String getUsername() {
+ return MinecraftClient.getInstance().player.getName().getString();
+ }
+
+ public static String getMCUUID() {
+ return MinecraftClient.getInstance().player.getUuid().toString();
+ }
+
+ public static void sendChatMessage(String message) {
+ MinecraftClient.getInstance().getNetworkHandler().sendChatMessage(message);
+ }
+ public static void playsound(SoundEvent event) {
+ MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance
+ .master(event, 1.0F, 1.0F));
+ }
+ public static void sendClientSideMessage(Message message) {
+ MinecraftClient client = MinecraftClient.getInstance();
+ if (client.player != null) {
+ client.player.sendMessage(Text.Serializer.fromJson(message.getJson()));
+ }
+ }
+
+ public static int getPotTime() {
+ int remainingDuration = 0;
+ StatusEffectInstance potTimeRequest = MinecraftClient.getInstance().player.getStatusEffect(StatusEffects.STRENGTH);
+ if (potTimeRequest != null) {
+ if (potTimeRequest.getAmplifier() >= 7) {
+ remainingDuration = (int) (potTimeRequest.getDuration() / 20.0);
+ }
+ }
+ return remainingDuration;
+ }
+}
diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/ModInitialiser.java b/fabric/src/main/java/de/hype/bbsentials/fabric/ModInitialiser.java
new file mode 100644
index 0000000..ed8c622
--- /dev/null
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/ModInitialiser.java
@@ -0,0 +1,14 @@
+package de.hype.bbsentials.fabric;
+
+import de.hype.bbsentials.common.client.BBsentials;
+import net.fabricmc.api.ClientModInitializer;
+import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
+
+public class ModInitialiser implements ClientModInitializer {
+ @Override
+ public void onInitializeClient() {
+ ClientPlayConnectionEvents.JOIN.register((a, b, c) -> {
+ BBsentials.onServerSwap();
+ });
+ }
+}
diff --git a/src/main/java/de/hype/bbsentials/client/ModMenueScreen.java b/fabric/src/main/java/de/hype/bbsentials/fabric/ModMenueScreen.java
index 30bc74a..9adfe26 100644
--- a/src/main/java/de/hype/bbsentials/client/ModMenueScreen.java
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/ModMenueScreen.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.client;
+package de.hype.bbsentials.fabric;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
diff --git a/src/main/java/de/hype/bbsentials/api/Options.java b/fabric/src/main/java/de/hype/bbsentials/fabric/Options.java
index 7dc4b0d..3cf9e93 100644
--- a/src/main/java/de/hype/bbsentials/api/Options.java
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/Options.java
@@ -1,5 +1,6 @@
-package de.hype.bbsentials.api;
+package de.hype.bbsentials.fabric;
+import de.hype.bbsentials.common.api.ISimpleOption;
import net.minecraft.client.MinecraftClient;
public class Options{
diff --git a/src/main/java/de/hype/bbsentials/mixins/ClientCommandSourceMixin.java b/fabric/src/main/java/de/hype/bbsentials/fabric/mixins/ClientCommandSourceMixin.java
index edbe487..c9871b8 100644
--- a/src/main/java/de/hype/bbsentials/mixins/ClientCommandSourceMixin.java
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/mixins/ClientCommandSourceMixin.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.mixins;
+package de.hype.bbsentials.fabric.mixins;
import com.google.common.collect.Lists;
import net.fabricmc.api.EnvType;
diff --git a/src/main/java/de/hype/bbsentials/mixins/ItemRendererMixin.java b/fabric/src/main/java/de/hype/bbsentials/fabric/mixins/ItemRendererMixin.java
index 177161f..0c6a2bb 100644
--- a/src/main/java/de/hype/bbsentials/mixins/ItemRendererMixin.java
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/mixins/ItemRendererMixin.java
@@ -1,6 +1,6 @@
-package de.hype.bbsentials.mixins;
+package de.hype.bbsentials.fabric.mixins;
-import de.hype.bbsentials.client.BBsentials;
+import de.hype.bbsentials.common.client.BBsentials;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.ItemRenderer;
diff --git a/src/main/java/de/hype/bbsentials/mixins/ScreenMixin.java b/fabric/src/main/java/de/hype/bbsentials/fabric/mixins/ScreenMixin.java
index e046e25..7d9e86b 100644
--- a/src/main/java/de/hype/bbsentials/mixins/ScreenMixin.java
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/mixins/ScreenMixin.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.mixins;
+package de.hype.bbsentials.fabric.mixins;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
diff --git a/src/main/java/de/hype/bbsentials/mixins/SimpleOptionMixin.java b/fabric/src/main/java/de/hype/bbsentials/fabric/mixins/SimpleOptionMixin.java
index 7444788..711ac09 100644
--- a/src/main/java/de/hype/bbsentials/mixins/SimpleOptionMixin.java
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/mixins/SimpleOptionMixin.java
@@ -1,6 +1,6 @@
-package de.hype.bbsentials.mixins;
+package de.hype.bbsentials.fabric.mixins;
-import de.hype.bbsentials.api.ISimpleOption;
+import de.hype.bbsentials.common.api.ISimpleOption;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.SimpleOption;
import org.spongepowered.asm.mixin.Final;
diff --git a/fabric/src/main/resources/assets/bbsentials/textures/item/splash_hub.png b/fabric/src/main/resources/assets/bbsentials/textures/item/splash_hub.png
new file mode 100644
index 0000000..7929d1a
--- /dev/null
+++ b/fabric/src/main/resources/assets/bbsentials/textures/item/splash_hub.png
Binary files differ
diff --git a/fabric/src/main/resources/assets/public_bbsentials_cert.crt b/fabric/src/main/resources/assets/public_bbsentials_cert.crt
new file mode 100644
index 0000000..723fc34
--- /dev/null
+++ b/fabric/src/main/resources/assets/public_bbsentials_cert.crt
Binary files differ
diff --git a/fabric/src/main/resources/bbsentials.mixins.json b/fabric/src/main/resources/bbsentials.mixins.json
new file mode 100644
index 0000000..4467110
--- /dev/null
+++ b/fabric/src/main/resources/bbsentials.mixins.json
@@ -0,0 +1,16 @@
+{
+ "required": true,
+ "minVersion": "0.8",
+ "package": "de.hype.bbsentials.mixins",
+ "compatibilityLevel": "JAVA_8",
+ "mixins": [],
+ "client": [
+ "de.hype.bbsentials.common.mixins.ClientCommandSourceMixin",
+ "de.hype.bbsentials.common.mixins.ItemRendererMixin",
+ "de.hype.bbsentials.common.mixins.ScreenMixin",
+ "de.hype.bbsentials.common.mixins.SimpleOptionMixin"
+ ],
+ "injectors": {
+ "defaultRequire": 1
+ }
+} \ No newline at end of file
diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json
new file mode 100644
index 0000000..d296d7c
--- /dev/null
+++ b/fabric/src/main/resources/fabric.mod.json
@@ -0,0 +1,45 @@
+{
+ "schemaVersion": 1,
+ "id": "bbsentials",
+ "version": "${version}",
+ "name": "BBsentials",
+ "icon": "logo.png",
+ "description": "Mod to connect to the BBsentials Network for Splashes and more",
+ "authors": [
+ "Hype_the_Time/hackthetime"
+ ],
+ "contributors": ["hannibal2"],
+ "contact": {
+ "homepage": "https://github.com/HacktheTime/BBsentials1.20",
+ "issues": "https://github.com/HacktheTime/BBsentials1.20/issues",
+ "email": "s0844x76@duck.com",
+ "sources": "https://github.com/HacktheTime/BBsentials1.20"
+ },
+ "license": "Look on Github (Sources). a Modified \"CC BY-NC-ND 4.0\" License",
+ "environment": "client",
+ "entrypoints": {
+ "client": [
+ "de.hype.bbsentials.common.client.BBsentials"
+ ],
+ "modmenu": [
+ "de.hype.bbsentials.fabric.ModMenueScreen"
+ ]
+ },
+ "depends": {
+ "fabricloader": ">=${loader_version}",
+ "fabric": "*",
+ "minecraft": "${minecraft_version}"
+ },
+ "mixins": [
+ "bbsentials.mixins.json"
+ ],
+ "custom": {
+ "modmenu": {
+ "links": {
+ "License": "https://github.com/HacktheTime/BBsentials1.20/blob/master/LICENSE",
+ "modmenu.discord":"discord.gg/qr5mPRq8uG"
+ },
+ "update_checker": true
+ }
+ }
+} \ No newline at end of file
diff --git a/fabric/src/main/resources/logo.png b/fabric/src/main/resources/logo.png
new file mode 100644
index 0000000..407312a
--- /dev/null
+++ b/fabric/src/main/resources/logo.png
Binary files differ
diff --git a/fabric/src/main/resources/sounds/mixkit-gaming-lock-2848.wav b/fabric/src/main/resources/sounds/mixkit-gaming-lock-2848.wav
new file mode 100644
index 0000000..d079479
--- /dev/null
+++ b/fabric/src/main/resources/sounds/mixkit-gaming-lock-2848.wav
Binary files differ
diff --git a/fabric/src/main/resources/sounds/mixkit-interface-option-select-2573.wav b/fabric/src/main/resources/sounds/mixkit-interface-option-select-2573.wav
new file mode 100644
index 0000000..f118ac5
--- /dev/null
+++ b/fabric/src/main/resources/sounds/mixkit-interface-option-select-2573.wav
Binary files differ
diff --git a/fabric/src/main/resources/sounds/mixkit-long-pop-2358.wav b/fabric/src/main/resources/sounds/mixkit-long-pop-2358.wav
new file mode 100644
index 0000000..4bed79a
--- /dev/null
+++ b/fabric/src/main/resources/sounds/mixkit-long-pop-2358.wav
Binary files differ
diff --git a/fabric/src/main/resources/sounds/mixkit-sci-fi-click-900.wav b/fabric/src/main/resources/sounds/mixkit-sci-fi-click-900.wav
new file mode 100644
index 0000000..582445e
--- /dev/null
+++ b/fabric/src/main/resources/sounds/mixkit-sci-fi-click-900.wav
Binary files differ
diff --git a/fabric/src/main/resources/sounds/mixkit-sci-fi-confirmation-914.wav b/fabric/src/main/resources/sounds/mixkit-sci-fi-confirmation-914.wav
new file mode 100644
index 0000000..37800c9
--- /dev/null
+++ b/fabric/src/main/resources/sounds/mixkit-sci-fi-confirmation-914.wav
Binary files differ
diff --git a/settings.gradle b/settings.gradle
index f91a4fe..23692cb 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -7,3 +7,4 @@ pluginManagement {
gradlePluginPortal()
}
}
+include("common","fabric")
diff --git a/src/main/resources/bbsentials.mixins.json b/src/main/resources/bbsentials.mixins.json
deleted file mode 100644
index 82a341e..0000000
--- a/src/main/resources/bbsentials.mixins.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "required": true,
- "minVersion": "0.8",
- "package": "de.hype.bbsentials.mixins",
- "compatibilityLevel": "JAVA_8",
- "mixins": [],
- "client": [
- "ClientCommandSourceMixin",
- "ItemRendererMixin",
- "ScreenMixin",
- "SimpleOptionMixin"
- ],
- "injectors": {
- "defaultRequire": 1
- }
-} \ No newline at end of file