diff options
author | HacktheTime <l4bg0jb7@duck.com> | 2023-10-14 09:59:30 +0200 |
---|---|---|
committer | HacktheTime <l4bg0jb7@duck.com> | 2023-10-14 09:59:30 +0200 |
commit | 00732c91bd4b87954a85285292a90d32634ec053 (patch) | |
tree | c36a31537de52602dedc8f7e8658d0dd1ee9097f /forge/src/main/java | |
parent | 29ba70a5b682bbd430df1eb626a19422a6e08270 (diff) | |
download | BBsentials-00732c91bd4b87954a85285292a90d32634ec053.tar.gz BBsentials-00732c91bd4b87954a85285292a90d32634ec053.tar.bz2 BBsentials-00732c91bd4b87954a85285292a90d32634ec053.zip |
more changes
Diffstat (limited to 'forge/src/main/java')
13 files changed, 493 insertions, 51 deletions
diff --git a/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java b/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java new file mode 100644 index 0000000..a6b2a3e --- /dev/null +++ b/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java @@ -0,0 +1,66 @@ +package de.hype.bbsentials.forge; + +import com.google.common.collect.Lists; +import de.hype.bbsentials.common.constants.enviromentShared.Islands; +import de.hype.bbsentials.forge.chat.Chat; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.PlayerListEntry; + +import java.util.Iterator; +import java.util.List; + +public class BBUtils implements 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: ")) { + Chat.sendPrivateMessageToSelfError("Could not get Area data. Are you in Skyblock?"); + } + else { + return Islands.getByDisplayName(string.replace("Area: ", "").trim()); + } + } catch (Exception e) { + } + return null; + } + + public int getPlayerCount() { + return Integer.parseInt(MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!B-a").getDisplayName().getString().trim().replaceAll("[^0-9]", "")); + } + + public String getServer() { + return MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!C-c").getDisplayName().getString().replace("Server:", "").trim(); + } + + public boolean isOnMegaServer() { + return getServer().toLowerCase().startsWith("mega"); + } + + public boolean isOnMiniServer() { + return getServer().toLowerCase().startsWith("mini"); + } + + public int getMaximumPlayerCount() { + boolean mega = isOnMegaServer(); + Islands island = getCurrentIsland(); + if (island == null) return 100; + if (island.equals(Islands.HUB)) { + if (mega) return 80; + else return 24; + } + return 24; + } + + public List<String> getPlayers() { + List<String> list = Lists.newArrayList(); + Iterator var2 = MinecraftClient.getInstance().getNetworkHandler().getPlayerList().iterator(); + while (var2.hasNext()) { + PlayerListEntry playerListEntry = (PlayerListEntry) var2.next(); + String playerName = playerListEntry.getProfile().getName(); + if (!playerName.startsWith("!")) { + list.add(playerName); + } + } + return list; + } +} diff --git a/forge/src/main/java/de/hype/bbsentials/forge/Commands.java b/forge/src/main/java/de/hype/bbsentials/forge/Commands.java new file mode 100644 index 0000000..a5af004 --- /dev/null +++ b/forge/src/main/java/de/hype/bbsentials/forge/Commands.java @@ -0,0 +1,313 @@ +package de.hype.bbsentials.forge; + +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.arguments.IntegerArgumentType; +import com.mojang.brigadier.arguments.StringArgumentType; +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.mclibraries.EnvironmentCore; +import de.hype.bbsentials.common.mclibraries.MCCommand; +import de.hype.bbsentials.common.packets.AbstractPacket; +import de.hype.bbsentials.forge.chat.Chat; +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; +import net.fabricmc.fabric.api.event.Event; +import net.minecraft.command.CommandSource; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +public class Commands implements MCCommand { + Event<ClientCommandRegistrationCallback> event = ClientCommandRegistrationCallback.EVENT; + public void registerMain(){ + event.register((dispatcher, registryAccess) -> { + dispatcher.register(ClientCommandManager.literal("creport") + .then(ClientCommandManager.argument("Player_Name", StringArgumentType.string()) + .executes((context) -> { + String playerName = StringArgumentType.getString(context, "Player_Name"); + BBsentials.getConfig().sender.addSendTask("/creport " + playerName, 0); + BBsentials.getConfig().addReported(playerName); + return 1; + }))); + });//creport helper → no double report during same launch + event.register((dispatcher, registryAccess) -> { + miningEvent(dispatcher, "goblinraid", MiningEvents.GOBLIN_RAID); + });/*goblinraid*/ + event.register((dispatcher, registryAccess) -> { + miningEvent(dispatcher, "2xpowder", MiningEvents.DOUBLE_POWDER); + });/*2xpowder*/ + event.register((dispatcher, registryAccess) -> { + miningEvent(dispatcher, "bettertogether", MiningEvents.BETTER_TOGETHER); + });/*b2g*/ + event.register((dispatcher, registryAccess) -> { + miningEvent(dispatcher, "raffle", MiningEvents.RAFFLE); + });/*raffle*/ + event.register((dispatcher, registryAccess) -> { + miningEvent(dispatcher, "gonewiththewind", MiningEvents.GONE_WITH_THE_WIND); + });/*gonewiththewind*/ + event.register((dispatcher, registryAccess) -> { + miningEvent(dispatcher, "mithrilgourmand", MiningEvents.MITHRIL_GOURMAND); + });/*gonewiththewind*/ + event.register((dispatcher, registryAccess) -> { + dispatcher.register(ClientCommandManager.literal("chchest") + .then(ClientCommandManager.argument("Item", StringArgumentType.string()) + .suggests((context, builder) -> { + String[] items = new String[]{"PrehistoricEgg", "Pickonimbus2000", "ElectronTransmitter", "FTX3070", "RobotronReflector", "ControlSwitch", "SyntheticHeart", "SuperliteMotor", "BlueGoblinEgg", "YellowGoblinEgg", "FlawlessAmberGemstone", "FlawlessJadeGemstone", "FlawlessSapphireGemstone", "FlawlessRubyGemstone", "FlawlessAmethystGemstone", "JungleHeart", "FlawlessTopazGemstone", "FlawlessJasperGemstone"}; + String input = builder.getRemaining().toLowerCase(); + int lastSemicolonIndex = input.lastIndexOf(";"); + List<String> suggestions = new ArrayList<>(); + if (lastSemicolonIndex >= 0) { + String inputBeforeSemicolon = input.substring(0, lastSemicolonIndex + 1); // Include the semicolon + + for (String item : items) { + suggestions.add(inputBeforeSemicolon + item); + } + } + return CommandSource.suggestMatching(suggestions, builder); + }) + .then(ClientCommandManager.argument("X", IntegerArgumentType.integer()) + .then(ClientCommandManager.argument("Y", IntegerArgumentType.integer()) + .then(ClientCommandManager.argument("Z", IntegerArgumentType.integer()) + .then(ClientCommandManager.argument("ContactWay", StringArgumentType.string()) + .suggests(((context, 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"); + int x = IntegerArgumentType.getInteger(context, "X"); + int y = IntegerArgumentType.getInteger(context, "Y"); + int z = IntegerArgumentType.getInteger(context, "Z"); + String contactWay = StringArgumentType.getString(context, "ContactWay"); + + sendPacket(new ChChestPacket("", ChChestItems.getItem(item.split(";")), x + " " + y + " " + z, contactWay, "")); + return 1; + } + ) + ) + ) + ) + ) + ) + ); + });/*chchest*/ + event.register((dispatcher, registryAccess) -> { + dispatcher.register( + ClientCommandManager.literal("bc") + .then(ClientCommandManager.argument("Message to Bingo Chat", StringArgumentType.greedyString()) + .executes((context) -> { + String message = StringArgumentType.getString(context, "Message to Bingo Chat"); + sendPacket(new BingoChatMessagePacket("", "", message, 0)); + return 1; + }) + ) + ); + });/*BincoChatShort*/ + event.register((dispatcher, registryAccess) -> { + dispatcher.register( + ClientCommandManager.literal("bingochat") + .then(ClientCommandManager.argument("Message to Bingo Chat", StringArgumentType.greedyString()) + .executes((context) -> { + String message = StringArgumentType.getString(context, "Message to Bingo Chat"); + sendPacket(new BingoChatMessagePacket("", "", message, 0)); + return 1; + }) + ) + ); + });/*BingoChatLong*/ + } + + public void registerRoleRequired(boolean hasDev, boolean hasAdmin, boolean hasMod, boolean hasSplasher, boolean hasBeta, boolean hasMiningEvents, boolean hasChChest) { + if (hasMod) { + event.register((dispatcher, registryAccess) -> { + dispatcher.register( + ClientCommandManager.literal("bannounce") + .then(ClientCommandManager.argument("message", StringArgumentType.greedyString()) + .executes((context) -> { + String message = StringArgumentType.getString(context, "message"); + sendPacket(new BroadcastMessagePacket("","",message)); + return 1; + }) + ) + ); + });/*bAnnounce*/ + event.register((dispatcher, registryAccess) -> { + dispatcher.register(ClientCommandManager.literal("bmute") + .then(ClientCommandManager.argument("userId/mcusername", StringArgumentType.string()) + .then(ClientCommandManager.argument("[Duration(d/h/m/s) | 0 forever]", StringArgumentType.string()) + .then(ClientCommandManager.argument("reason", StringArgumentType.greedyString()) + .executes((context) -> { + String identification = StringArgumentType.getString(context, "userId/mcusername"); + String duration = StringArgumentType.getString(context, "[Duration(d/h/m/s) | 0 forever]"); + String reason = StringArgumentType.getString(context, "reason"); + int userId = -1; + String mcusername = ""; + if (identification.replaceAll("[\\d]", "").trim().isEmpty()) { + userId = Integer.parseInt(identification); + } + else { + mcusername = identification; + } + sendPacket(new PunishUserPacket(PunishUserPacket.PUNISHMENT_TYPE_MUTE, userId, mcusername, duration, reason)); + return 1; + }) + ) + ) + ) + ); + });/*bmute*/ + event.register((dispatcher, registryAccess) -> { + dispatcher.register(ClientCommandManager.literal("bban") + .then(ClientCommandManager.argument("userId/mcusername", StringArgumentType.string()) + .then(ClientCommandManager.argument("[Duration(d/h/m/s) | 0 forever]", StringArgumentType.string()) + .then(ClientCommandManager.argument("reason", StringArgumentType.greedyString()) + .executes((context) -> { + String identification = StringArgumentType.getString(context, "userId/mcusername"); + String duration = StringArgumentType.getString(context, "[Duration(d/h/m/s) | 0 forever]"); + String reason = StringArgumentType.getString(context, "reason"); + int userId = -1; + String mcusername = ""; + if (identification.replaceAll("[\\d]", "").trim().isEmpty()) { + userId = Integer.parseInt(identification); + } + else { + mcusername = identification; + } + sendPacket(new PunishUserPacket(PunishUserPacket.PUNISHMENT_TYPE_BAN, userId, mcusername, duration, reason)); + return 1; + }) + ) + ) + ) + ); + });/*ban*/ + event.register((dispatcher, registryAccess) -> { + dispatcher.register(ClientCommandManager.literal("bgetinfo") + .then(ClientCommandManager.argument("userId/mcusername", StringArgumentType.string()) + .executes((context) -> { + String identification = StringArgumentType.getString(context, "userId/mcusername"); + sendPacket(new InternalCommandPacket(InternalCommandPacket.GET_USER_INFO, new String[]{identification})); + return 1; + }) + ) + ); + });/*getInfo*/ + } + if (hasSplasher) { + event.register((dispatcher, registryAccess) -> { + dispatcher.register( + ClientCommandManager.literal("splashAnnounce") + .then(ClientCommandManager.argument("Hub", IntegerArgumentType.integer(1, 28)) + .then(ClientCommandManager.argument("location", StringArgumentType.string()) + .suggests((context, builder) -> { + return CommandSource.suggestMatching(new String[]{"kat", "bea", "guild-house"}, builder); + }) + .then(ClientCommandManager.argument("lasswaste", StringArgumentType.string()) + .suggests((context, builder) -> { + return CommandSource.suggestMatching(new String[]{"true", "false"}, builder); + }) + .then(ClientCommandManager.argument("extramessage", StringArgumentType.greedyString()) + .executes((context) -> { + int hub = IntegerArgumentType.getInteger(context, "Hub"); + String extramessage = StringArgumentType.getString(context, "extramessage"); + String location = StringArgumentType.getString(context, "location"); + boolean lessWaste = Boolean.parseBoolean(StringArgumentType.getString(context, "lasswaste")); + splashAnnounce(hub, location, extramessage, lessWaste); + return 1; + }) + ) + .executes((context) -> { + int hub = IntegerArgumentType.getInteger(context, "Hub"); + String location = StringArgumentType.getString(context, "location"); + boolean lessWaste = Boolean.parseBoolean(StringArgumentType.getString(context, "lasswaste")); + splashAnnounce(hub, location, "", lessWaste); + return 1; + }) + )) + .executes((context) -> { + int hub = IntegerArgumentType.getInteger(context, "Hub"); + String location = "bea"; + splashAnnounce(hub, location, "", true); + return 1; + }) + + ) + ); + });/*SplashAnnounce*/ + event.register((dispatcher, registryAccess) -> { + dispatcher.register( + ClientCommandManager.literal("requestpottimes") + .executes((context) -> { + sendPacket(new InternalCommandPacket(InternalCommandPacket.REQUEST_POT_DURATION, new String[0])); + return 1; + }) + ); + });/*requestpottimes*/ + } + if (hasAdmin) { + event.register((dispatcher, registryAccess) -> { + dispatcher.register( + ClientCommandManager.literal("bshutdown") + .then(ClientCommandManager.argument("Reason", StringArgumentType.greedyString()) + .suggests((context, builder) -> { + return CommandSource.suggestMatching(new String[]{"Emergency Shutdown", "System Shutdown", "Other"}, builder); + }) + .executes((context) -> { + String reason = StringArgumentType.getString(context, "Reason"); + sendPacket(new InternalCommandPacket(InternalCommandPacket.SHUTDOWN_SERVER, new String[]{reason})); + return 1; + }) + ) + ); + });/*BBShutdown*/ + event.register((dispatcher, registryAccess) -> { + dispatcher.register( + ClientCommandManager.literal("bsetmotd") + .then(ClientCommandManager.argument("Message", StringArgumentType.greedyString()) + .suggests((context, builder) -> { + return CommandSource.suggestMatching(new String[]{""}, builder); + }) + .executes((context) -> { + String message = StringArgumentType.getString(context, "Message").trim(); + sendPacket(new InternalCommandPacket(InternalCommandPacket.SET_MOTD, new String[]{message})); + return 1; + }) + ) + ); + });/*BBServerMotd*/ + } + } + + private static void simpleCommand(CommandDispatcher<FabricClientCommandSource> dispatcher, String commandName, String[] parameters) { + dispatcher.register( + ClientCommandManager.literal(commandName) + .executes((context) -> { + sendPacket(new InternalCommandPacket(commandName, parameters)); + return 1; + }) + ); + } + + private static void miningEvent(CommandDispatcher<FabricClientCommandSource> dispatcher, String commandName, MiningEvents event) { + dispatcher.register( + ClientCommandManager.literal(commandName) + .executes((context) -> { + try { + sendPacket(new MiningEventPacket(event, + BBsentials.config.getUsername(), Objects.requireNonNull(EnvironmentCore.utils.getCurrentIsland()))); + } catch (Exception e) { + Chat.sendPrivateMessageToSelfError(e.getMessage()); + } + return 1; + }) + ); + } + public static <T extends AbstractPacket> void sendPacket(T packet){ + BBsentials.connection.sendPacket(packet); + } + public void splashAnnounce(int hubNumber, String locationInHub, String extramessage, boolean lessWaste) { + sendPacket(new SplashNotifyPacket(0, hubNumber, BBsentials.config.getUsername(), locationInHub, EnvironmentCore.utils.getCurrentIsland(), extramessage, lessWaste)); + } +} diff --git a/forge/src/main/java/de/hype/bbsentials/forge/DebugThread.java b/forge/src/main/java/de/hype/bbsentials/forge/DebugThread.java new file mode 100644 index 0000000..23f4db8 --- /dev/null +++ b/forge/src/main/java/de/hype/bbsentials/forge/DebugThread.java @@ -0,0 +1,15 @@ +package de.hype.bbsentials.forge; + +import java.util.List; + +public class DebugThread implements de.hype.bbsentials.common.client.DebugThread { + @Override + public void loop() { + + } + + @Override + public List<String> test() { + return List.of(""); + } +} diff --git a/forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java b/forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java index 9a118a1..4043ba1 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java @@ -1,6 +1,6 @@ package de.hype.bbsentials.forge; -import de.hype.bbsentials.forge.client.BBsentials; +import de.hype.bbsentials.common.client.BBsentials; import de.hype.bbsentials.forge.client.CommandBBI; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.common.MinecraftForge; @@ -8,7 +8,6 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - @Mod(modid = "bbsentials", useMetadata = true) public class ExampleMod { static boolean alreadyInialised = false; @@ -29,8 +28,8 @@ public class ExampleMod { @SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent event) { - clientSetup(); - MinecraftForge.EVENT_BUS.unregister(this); + EnvironmentCore core = new EnvironmentCore(new BBUtils(), new FabricChat(), new MCUtils(), new Commands(), new Options(), new DebugThread()); + BBsentials.(); } } diff --git a/forge/src/main/java/de/hype/bbsentials/forge/FabricChat.java b/forge/src/main/java/de/hype/bbsentials/forge/FabricChat.java new file mode 100644 index 0000000..f25f4ad --- /dev/null +++ b/forge/src/main/java/de/hype/bbsentials/forge/FabricChat.java @@ -0,0 +1,37 @@ +package de.hype.bbsentials.forge; + +import de.hype.bbsentials.common.chat.Message; +import de.hype.bbsentials.common.mclibraries.MCChat; +import de.hype.bbsentials.forge.chat.Chat; +import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents; +import net.fabricmc.fabric.api.client.message.v1.ClientSendMessageEvents; +import net.minecraft.client.MinecraftClient; +import net.minecraft.text.Text; + +public class FabricChat implements MCChat { + public FabricChat() { + init(); + } + public Chat chat = new Chat(); + public 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); + } + }); + } + public void sendClientSideMessage(Message message) { + MinecraftClient client = MinecraftClient.getInstance(); + if (client.player != null) { + client.player.sendMessage(Text.Serializer.fromJson(message.getJson())); + } + } + public void sendChatMessage(String message) { + MinecraftClient.getInstance().getNetworkHandler().sendChatMessage(message); + } +} diff --git a/forge/src/main/java/de/hype/bbsentials/forge/MCUtils.java b/forge/src/main/java/de/hype/bbsentials/forge/MCUtils.java new file mode 100644 index 0000000..0a0800b --- /dev/null +++ b/forge/src/main/java/de/hype/bbsentials/forge/MCUtils.java @@ -0,0 +1,45 @@ +package de.hype.bbsentials.forge; + +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.util.Identifier; + +import java.io.File; + +public class MCUtils implements de.hype.bbsentials.common.mclibraries.MCUtils { + public boolean isWindowFocused() { + return MinecraftClient.getInstance().isWindowFocused(); + } + + public File getConfigPath() { + return FabricLoader.getInstance().getConfigDir().toFile(); + } + + public String getUsername() { + return MinecraftClient.getInstance().player.getName().getString(); + } + + public String getMCUUID() { + return MinecraftClient.getInstance().player.getUuid().toString(); + } + + + public void playsound(String eventName) { + MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance + .master(SoundEvent.of(new Identifier(eventName)), 1.0F, 1.0F)); + } + public 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/forge/src/main/java/de/hype/bbsentials/forge/Options.java b/forge/src/main/java/de/hype/bbsentials/forge/Options.java new file mode 100644 index 0000000..bdf0861 --- /dev/null +++ b/forge/src/main/java/de/hype/bbsentials/forge/Options.java @@ -0,0 +1,14 @@ +package de.hype.bbsentials.forge; + +import de.hype.bbsentials.common.api.ISimpleOption; +import net.minecraft.client.MinecraftClient; + +public class Options implements de.hype.bbsentials.common.mclibraries.Options { + public void setFov(int value) { + ((ISimpleOption) (Object) MinecraftClient.getInstance().options.getFov()).set(value); + } + public void setGamma(double value) { + ((ISimpleOption) (Object) MinecraftClient.getInstance().options.getGamma()).set(value); + } +} + diff --git a/forge/src/main/java/de/hype/bbsentials/forge/Temphook.java b/forge/src/main/java/de/hype/bbsentials/forge/Temphook.java index 9b0ce86..8441624 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/Temphook.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/Temphook.java @@ -1,6 +1,5 @@ package de.hype.bbsentials.forge; -import de.hype.bbsentials.forge.client.BBsentials; import net.minecraft.client.gui.FontRenderer; import net.minecraft.item.ItemStack; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; diff --git a/forge/src/main/java/de/hype/bbsentials/forge/chat/Chat.java b/forge/src/main/java/de/hype/bbsentials/forge/chat/Chat.java index ec81c52..6b12ba1 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/chat/Chat.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/chat/Chat.java @@ -1,6 +1,5 @@ package de.hype.bbsentials.forge.chat; -import de.hype.bbsentials.forge.client.BBsentials; import de.hype.bbsentials.forge.client.Config; import net.minecraft.client.Minecraft; import net.minecraft.util.ChatComponentText; diff --git a/forge/src/main/java/de/hype/bbsentials/forge/client/BBsentials.java b/forge/src/main/java/de/hype/bbsentials/forge/client/BBsentials.java deleted file mode 100644 index 87dc13b..0000000 --- a/forge/src/main/java/de/hype/bbsentials/forge/client/BBsentials.java +++ /dev/null @@ -1,42 +0,0 @@ -package de.hype.bbsentials.forge.client; - -import de.hype.bbsentials.forge.chat.Chat; -import de.hype.bbsentials.forge.client.Commands.CommandsOLD; -import de.hype.bbsentials.forge.communication.BBsentialConnection; - - -public class BBsentials { - private boolean initialised = false; - public static Config config; - public static BBsentialConnection bbserver; - public static CommandsOLD coms; - - public void init() { - if (!initialised) { - config = Config.load(); - Chat chat = new Chat(); - if (Config.isBingoTime() || config.overrideBingoTime()) { - connectToBBserver(); - } - initialised = true; - } - } - - public static Config getConfig() { - return config; - } - - public static void connectToBBserver() { - if (bbserver != null) { - bbserver.sendHiddenMessage("exit"); - } - bbserver = new BBsentialConnection(); - bbserver.setMessageReceivedCallback(message -> bbserver.onMessageReceived(message)); - bbserver.connect(config.getBBServerURL(), 5000); - } - - public static void refreshCommands() { - coms = new CommandsOLD(); - } - -} diff --git a/forge/src/main/java/de/hype/bbsentials/forge/client/Commands/CommandBBServer.java b/forge/src/main/java/de/hype/bbsentials/forge/client/Commands/CommandBBServer.java index 3254d1c..7c94a27 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/client/Commands/CommandBBServer.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/client/Commands/CommandBBServer.java @@ -1,6 +1,5 @@ package de.hype.bbsentials.forge.client.Commands; -import de.hype.bbsentials.forge.client.BBsentials; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; diff --git a/forge/src/main/java/de/hype/bbsentials/forge/client/Commands/CommandsOLD.java b/forge/src/main/java/de/hype/bbsentials/forge/client/Commands/CommandsOLD.java index 804815c..d42970f 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/client/Commands/CommandsOLD.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/client/Commands/CommandsOLD.java @@ -1,6 +1,5 @@ package de.hype.bbsentials.forge.client.Commands; -import de.hype.bbsentials.forge.client.BBsentials; import net.minecraftforge.client.ClientCommandHandler; import static de.hype.bbsentials.forge.client.BBsentials.getConfig; diff --git a/forge/src/main/java/de/hype/bbsentials/forge/communication/BBsentialConnection.java b/forge/src/main/java/de/hype/bbsentials/forge/communication/BBsentialConnection.java index f7e4260..3d8106b 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/communication/BBsentialConnection.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/communication/BBsentialConnection.java @@ -1,7 +1,6 @@ package de.hype.bbsentials.forge.communication; import de.hype.bbsentials.forge.chat.Chat; -import de.hype.bbsentials.forge.client.BBsentials; import net.minecraft.client.Minecraft; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; |