aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle13
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/chat/Chat.java7
-rw-r--r--common/src/main/java/de/hype/bbsentials/common/chat/Message.java7
-rw-r--r--fabric/build.gradle6
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/FabricChat.java39
-rw-r--r--forge/build.gradle.kts19
-rw-r--r--forge/gradle.properties20
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/Command2xPowder.java10
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBAnnounce.java6
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBBServer.java41
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBBan.java22
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBC.java6
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBMute.java22
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBetterTogether.java11
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBingoChat.java6
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandChChest.java25
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandGoblinRaid.java11
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandGoneWithTheWind.java11
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandRaffle.java11
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandSplashAnnounce.java28
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandsOLD.java38
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/Commands.java77
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java20
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/ForgeChat.java22
-rw-r--r--forge/src/main/resources/mcmod.info6
-rw-r--r--gradle.properties10
-rw-r--r--runforge/.mixin.out/audit/mixin_implementation_report.txt2
-rw-r--r--runforge/.mixin.out/class/net/minecraft/client/renderer/entity/RenderItem.classbin48096 -> 48096 bytes
-rw-r--r--runforge/config/splash.properties2
29 files changed, 245 insertions, 253 deletions
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..5c1cc39
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,13 @@
+apply plugin: 'java'
+
+repositories {
+ jcenter()
+}
+
+task copyJars(type: Copy) {
+ from project(":forge").fileTree("build/libs") // Copy JARs from the :forge subproject
+ into file("$rootDir/build/libs") // Copy them to the global output directory
+ from project(":fabric").fileTree("build/libs") // Copy JARs from the :fabric subproject
+ into file("$rootDir/build/libs") // Copy them to the global output directory
+}
+
diff --git a/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java b/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java
index 669dd5d..487abe2 100644
--- a/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java
+++ b/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java
@@ -116,13 +116,12 @@ public class Chat {
}
public Message onEvent(Message text) {
- if (!isSpam(text.toString())) {
+ if (!isSpam(text.getString())) {
if (BBsentials.getConfig().isDetailedDevModeEnabled()) {
System.out.println("got a message: " + text.getJson());
}
- Message message = new Message(text.toString(),text.getString());
- BBsentials.executionService.execute(() -> processThreaded(message));
- return processNotThreaded(message);
+ BBsentials.executionService.execute(() -> processThreaded(text));
+ return processNotThreaded(text);
}
return text; // Return the original message if it is spam
}
diff --git a/common/src/main/java/de/hype/bbsentials/common/chat/Message.java b/common/src/main/java/de/hype/bbsentials/common/chat/Message.java
index 66a3599..7d4b62d 100644
--- a/common/src/main/java/de/hype/bbsentials/common/chat/Message.java
+++ b/common/src/main/java/de/hype/bbsentials/common/chat/Message.java
@@ -7,12 +7,19 @@ public class Message {
private String unformattedString = null;
private String playerName = null;
private String string;
+ public boolean actionBar = false;
public Message(String textJson,String string) {
this.text = textJson;
if (string==null) string = "";
this.string=string;
}
+ public Message(String textJson,String string,boolean actionbar) {
+ this.text = textJson;
+ if (string==null) string = "";
+ this.string=string;
+ this.actionBar = actionbar;
+ }
public static Message of(String string){
return new Message("{\"text\":\""+string+"\"}",string);
}
diff --git a/fabric/build.gradle b/fabric/build.gradle
index dc55ca6..df68863 100644
--- a/fabric/build.gradle
+++ b/fabric/build.gradle
@@ -96,7 +96,11 @@ publishing {
sourceSets {
main {
resources {
- project(':common').sourceSets.main.resources.srcDirs
+ srcDir(project(':common').sourceSets.main.resources.srcDirs)
+ }
+ java {
+ srcDir(project(':common').sourceSets.main.java.srcDirs)
}
}
}
+
diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/FabricChat.java b/fabric/src/main/java/de/hype/bbsentials/fabric/FabricChat.java
index 0244181..d4fefd3 100644
--- a/fabric/src/main/java/de/hype/bbsentials/fabric/FabricChat.java
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/FabricChat.java
@@ -9,28 +9,61 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
public class FabricChat implements MCChat {
+ public Chat chat = new Chat();
+
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()));
+ chat.onEvent(new Message(Text.Serializer.toJson(message), message.getString()));
+ });
+ ClientReceiveMessageEvents.MODIFY_GAME.register((message, actionbar) -> {
+ if (!actionbar) {
+ return prepareOnEvent(message, actionbar);
+ }
+ return message;
});
- 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 Text prepareOnEvent(Text text, boolean actionbar) {
+ String json = Text.Serializer.toJson(text);
+ Message message = new Message(json, text.getString(), actionbar);
+ Message returned = chat.onEvent(message);
+ Text toReturn = Text.Serializer.fromJson(returned.getJson());
+ return toReturn;
+ }
+
public void sendClientSideMessage(Message message) {
MinecraftClient client = MinecraftClient.getInstance();
if (client.player != null) {
client.player.sendMessage(Text.Serializer.fromJson(message.getJson()));
}
}
+
+ public void sendClientSideMessage(Message message, boolean actionbar) {
+ if (actionbar) {
+ showActionBar(message);
+ }
+ else {
+ sendClientSideMessage(message);
+ }
+ }
+
+ public void showActionBar(Message message) {
+ MinecraftClient client = MinecraftClient.getInstance();
+ if (client.player != null) {
+ client.player.sendMessage(Text.Serializer.fromJson(message.getJson()), true);
+ }
+ }
+
public void sendChatMessage(String message) {
MinecraftClient.getInstance().getNetworkHandler().sendChatMessage(message);
}
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"
diff --git a/gradle.properties b/gradle.properties
index 1d84847..8a784a0 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -11,4 +11,14 @@ fabric_version=0.89.2+1.20.2
mod_version=1.0
maven_group=de.hype
archives_base_name=bbsentials
+#Other
+
+loom.platform=forge
+mcVersion = 1.8.9
+modid = bbsentials
+# Done to increase the memory available to gradle.
+# Fabric Properties
+# check these on https://modmuss50.me/fabric.html
+baseGroup = de.hype.bbsentials.forge
+forgeMcVersion = 1.8.9
#Other \ No newline at end of file
diff --git a/runforge/.mixin.out/audit/mixin_implementation_report.txt b/runforge/.mixin.out/audit/mixin_implementation_report.txt
index f973649..f6eb4dc 100644
--- a/runforge/.mixin.out/audit/mixin_implementation_report.txt
+++ b/runforge/.mixin.out/audit/mixin_implementation_report.txt
@@ -1 +1 @@
-Mixin Implementation Report generated on 2023-10-14 11:44:19
+Mixin Implementation Report generated on 2023-10-14 16:14:19
diff --git a/runforge/.mixin.out/class/net/minecraft/client/renderer/entity/RenderItem.class b/runforge/.mixin.out/class/net/minecraft/client/renderer/entity/RenderItem.class
index eeea87e..edb1ccd 100644
--- a/runforge/.mixin.out/class/net/minecraft/client/renderer/entity/RenderItem.class
+++ b/runforge/.mixin.out/class/net/minecraft/client/renderer/entity/RenderItem.class
Binary files differ
diff --git a/runforge/config/splash.properties b/runforge/config/splash.properties
index b9888d5..12e15ca 100644
--- a/runforge/config/splash.properties
+++ b/runforge/config/splash.properties
@@ -1,5 +1,5 @@
#Splash screen properties
-#Sat Oct 14 11:44:22 CEST 2023
+#Sat Oct 14 16:14:22 CEST 2023
logoTexture=textures/gui/title/mojang.png
background=0xFFFFFF
font=0x0