aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hype/bbsentials/client
diff options
context:
space:
mode:
authorHacktheTime <l4bg0jb7@duck.com>2023-09-21 21:55:53 +0200
committerHacktheTime <l4bg0jb7@duck.com>2023-09-21 21:55:53 +0200
commit2486da0f63a2c2cce7341a1402df7834414b6c42 (patch)
tree4418c56ef97369f5e653660a724473579841838e /src/main/java/de/hype/bbsentials/client
parent2fbf623b1bfc51c4576a02bf8b02413d718cf514 (diff)
downloadBBsentials-2486da0f63a2c2cce7341a1402df7834414b6c42.tar.gz
BBsentials-2486da0f63a2c2cce7341a1402df7834414b6c42.tar.bz2
BBsentials-2486da0f63a2c2cce7341a1402df7834414b6c42.zip
aad Islands and island detecter util method
Diffstat (limited to 'src/main/java/de/hype/bbsentials/client')
-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
3 files changed, 30 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();