diff options
author | HacktheTime <l4bg0jb7@duck.com> | 2023-10-14 17:00:53 +0200 |
---|---|---|
committer | HacktheTime <l4bg0jb7@duck.com> | 2023-10-14 17:00:53 +0200 |
commit | 2823095542479568ec6d8d1624596e884bea0582 (patch) | |
tree | 099f2ebe75556061ba49ae948b21f83c6a35381c /forge | |
parent | 77fb80356b42260a95610aa5971d2b03d8d30e1d (diff) | |
download | BBsentials-2823095542479568ec6d8d1624596e884bea0582.tar.gz BBsentials-2823095542479568ec6d8d1624596e884bea0582.tar.bz2 BBsentials-2823095542479568ec6d8d1624596e884bea0582.zip |
more changes (fixes)
Diffstat (limited to 'forge')
20 files changed, 169 insertions, 243 deletions
diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index 9f2eedc..ddcda8b 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -10,13 +10,14 @@ plugins { val baseGroup: String by project val mcVersion: String by project -val version: String by project +val mod_version: String by project val mixinGroup = "$baseGroup.mixin" val modid: String by project // Toolchains: java { toolchain.languageVersion.set(JavaLanguageVersion.of(8)) + withSourcesJar() } // Minecraft configuration: @@ -81,7 +82,7 @@ tasks.withType(JavaCompile::class) { } tasks.withType(Jar::class) { - archiveBaseName.set(modid) + archiveBaseName.set("forge-$mod_version") manifest.attributes.run { this["FMLCorePluginContainsFMLMod"] = "true" this["ForceLoadAsMod"] = "true" @@ -93,7 +94,7 @@ tasks.withType(Jar::class) { } tasks.processResources { - inputs.property("version", project.version) + inputs.property("mod_version", project.version) inputs.property("mcversion", mcVersion) inputs.property("modid", modid) inputs.property("mixinGroup", mixinGroup) @@ -129,5 +130,17 @@ tasks.shadowJar { // If you want to include other dependencies and shadow them, you can relocate them in here fun relocate(name: String) = relocate(name, "$baseGroup.deps.$name") } +sourceSets { + main { + java { + srcDir(project(":common").sourceSets["main"].java.srcDirs) + } + resources { + srcDir(project(":common").sourceSets["main"].resources.srcDirs) + } + } +} + + tasks.assemble.get().dependsOn(tasks.remapJar)
\ No newline at end of file diff --git a/forge/gradle.properties b/forge/gradle.properties deleted file mode 100644 index 3545637..0000000 --- a/forge/gradle.properties +++ /dev/null @@ -1,20 +0,0 @@ -loom.platform=forge -org.gradle.jvmargs=-Xmx4g -mcVersion = 1.8.9 -modid = bbsentials -version = 1.0.0 -# Done to increase the memory available to gradle. -# Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_version=1.20.2 -yarn_mappings=1.20.2+build.1 -loader_version=0.14.22 -#Fabric api -fabric_version=0.89.2+1.20.2 -# Mod Properties -mod_version=1.0 -baseGroup = de.hype.bbsentials.forge -forgeMcVersion = 1.8.9 -maven_group=de.hype -archives_base_name=bbsentials -#Other
\ No newline at end of file diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/Command2xPowder.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/Command2xPowder.java index 0914bad..999f122 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/Command2xPowder.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/Command2xPowder.java @@ -1,5 +1,9 @@ package de.hype.bbsentials.forge.CommandImplementations; +import de.hype.bbsentials.common.chat.Chat; +import de.hype.bbsentials.common.constants.enviromentShared.MiningEvents; +import de.hype.bbsentials.common.mclibraries.EnvironmentCore; +import de.hype.bbsentials.common.packets.packets.MiningEventPacket; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; @@ -20,7 +24,11 @@ public class Command2xPowder extends CommandBase { @Override public void processCommand(ICommandSender sender, String[] args) { - connection.sendMessage("?dwevent 2xpowder"); + try { + connection.sendPacket(new MiningEventPacket(MiningEvents.DOUBLE_POWDER,"", EnvironmentCore.utils.getCurrentIsland())); + } catch (Exception e) { + Chat.sendPrivateMessageToSelfError(e.getMessage()); + } } @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBAnnounce.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBAnnounce.java index 032c599..45b1150 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBAnnounce.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBAnnounce.java @@ -1,11 +1,13 @@ package de.hype.bbsentials.forge.CommandImplementations; -import de.hype.bbsentials.common.chat.Chat; +import de.hype.bbsentials.common.packets.packets.BroadcastMessagePacket; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import static de.hype.bbsentials.common.client.BBsentials.connection; + public class CommandBAnnounce extends CommandBase { @Override @@ -22,7 +24,7 @@ public class CommandBAnnounce extends CommandBase { public void processCommand(ICommandSender sender, String[] args) { if (args.length >= 1) { String message = String.join(" ", args); - Chat.sendCommand("?announce " + message); + connection.sendPacket(new BroadcastMessagePacket("","",message)); } else { sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(sender))); diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBBServer.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBBServer.java deleted file mode 100644 index 6150b6e..0000000 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBBServer.java +++ /dev/null @@ -1,41 +0,0 @@ -package de.hype.bbsentials.forge.CommandImplementations; - -import de.hype.bbsentials.common.client.BBsentials; -import net.minecraft.command.CommandBase; -import net.minecraft.command.ICommandSender; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; - -public class CommandBBServer extends CommandBase { - - @Override - public String getCommandName() { - return "bbserver"; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "/bbserver <Message>"; - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (args.length < 1) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /bbserver <Message>")); - return; - } - - String message = args[0]; - if (message.equals("bb:reconnect")) { - BBsentials.connectToBBserver(); - } - else { - BBsentials.connection.sendMessage(message); - } - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBBan.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBBan.java index 09efc8b..6046ce5 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBBan.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBBan.java @@ -1,12 +1,14 @@ package de.hype.bbsentials.forge.CommandImplementations; -import de.hype.bbsentials.common.chat.Chat; +import de.hype.bbsentials.common.packets.packets.PunishUserPacket; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import static de.hype.bbsentials.forge.Commands.sendPacket; + public class CommandBBan extends CommandBase { @Override @@ -16,15 +18,25 @@ public class CommandBBan extends CommandBase { @Override public String getCommandUsage(ICommandSender sender) { - return "/" + getCommandName() + " <message>"; + return "/" + getCommandName() + " <userId/mcusername> <[Duration(d/h/m/s) | 0 forever]> <Reason>"; } @Override public void processCommand(ICommandSender sender, String[] args) { if (args.length >= 1) { - String message = String.join(" ", args); - Chat.sendCommand("?bban " + message); - } + String message = String.join(" ", args).trim(); + String identification = message.split(" ",3)[0]; + String duration =message.split(" ",3)[1]; + String reason = message.split(" ",3)[3]; + 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)); } else { sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(sender))); } diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBC.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBC.java index 08f9bee..f96d0b2 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBC.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBC.java @@ -1,12 +1,14 @@ package de.hype.bbsentials.forge.CommandImplementations; -import de.hype.bbsentials.common.chat.Chat; +import de.hype.bbsentials.common.packets.packets.BingoChatMessagePacket; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import static de.hype.bbsentials.common.client.BBsentials.connection; + public class CommandBC extends CommandBase { @Override @@ -27,7 +29,7 @@ public class CommandBC extends CommandBase { } String message = args[0]; - Chat.sendCommand("?bingochat " + message); + connection.sendPacket(new BingoChatMessagePacket("","",message,0)); } @Override diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBMute.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBMute.java index 0dab562..a335770 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBMute.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBMute.java @@ -1,12 +1,14 @@ package de.hype.bbsentials.forge.CommandImplementations; -import de.hype.bbsentials.common.chat.Chat; +import de.hype.bbsentials.common.packets.packets.PunishUserPacket; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import static de.hype.bbsentials.forge.Commands.sendPacket; + public class CommandBMute extends CommandBase { @Override @@ -16,15 +18,25 @@ public class CommandBMute extends CommandBase { @Override public String getCommandUsage(ICommandSender sender) { - return "/" + getCommandName() + " <message>"; + return "/" + getCommandName() + " <userId/mcusername> <[Duration(d/h/m/s) | 0 forever]> <Reason>"; } @Override public void processCommand(ICommandSender sender, String[] args) { if (args.length >= 1) { - String message = String.join(" ", args); - Chat.sendCommand("?mute " + message); - } + String message = String.join(" ", args).trim(); + String identification = message.split(" ",3)[0]; + String duration =message.split(" ",3)[1]; + String reason = message.split(" ",3)[3]; + 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)); } else { sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(sender))); } diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBetterTogether.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBetterTogether.java index fb3d647..3688604 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBetterTogether.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBetterTogether.java @@ -1,5 +1,9 @@ package de.hype.bbsentials.forge.CommandImplementations; +import de.hype.bbsentials.common.chat.Chat; +import de.hype.bbsentials.common.constants.enviromentShared.MiningEvents; +import de.hype.bbsentials.common.mclibraries.EnvironmentCore; +import de.hype.bbsentials.common.packets.packets.MiningEventPacket; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; @@ -20,8 +24,11 @@ public class CommandBetterTogether extends CommandBase { @Override public void processCommand(ICommandSender sender, String[] args) { - connection.sendMessage("?dwevent bettertogether"); - } + try { + connection.sendPacket(new MiningEventPacket(MiningEvents.BETTER_TOGETHER,"", EnvironmentCore.utils.getCurrentIsland())); + } catch (Exception e) { + Chat.sendPrivateMessageToSelfError(e.getMessage()); + } } @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { return true; diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBingoChat.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBingoChat.java index 6967259..5975c86 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBingoChat.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBingoChat.java @@ -1,12 +1,14 @@ package de.hype.bbsentials.forge.CommandImplementations; -import de.hype.bbsentials.common.chat.Chat; +import de.hype.bbsentials.common.packets.packets.BingoChatMessagePacket; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import static de.hype.bbsentials.common.client.BBsentials.connection; + public class CommandBingoChat extends CommandBase { @Override @@ -27,7 +29,7 @@ public class CommandBingoChat extends CommandBase { } String message = args[0]; - Chat.sendCommand("?bingochat " + message); + connection.sendPacket(new BingoChatMessagePacket("","",message,0)); } @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandChChest.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandChChest.java index 3914d03..be7a30b 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandChChest.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandChChest.java @@ -3,10 +3,6 @@ package de.hype.bbsentials.forge.CommandImplementations; import de.hype.bbsentials.common.chat.Chat; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; - -import static de.hype.bbsentials.common.client.BBsentials.connection; public class CommandChChest extends CommandBase { @@ -18,29 +14,14 @@ public class CommandChChest extends CommandBase { @Override public String getCommandUsage(ICommandSender sender) { - return "/chchest <Item> <X> <Y> <Z> <ContactWay>"; + return "Disabled on 1.8.9 due too missing autocompletion. Please use Discord / 1.20.2"; } @Override public void processCommand(ICommandSender sender, String[] args) { - if (args.length < 5) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /chchest <Item> <X> <Y> <Z> <ContactWay>")); - return; - } - - String item = args[0]; - try { - int x = parseInt(args[1]); - int y = parseInt(args[2]); - int z = parseInt(args[3]); - String contactWay = args[4]; - - String combinedString = "?chchest " + item + " " + x + " " + y + " " + z + " " + contactWay; - connection.sendMessage(combinedString); - } catch (Exception e) { - Chat.sendPrivateMessageToSelfError("Your coords were invalid."); - } + Chat.sendPrivateMessageToSelfError("Disabled on 1.8.9 due too missing autocompletion. Please use Discord / 1.20.2"); } + @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { return true; diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandGoblinRaid.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandGoblinRaid.java index 2b0ec28..a479ae5 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandGoblinRaid.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandGoblinRaid.java @@ -1,5 +1,9 @@ package de.hype.bbsentials.forge.CommandImplementations; +import de.hype.bbsentials.common.chat.Chat; +import de.hype.bbsentials.common.constants.enviromentShared.MiningEvents; +import de.hype.bbsentials.common.mclibraries.EnvironmentCore; +import de.hype.bbsentials.common.packets.packets.MiningEventPacket; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; @@ -20,8 +24,11 @@ public class CommandGoblinRaid extends CommandBase { @Override public void processCommand(ICommandSender sender, String[] args) { - connection.sendMessage("?dwevent goblinraid"); - } + try { + connection.sendPacket(new MiningEventPacket(MiningEvents.GOBLIN_RAID,"", EnvironmentCore.utils.getCurrentIsland())); + } catch (Exception e) { + Chat.sendPrivateMessageToSelfError(e.getMessage()); + } } @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { return true; diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandGoneWithTheWind.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandGoneWithTheWind.java index c079ed1..c8bf6b5 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandGoneWithTheWind.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandGoneWithTheWind.java @@ -1,5 +1,9 @@ package de.hype.bbsentials.forge.CommandImplementations; +import de.hype.bbsentials.common.chat.Chat; +import de.hype.bbsentials.common.constants.enviromentShared.MiningEvents; +import de.hype.bbsentials.common.mclibraries.EnvironmentCore; +import de.hype.bbsentials.common.packets.packets.MiningEventPacket; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; @@ -20,8 +24,11 @@ public class CommandGoneWithTheWind extends CommandBase { @Override public void processCommand(ICommandSender sender, String[] args) { - connection.sendMessage("?dwevent gonewiththewind"); - } + try { + connection.sendPacket(new MiningEventPacket(MiningEvents.GONE_WITH_THE_WIND,"", EnvironmentCore.utils.getCurrentIsland())); + } catch (Exception e) { + Chat.sendPrivateMessageToSelfError(e.getMessage()); + } } @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { return true; diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandRaffle.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandRaffle.java index 4e17c42..e98ebfd 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandRaffle.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandRaffle.java @@ -1,5 +1,9 @@ package de.hype.bbsentials.forge.CommandImplementations; +import de.hype.bbsentials.common.chat.Chat; +import de.hype.bbsentials.common.constants.enviromentShared.MiningEvents; +import de.hype.bbsentials.common.mclibraries.EnvironmentCore; +import de.hype.bbsentials.common.packets.packets.MiningEventPacket; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; @@ -20,8 +24,11 @@ public class CommandRaffle extends CommandBase { @Override public void processCommand(ICommandSender sender, String[] args) { - connection.sendMessage("?dwevent raffle"); - } + try { + connection.sendPacket(new MiningEventPacket(MiningEvents.RAFFLE,"", EnvironmentCore.utils.getCurrentIsland())); + } catch (Exception e) { + Chat.sendPrivateMessageToSelfError(e.getMessage()); + } } @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { return true; diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandSplashAnnounce.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandSplashAnnounce.java index 52e4167..d4f140b 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandSplashAnnounce.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandSplashAnnounce.java @@ -3,11 +3,6 @@ package de.hype.bbsentials.forge.CommandImplementations; import de.hype.bbsentials.common.chat.Chat; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; -import net.minecraft.command.NumberInvalidException; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; - -import java.util.Arrays; public class CommandSplashAnnounce extends CommandBase { @@ -18,31 +13,14 @@ public class CommandSplashAnnounce extends CommandBase { @Override public String getCommandUsage(ICommandSender sender) { - return "/" + getCommandName() + " <Hub> <location> [extramessage]"; + return "Disabled on 1.8.9 due too missing autocompletion. Please use Discord / 1.20.2"; } @Override public void processCommand(ICommandSender sender, String[] args) { - if (args.length >= 2) { - int hub_Number = 0; - try { - hub_Number = parseInt(args[0], 1, 28); - } catch (NumberInvalidException e) { - Chat.sendPrivateMessageToSelfError("§cInvalid hub number"); - } - String location = args[1]; - String message = ""; - - if (args.length > 2) { - message = String.join(" ", Arrays.copyOfRange(args, 2, args.length)); - } - - Chat.sendCommand("?splash " + hub_Number + " " + location + " " + message); - } - else { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(sender))); - } + Chat.sendPrivateMessageToSelfError("Disabled on 1.8.9 due too missing autocompletion. Please use Discord / 1.20.2"); } + @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { return true; diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandsOLD.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandsOLD.java deleted file mode 100644 index 349013d..0000000 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandsOLD.java +++ /dev/null @@ -1,38 +0,0 @@ -package de.hype.bbsentials.forge.CommandImplementations; - -import de.hype.bbsentials.common.client.BBsentials; -import net.minecraftforge.client.ClientCommandHandler; - -import static de.hype.bbsentials.common.client.BBsentials.getConfig; - - -public class CommandsOLD { - public CommandsOLD() { - ClientCommandHandler.instance.registerCommand(new CommandGoblinRaid()); - ClientCommandHandler.instance.registerCommand(new Command2xPowder()); - ClientCommandHandler.instance.registerCommand(new CommandBetterTogether()); - ClientCommandHandler.instance.registerCommand(new CommandRaffle()); - ClientCommandHandler.instance.registerCommand(new CommandGoneWithTheWind()); - ClientCommandHandler.instance.registerCommand(new CommandChChest()); - ClientCommandHandler.instance.registerCommand(new CommandBBServer()); - ClientCommandHandler.instance.registerCommand(new CommandBC()); - ClientCommandHandler.instance.registerCommand(new CommandBingoChat()); - if (getConfig().bbsentialsRoles != null) { - if (getConfig().hasBBRoles("mod")) { - ClientCommandHandler.instance.registerCommand(new CommandBAnnounce()); - ClientCommandHandler.instance.registerCommand(new CommandBMute()); - ClientCommandHandler.instance.registerCommand(new CommandBBan()); - } - if (getConfig().hasBBRoles("splasher")) { - ClientCommandHandler.instance.registerCommand(new CommandSplashAnnounce()); - } - else { - } - } - } - - public void sendCommand(String message) { - BBsentials.connection.sendCommand(message); - } -} - diff --git a/forge/src/main/java/de/hype/bbsentials/forge/Commands.java b/forge/src/main/java/de/hype/bbsentials/forge/Commands.java index cf6083b..187823b 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/Commands.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/Commands.java @@ -5,6 +5,7 @@ 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.common.packets.packets.SplashNotifyPacket; +import de.hype.bbsentials.forge.CommandImplementations.*; import de.hype.bbsentials.forge.client.CommandBBI; import net.minecraftforge.client.ClientCommandHandler; @@ -15,65 +16,14 @@ public class Commands implements MCCommand { public void registerMain() { ClientCommandHandler.instance.registerCommand(new CommandBBI()); -// 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*/ + ClientCommandHandler.instance.registerCommand(new CommandGoblinRaid()); + ClientCommandHandler.instance.registerCommand(new Command2xPowder()); + ClientCommandHandler.instance.registerCommand(new CommandBetterTogether()); + ClientCommandHandler.instance.registerCommand(new CommandRaffle()); + ClientCommandHandler.instance.registerCommand(new CommandGoneWithTheWind()); + ClientCommandHandler.instance.registerCommand(new CommandChChest()); + ClientCommandHandler.instance.registerCommand(new CommandBC()); + ClientCommandHandler.instance.registerCommand(new CommandBingoChat()); } public void registerRoleRequired(boolean hasDev, boolean hasAdmin, boolean hasMod, boolean hasSplasher, boolean hasBeta, boolean hasMiningEvents, boolean hasChChest) { @@ -182,6 +132,15 @@ public class Commands implements MCCommand { // }))); // });/*BBServerMotd*/ // } + if (hasMod) { + ClientCommandHandler.instance.registerCommand(new CommandBAnnounce()); + ClientCommandHandler.instance.registerCommand(new CommandBMute()); + ClientCommandHandler.instance.registerCommand(new CommandBBan()); + } + if (hasSplasher) { + ClientCommandHandler.instance.registerCommand(new CommandSplashAnnounce()); + } + } public void splashAnnounce(int hubNumber, String locationInHub, String extramessage, boolean lessWaste) { 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 d181296..ab63954 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java @@ -7,6 +7,7 @@ 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; @@ -14,10 +15,27 @@ public class ExampleMod { @Mod.EventHandler public void init(FMLInitializationEvent event) { + printLocation(); + EnvironmentCore core = new EnvironmentCore(new BBUtils(), new ForgeChat(), new MCUtils(), new Commands(), new Options(), new DebugThread()); MinecraftForge.EVENT_BUS.register(this); } - + public void printLocation() { +// try { +// // Get the URL of the JAR file containing the class +// URL jarUrl = this.getClass().getProtectionDomain().getCodeSource().getLocation(); +// +// // Convert the URL to a URI +// File jarFile = new File(jarUrl.toURI()); +// +// // Get the absolute path of the JAR file +// String jarPath = jarFile.getAbsolutePath(); +// +//// throw new RuntimeException(jarPath); +// } catch (URISyntaxException e) { +// e.printStackTrace(); +// } + } @SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent event) { BBsentials.onServerSwap(); diff --git a/forge/src/main/java/de/hype/bbsentials/forge/ForgeChat.java b/forge/src/main/java/de/hype/bbsentials/forge/ForgeChat.java index d36106f..f84d760 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/ForgeChat.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/ForgeChat.java @@ -11,28 +11,38 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class ForgeChat implements MCChat { + public Chat chat = new Chat(); + public ForgeChat() { init(); } - public Chat chat = new Chat(); + public void init() { MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onClientChatReceived(ClientChatReceivedEvent event) { - Message newMessage = chat.onEvent(new Message(IChatComponent.Serializer.componentToJson(event.message),event.message.getUnformattedText())); - if (!newMessage.equals(event.message)){ - event.setCanceled(true); - Chat.sendPrivateMessageToSelfText(newMessage); + if (!(event.type == 2)) { + //2 means action bar +// Chat.sendPrivateMessageToSelfDebug(String.valueOf(((int) event.type))); + Message newMessage = chat.onEvent(new Message(IChatComponent.Serializer.componentToJson(event.message), event.message.getUnformattedText())); + if (!newMessage.equals(event.message)) { + event.setCanceled(true); + Chat.sendPrivateMessageToSelfText(newMessage); + } } } + public void sendClientSideMessage(Message message) { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; if (player != null) { - player.addChatMessage(IChatComponent.Serializer.jsonToComponent(message.getJson())); + String json = message.getJson(); + IChatComponent text = IChatComponent.Serializer.jsonToComponent(json); + player.addChatMessage(text); } } + public void sendChatMessage(String message) { Minecraft.getMinecraft().thePlayer.sendChatMessage(message); } diff --git a/forge/src/main/resources/mcmod.info b/forge/src/main/resources/mcmod.info index 1b1651f..457c717 100644 --- a/forge/src/main/resources/mcmod.info +++ b/forge/src/main/resources/mcmod.info @@ -2,10 +2,10 @@ { "modid": "${modid}", "name": "BBsentials", - "description": "A mod that is used as an example.", - "version": "${version}", + "description": "Bingo QOL Mod", + "version": "${mod_version}", "mcversion": "${mcversion}", - "url": "https://github.com/romangraef/Forge1.8.9Template/", + "url": "https://github.com/HacktheTime/BBsentials", "updateUrl": "", "authorList": [ "Hype_the_Time/hackthetime" |