aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/hype/bbsentials/client/BBUtils.java21
-rw-r--r--src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java11
-rw-r--r--src/main/java/de/hype/bbsentials/client/DebugThread.java3
-rw-r--r--src/main/java/de/hype/bbsentials/constants/enviromentShared/Islands.java10
4 files changed, 40 insertions, 5 deletions
diff --git a/src/main/java/de/hype/bbsentials/client/BBUtils.java b/src/main/java/de/hype/bbsentials/client/BBUtils.java
new file mode 100644
index 0000000..284738a
--- /dev/null
+++ b/src/main/java/de/hype/bbsentials/client/BBUtils.java
@@ -0,0 +1,21 @@
+package de.hype.bbsentials.client;
+
+import de.hype.bbsentials.chat.Chat;
+import de.hype.bbsentials.constants.enviromentShared.Islands;
+import net.minecraft.client.MinecraftClient;
+
+public class BBUtils {
+ public static Islands getCurrentIsland() {
+ try {
+ String string = MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!C-b").getDisplayName().getString();
+ if (!string.startsWith("Area: ")) {
+ Chat.sendPrivateMessageToSelf("§4Could not get Area data. Are you in Skyblock?");
+ }
+ else {
+ return Islands.getByDisplayName(string.replace("Area: ","").trim());
+ }
+ } catch (Exception e) {
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java b/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java
index 490288c..ee83ec9 100644
--- a/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java
+++ b/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java
@@ -4,9 +4,9 @@ import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.StringArgumentType;
import de.hype.bbsentials.chat.Chat;
+import de.hype.bbsentials.client.BBUtils;
import de.hype.bbsentials.client.BBsentials;
import de.hype.bbsentials.constants.enviromentShared.ChChestItems;
-import de.hype.bbsentials.constants.enviromentShared.Islands;
import de.hype.bbsentials.constants.enviromentShared.MiningEvents;
import de.hype.bbsentials.packets.AbstractPacket;
import de.hype.bbsentials.packets.packets.*;
@@ -18,6 +18,7 @@ import net.minecraft.command.CommandSource;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import static de.hype.bbsentials.client.BBsentials.*;
@@ -276,7 +277,7 @@ public class CommandsOLD {
String extramessage = StringArgumentType.getString(context, "extramessage");
String location = StringArgumentType.getString(context, "location");
boolean lessWaste = Boolean.parseBoolean(StringArgumentType.getString(context, "lasswaste"));
- sendPacket(new SplashNotifyPacket(hub, config.getUsername(), location, Islands.HUB, extramessage, lessWaste));
+ sendPacket(new SplashNotifyPacket(hub, config.getUsername(), location, BBUtils.getCurrentIsland() , extramessage, lessWaste));
return 1;
})
)
@@ -284,14 +285,14 @@ public class CommandsOLD {
int hub = IntegerArgumentType.getInteger(context, "Hub");
String location = "bea";
boolean lessWaste = Boolean.parseBoolean(StringArgumentType.getString(context, "lasswaste"));
- sendPacket(new SplashNotifyPacket(hub, config.getUsername(), location, Islands.HUB, "", lessWaste));
+ sendPacket(new SplashNotifyPacket(hub, config.getUsername(), location, BBUtils.getCurrentIsland(), "", lessWaste));
return 1;
})
))
.executes((context) -> {
int hub = IntegerArgumentType.getInteger(context, "Hub");
String location = StringArgumentType.getString(context, "location");
- sendPacket(new SplashNotifyPacket(hub, config.getUsername(), location, Islands.HUB, "", true));
+ sendPacket(new SplashNotifyPacket(hub, config.getUsername(), location, BBUtils.getCurrentIsland(), "", true));
return 1;
})
@@ -320,7 +321,7 @@ public class CommandsOLD {
.executes((context) -> {
try {
BBsentials.bbserver.sendPacket(new MiningEventPacket(event,//TODO get the island
- config.getUsername(), Islands.HUB));
+ config.getUsername(), Objects.requireNonNull(BBUtils.getCurrentIsland())));
} catch (Exception e) {
Chat.sendPrivateMessageToSelf("§c" + e.getMessage());
}
diff --git a/src/main/java/de/hype/bbsentials/client/DebugThread.java b/src/main/java/de/hype/bbsentials/client/DebugThread.java
index b10cad4..280ab7d 100644
--- a/src/main/java/de/hype/bbsentials/client/DebugThread.java
+++ b/src/main/java/de/hype/bbsentials/client/DebugThread.java
@@ -1,6 +1,9 @@
package de.hype.bbsentials.client;
+import net.minecraft.scoreboard.Scoreboard;
+
public class DebugThread implements Runnable {
+ Scoreboard temp;
@Override
public void run() {
loop();
diff --git a/src/main/java/de/hype/bbsentials/constants/enviromentShared/Islands.java b/src/main/java/de/hype/bbsentials/constants/enviromentShared/Islands.java
index 105e0c2..2ab4e55 100644
--- a/src/main/java/de/hype/bbsentials/constants/enviromentShared/Islands.java
+++ b/src/main/java/de/hype/bbsentials/constants/enviromentShared/Islands.java
@@ -16,6 +16,7 @@ public enum Islands implements BBDisplayNameProvider {
SPIDERS_DEN("combat_1", "Spider's Den"),
THE_END("combat_3", "The End"),
THE_FARMING_ISLANDS("farming_1", "The Farming Islands"),
+ JERRYS_WORKSHOP("winter", "Jerry's Workshop"),
THE_RIFT("rift", "The Rift");
@@ -34,4 +35,13 @@ public enum Islands implements BBDisplayNameProvider {
public String getDisplayName() {
return displayName;
}
+ public static Islands getByDisplayName(String displayName) {
+ for (Islands island : values()) {
+ if (island.getDisplayName().equals(displayName)) {
+ return island;
+ }
+ }
+ return null; // Return null if the display name doesn't match any enum value
+ }
+
}