diff options
author | hackthetime <l4bg0jb7@duck.com> | 2023-09-15 13:34:45 +0200 |
---|---|---|
committer | hackthetime <l4bg0jb7@duck.com> | 2023-09-15 13:34:45 +0200 |
commit | 32b5cdf7b7628164a795258559a7ce9c63911295 (patch) | |
tree | 392ee50c7f66c70c92a46b85ae5ec788aaa05cf0 /src/main/java/de/hype/bbsentials | |
parent | 9616b434745f6a0f5bedc0c8145e9e7e214b3cf3 (diff) | |
download | BBsentials-32b5cdf7b7628164a795258559a7ce9c63911295.tar.gz BBsentials-32b5cdf7b7628164a795258559a7ce9c63911295.tar.bz2 BBsentials-32b5cdf7b7628164a795258559a7ce9c63911295.zip |
started working on Mod Menu Config Screen.
Missing Configuration still atm. if its not running unset the entry point mod menue in the fabric.mod.json
Diffstat (limited to 'src/main/java/de/hype/bbsentials')
24 files changed, 75 insertions, 59 deletions
diff --git a/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java b/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java new file mode 100644 index 0000000..82a5155 --- /dev/null +++ b/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java @@ -0,0 +1,9 @@ +package de.hype.bbsentials.client; + +import net.minecraft.client.gui.screen.Screen; + +public class BBsentialsConfigScreemFactory { + public static Screen create(Screen parent) { + return parent; + } +} diff --git a/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java b/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java index e1f3141..3cb139b 100644 --- a/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java +++ b/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java @@ -166,7 +166,7 @@ public class CommandsOLD { int z = IntegerArgumentType.getInteger(context, "Z"); String contactWay = StringArgumentType.getString(context, "ContactWay"); - bbserver.sendPacket(new ChChestPackage("", ChChestItems.getItem(item.split(";")), x + "" + y + "" + z, contactWay, "")); + bbserver.sendPacket(new ChChestPacket("", ChChestItems.getItem(item.split(";")), x + "" + y + "" + z, contactWay, "")); return 1; } ) diff --git a/src/main/java/de/hype/bbsentials/client/ModMenueScreen.java b/src/main/java/de/hype/bbsentials/client/ModMenueScreen.java new file mode 100644 index 0000000..64de624 --- /dev/null +++ b/src/main/java/de/hype/bbsentials/client/ModMenueScreen.java @@ -0,0 +1,20 @@ +package de.hype.bbsentials.client; + +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import com.terraformersmc.modmenu.api.ModMenuApi; +import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.NoticeScreen; +import net.minecraft.text.Text; + +public class ModMenueScreen implements ModMenuApi { + public class CITResewnModMenu implements ModMenuApi { + @Override + public ConfigScreenFactory<?> getModConfigScreenFactory() { + if (FabricLoader.getInstance().isModLoaded("cloth-config2")) + return BBsentialsConfigScreemFactory::create; + + return parent -> new NoticeScreen(() -> MinecraftClient.getInstance().setScreen(parent), Text.of("CIT Resewn"), Text.of("CIT Resewn requires Cloth Config to be able to show the config.")); + } + } +} diff --git a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java index c5f896e..c5ca6b8 100644 --- a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java +++ b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java @@ -50,7 +50,7 @@ public class BBsentialConnection { } } - public void onChChestPackage(ChChestPackage packet) { + public void onChChestPackage(ChChestPacket packet) { if (isCommandSafe(packet.bbcommand)) { String tellrawText = ("{\"text\":\"BB: @username found @item in a chest at (@coords). Click here to get a party invite @extramessage\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"@inviteCommand\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"On clicking you will get invited to a party. Command executed: @inviteCommand\"]}}"); tellrawText = tellrawText.replace("@username", packet.announcerUsername).replace("@item", Arrays.stream(packet.items).map(ChChestItem::getDisplayName).toList().toString()).replace("@coords", packet.locationCoords).replace("@inviteCommand", packet.bbcommand); diff --git a/src/main/java/de/hype/bbsentials/constants/annotations/BBSelectableChChestPingRole.java b/src/main/java/de/hype/bbsentials/constants/annotations/BBSelectableChChestPingRole.java deleted file mode 100644 index 35d7470..0000000 --- a/src/main/java/de/hype/bbsentials/constants/annotations/BBSelectableChChestPingRole.java +++ /dev/null @@ -1,11 +0,0 @@ -package de.hype.bbsentials.constants.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface BBSelectableChChestPingRole { -} diff --git a/src/main/java/de/hype/bbsentials/constants/annotations/BBSelectableMiningEventPingRole.java b/src/main/java/de/hype/bbsentials/constants/annotations/BBSelectableMiningEventPingRole.java deleted file mode 100644 index 8e2e503..0000000 --- a/src/main/java/de/hype/bbsentials/constants/annotations/BBSelectableMiningEventPingRole.java +++ /dev/null @@ -1,11 +0,0 @@ -package de.hype.bbsentials.constants.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface BBSelectableMiningEventPingRole { -} diff --git a/src/main/java/de/hype/bbsentials/constants/annotations/BBSelectableRole.java b/src/main/java/de/hype/bbsentials/constants/annotations/BBSelectableRole.java deleted file mode 100644 index 8597cbc..0000000 --- a/src/main/java/de/hype/bbsentials/constants/annotations/BBSelectableRole.java +++ /dev/null @@ -1,12 +0,0 @@ -package de.hype.bbsentials.constants.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface BBSelectableRole { - -} diff --git a/src/main/java/de/hype/bbsentials/constants/enviromentShared/EnumUtils.java b/src/main/java/de/hype/bbsentials/constants/enviromentShared/EnumUtils.java index 8407774..fba8ff2 100644 --- a/src/main/java/de/hype/bbsentials/constants/enviromentShared/EnumUtils.java +++ b/src/main/java/de/hype/bbsentials/constants/enviromentShared/EnumUtils.java @@ -1,6 +1,5 @@ package de.hype.bbsentials.constants.enviromentShared; - import de.hype.bbsentials.constants.BBDisplayNameProvider; import de.hype.bbsentials.constants.BBDisplayNameProviderWithCustom; diff --git a/src/main/java/de/hype/bbsentials/constants/enviromentShared/Islands.java b/src/main/java/de/hype/bbsentials/constants/enviromentShared/Islands.java index f03c8ae..105e0c2 100644 --- a/src/main/java/de/hype/bbsentials/constants/enviromentShared/Islands.java +++ b/src/main/java/de/hype/bbsentials/constants/enviromentShared/Islands.java @@ -34,6 +34,4 @@ public enum Islands implements BBDisplayNameProvider { public String getDisplayName() { return displayName; } - - } diff --git a/src/main/java/de/hype/bbsentials/constants/enviromentShared/MiningEvents.java b/src/main/java/de/hype/bbsentials/constants/enviromentShared/MiningEvents.java index 1dc72d1..7ef4289 100644 --- a/src/main/java/de/hype/bbsentials/constants/enviromentShared/MiningEvents.java +++ b/src/main/java/de/hype/bbsentials/constants/enviromentShared/MiningEvents.java @@ -1,6 +1,5 @@ package de.hype.bbsentials.constants.enviromentShared; - import de.hype.bbsentials.constants.BBDisplayNameProvider; // Mining Events diff --git a/src/main/java/de/hype/bbsentials/packets/PacketManager.java b/src/main/java/de/hype/bbsentials/packets/PacketManager.java index a6d94d4..03d25ed 100644 --- a/src/main/java/de/hype/bbsentials/packets/PacketManager.java +++ b/src/main/java/de/hype/bbsentials/packets/PacketManager.java @@ -25,7 +25,7 @@ public class PacketManager { public static void initializePacketActions(BBsentialConnection connection) { packets.add(new Packet<>(SplashNotifyPacket.class, connection::onSplashNotify)); packets.add(new Packet<>(BingoChatMessagePacket.class, connection::onBingoChatMessagePacket)); - packets.add(new Packet<>(ChChestPackage.class, connection::onChChestPackage)); + packets.add(new Packet<>(ChChestPacket.class, connection::onChChestPackage)); // packets.add(new Packet<>(DisconnectPacket.class, connection::dummy)); // packets.add(new Packet<>(InternalCommandPacket.class, connection::dummy)); packets.add(new Packet<>(MiningEventPacket.class, connection::onMiningEventPacket)); diff --git a/src/main/java/de/hype/bbsentials/packets/packets/BroadcastMessagePacket.java b/src/main/java/de/hype/bbsentials/packets/packets/BroadcastMessagePacket.java index 2e507c7..aa0cb89 100644 --- a/src/main/java/de/hype/bbsentials/packets/packets/BroadcastMessagePacket.java +++ b/src/main/java/de/hype/bbsentials/packets/packets/BroadcastMessagePacket.java @@ -1,5 +1,6 @@ package de.hype.bbsentials.packets.packets; + import de.hype.bbsentials.packets.AbstractPacket; public class BroadcastMessagePacket extends AbstractPacket { diff --git a/src/main/java/de/hype/bbsentials/packets/packets/ChChestPackage.java b/src/main/java/de/hype/bbsentials/packets/packets/ChChestPacket.java index e2252e8..4519b66 100644 --- a/src/main/java/de/hype/bbsentials/packets/packets/ChChestPackage.java +++ b/src/main/java/de/hype/bbsentials/packets/packets/ChChestPacket.java @@ -1,12 +1,11 @@ package de.hype.bbsentials.packets.packets; - -import de.hype.bbsentials.constants.enviromentShared.ChChestItem; import de.hype.bbsentials.packets.AbstractPacket; +import de.hype.bbsentials.constants.enviromentShared.ChChestItem; -public class ChChestPackage extends AbstractPacket { +public class ChChestPacket extends AbstractPacket { - public ChChestPackage(String announcerUsername, ChChestItem[] items, String locationCoords, String bbcommand, String extraMessage) { + public ChChestPacket(String announcerUsername, ChChestItem[] items, String locationCoords, String bbcommand, String extraMessage) { super(1, 1); //Min and Max supported Version this.announcerUsername = announcerUsername; this.locationCoords = locationCoords; diff --git a/src/main/java/de/hype/bbsentials/packets/packets/DisconnectPacket.java b/src/main/java/de/hype/bbsentials/packets/packets/DisconnectPacket.java index 4a37693..ab04d1a 100644 --- a/src/main/java/de/hype/bbsentials/packets/packets/DisconnectPacket.java +++ b/src/main/java/de/hype/bbsentials/packets/packets/DisconnectPacket.java @@ -1,18 +1,19 @@ package de.hype.bbsentials.packets.packets; - import de.hype.bbsentials.packets.AbstractPacket; +import de.hype.bbsentials.constants.enviromentShared.InternalReasonConstants; public class DisconnectPacket extends AbstractPacket { - public DisconnectPacket(String internalReason, int[] waitBeforeReconnect, String displayReason, String displayMessage) { + public DisconnectPacket(InternalReasonConstants internalReason, int[] waitBeforeReconnect, String displayReason, String displayMessage) { super(1, 1); //Min and Max supportet Version this.internalReason = internalReason; this.waitBeforeReconnect = waitBeforeReconnect; this.displayReason = displayReason; this.displayMessage = displayMessage; } - public final String internalReason; + + public final InternalReasonConstants internalReason; public final int[] waitBeforeReconnect; public final String displayReason; public final String displayMessage; diff --git a/src/main/java/de/hype/bbsentials/packets/packets/DisplayMessagePacket.java b/src/main/java/de/hype/bbsentials/packets/packets/DisplayMessagePacket.java index da99a99..9774f38 100644 --- a/src/main/java/de/hype/bbsentials/packets/packets/DisplayMessagePacket.java +++ b/src/main/java/de/hype/bbsentials/packets/packets/DisplayMessagePacket.java @@ -1,6 +1,5 @@ package de.hype.bbsentials.packets.packets; - import de.hype.bbsentials.packets.AbstractPacket; public class DisplayMessagePacket extends AbstractPacket { diff --git a/src/main/java/de/hype/bbsentials/packets/packets/DisplayTellrawMessagePacket.java b/src/main/java/de/hype/bbsentials/packets/packets/DisplayTellrawMessagePacket.java index 9329878..b0580e5 100644 --- a/src/main/java/de/hype/bbsentials/packets/packets/DisplayTellrawMessagePacket.java +++ b/src/main/java/de/hype/bbsentials/packets/packets/DisplayTellrawMessagePacket.java @@ -1,6 +1,5 @@ package de.hype.bbsentials.packets.packets; - import de.hype.bbsentials.packets.AbstractPacket; public class DisplayTellrawMessagePacket extends AbstractPacket { diff --git a/src/main/java/de/hype/bbsentials/packets/packets/InternalCommandPacket.java b/src/main/java/de/hype/bbsentials/packets/packets/InternalCommandPacket.java index cf8c8f7..077e3d4 100644 --- a/src/main/java/de/hype/bbsentials/packets/packets/InternalCommandPacket.java +++ b/src/main/java/de/hype/bbsentials/packets/packets/InternalCommandPacket.java @@ -1,6 +1,5 @@ package de.hype.bbsentials.packets.packets; - import de.hype.bbsentials.packets.AbstractPacket; //Only used for small things which don't really need an own Packet. diff --git a/src/main/java/de/hype/bbsentials/packets/packets/InvalidCommandFeedbackPacket.java b/src/main/java/de/hype/bbsentials/packets/packets/InvalidCommandFeedbackPacket.java index b57be4a..d1173ea 100644 --- a/src/main/java/de/hype/bbsentials/packets/packets/InvalidCommandFeedbackPacket.java +++ b/src/main/java/de/hype/bbsentials/packets/packets/InvalidCommandFeedbackPacket.java @@ -1,6 +1,5 @@ package de.hype.bbsentials.packets.packets; - import de.hype.bbsentials.packets.AbstractPacket; public class InvalidCommandFeedbackPacket extends AbstractPacket { diff --git a/src/main/java/de/hype/bbsentials/packets/packets/MiningEventPacket.java b/src/main/java/de/hype/bbsentials/packets/packets/MiningEventPacket.java index 5dd383f..ae2f436 100644 --- a/src/main/java/de/hype/bbsentials/packets/packets/MiningEventPacket.java +++ b/src/main/java/de/hype/bbsentials/packets/packets/MiningEventPacket.java @@ -1,9 +1,8 @@ package de.hype.bbsentials.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.packets.AbstractPacket; public class MiningEventPacket extends AbstractPacket { diff --git a/src/main/java/de/hype/bbsentials/packets/packets/PartyPacket.java b/src/main/java/de/hype/bbsentials/packets/packets/PartyPacket.java new file mode 100644 index 0000000..23325d9 --- /dev/null +++ b/src/main/java/de/hype/bbsentials/packets/packets/PartyPacket.java @@ -0,0 +1,16 @@ +package de.hype.bbsentials.packets.packets; + +import de.hype.bbsentials.packets.AbstractPacket; + +public class PartyPacket extends AbstractPacket { + + public PartyPacket(String type, String[] users) { + super(1, 1); //Min and Max supportet Version + this.type = type; + this.users = users; + } + + public final String type; + public final String[] users; + +} diff --git a/src/main/java/de/hype/bbsentials/packets/packets/RequestConnectPacket.java b/src/main/java/de/hype/bbsentials/packets/packets/RequestConnectPacket.java index 62bac83..6009de5 100644 --- a/src/main/java/de/hype/bbsentials/packets/packets/RequestConnectPacket.java +++ b/src/main/java/de/hype/bbsentials/packets/packets/RequestConnectPacket.java @@ -1,12 +1,11 @@ package de.hype.bbsentials.packets.packets; - import de.hype.bbsentials.packets.AbstractPacket; public class RequestConnectPacket extends AbstractPacket { - public RequestConnectPacket(String mcuuid, String key, int clientApiVersion, String authType ) { + public RequestConnectPacket(String mcuuid, String key, int clientApiVersion, String authType) { super(1, 1); //Min and Max supported Version this.mcuuid = mcuuid; this.key = key; diff --git a/src/main/java/de/hype/bbsentials/packets/packets/SplashNotifyPacket.java b/src/main/java/de/hype/bbsentials/packets/packets/SplashNotifyPacket.java index bfdc275..ab0076e 100644 --- a/src/main/java/de/hype/bbsentials/packets/packets/SplashNotifyPacket.java +++ b/src/main/java/de/hype/bbsentials/packets/packets/SplashNotifyPacket.java @@ -1,8 +1,7 @@ package de.hype.bbsentials.packets.packets; - -import de.hype.bbsentials.constants.enviromentShared.Islands; import de.hype.bbsentials.packets.AbstractPacket; +import de.hype.bbsentials.constants.enviromentShared.Islands; public class SplashNotifyPacket extends AbstractPacket { diff --git a/src/main/java/de/hype/bbsentials/packets/packets/SystemMessagePacket.java b/src/main/java/de/hype/bbsentials/packets/packets/SystemMessagePacket.java new file mode 100644 index 0000000..c8ba534 --- /dev/null +++ b/src/main/java/de/hype/bbsentials/packets/packets/SystemMessagePacket.java @@ -0,0 +1,16 @@ +package de.hype.bbsentials.packets.packets; + +import de.hype.bbsentials.packets.AbstractPacket; + +public class SystemMessagePacket extends AbstractPacket { + public final String message; + public final boolean important; + public final boolean ping; + + public SystemMessagePacket(String message, boolean important, boolean ping) { + super(1, 1); //Min and Max supported Version + this.message = message; + this.important = important; + this.ping = ping; + } +} diff --git a/src/main/java/de/hype/bbsentials/packets/packets/WelcomeClientPacket.java b/src/main/java/de/hype/bbsentials/packets/packets/WelcomeClientPacket.java index 4b2f7c3..f1c80b3 100644 --- a/src/main/java/de/hype/bbsentials/packets/packets/WelcomeClientPacket.java +++ b/src/main/java/de/hype/bbsentials/packets/packets/WelcomeClientPacket.java @@ -1,6 +1,5 @@ package de.hype.bbsentials.packets.packets; - import de.hype.bbsentials.packets.AbstractPacket; public class WelcomeClientPacket extends AbstractPacket { |