diff options
7 files changed, 14 insertions, 68 deletions
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 51f0646..7fce889 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 @@ -46,7 +46,7 @@ public class Message { public String getMessageContent() { if (isServerMessage()) return unformattedString; - return getUnformattedString().split(":", 2)[1]; + return getUnformattedString().split(":", 2)[1].trim(); } Boolean guild = null; @@ -77,9 +77,7 @@ public class Message { public boolean isServerMessage() { if (server != null) return server; - int space = getUnformattedString().indexOf(" "); - int doublepoint = getUnformattedString().indexOf(":"); - return ((space + 2 < doublepoint)||doublepoint==-1||space==-1); + return !(isFromParty() || isFromGuild() || isMsg()); } public String getPlayerName() { diff --git a/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java b/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java index 8c26537..9d3aef9 100644 --- a/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java +++ b/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java @@ -446,7 +446,7 @@ public class BBsentialConnection { public void onPartyPacket(PartyPacket packet) { if (BBsentials.config.allowServerPartyInvite) { if (packet.type.equals(PartyConstants.DISBAND)) Chat.sendCommand("/p disband"); - else Chat.sendCommand("/p " + packet.type + String.join(" ", packet.users)); + else Chat.sendCommand("/p " + packet.type.toString().toLowerCase() + String.join(" ", packet.users)); } else { Chat.sendPrivateMessageToSelfImportantInfo("Blocked a Party Command from the Server: " + packet.type + " : " + String.join(" ", packet.users)); diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/DebugThread.java b/fabric/src/main/java/de/hype/bbsentials/fabric/DebugThread.java index 9c5a1e8..21424fc 100644 --- a/fabric/src/main/java/de/hype/bbsentials/fabric/DebugThread.java +++ b/fabric/src/main/java/de/hype/bbsentials/fabric/DebugThread.java @@ -1,16 +1,12 @@ package de.hype.bbsentials.fabric; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.entity.player.PlayerEntity; - import java.util.ArrayList; import java.util.List; public class DebugThread implements de.hype.bbsentials.common.client.DebugThread { + public static List<Object> store = new ArrayList<>(); boolean doTest = false; - public static List<Object> store = new ArrayList<>(); @Override public void loop() { if (doTest) { @@ -26,52 +22,9 @@ public class DebugThread implements de.hype.bbsentials.common.client.DebugThread public void doOnce() { doTest = true; } + @Override public List<String> test() { return List.of(""); } - - public List<PlayerEntity> getAllPlayers() { - List<PlayerEntity> players = new ArrayList<>(); - - // Iterate through all players and check their distance from the source player - for (PlayerEntity player : MinecraftClient.getInstance().player.getEntityWorld().getPlayers()) { - if (!player.getDisplayName().getString().startsWith("!")) { - players.add(player); - } - } - - return players; - } - - public List<PlayerEntity> getPlayersInRadius(ClientPlayerEntity referencePlayer, List<PlayerEntity> players, double radius) { - List<PlayerEntity> nearbyPlayers = new ArrayList<>(); - - // Iterate through all players and check their distance from the source player - for (PlayerEntity player : players) { - if (player != referencePlayer && player.squaredDistanceTo(referencePlayer) <= radius * radius) { - nearbyPlayers.add(player); - } - } - - return nearbyPlayers; - } - - public List<PlayerEntity> getNonBingoPlayers(List<PlayerEntity> players) { - List<PlayerEntity> nonBingoPlayers = new ArrayList<>(); - - // Iterate through all players and check their distance from the source player - for (PlayerEntity player : players) { - if (player.getCustomName().getString().contains("Ⓑ")) { - nonBingoPlayers.add(player); - } - } - return nonBingoPlayers; - } - - public List<String> getSplashLeechingPlayers() { - List<PlayerEntity> players = getAllPlayers(); -// players.remove(MinecraftClient.getInstance().player); - return getPlayersInRadius(MinecraftClient.getInstance().player, getNonBingoPlayers(players), 5).stream().map((playerEntity -> playerEntity.getDisplayName().getString())).toList(); - } } diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/DoubleFieldWidget.java b/fabric/src/main/java/de/hype/bbsentials/fabric/DoubleFieldWidget.java index 968cb92..67cbf21 100644 --- a/fabric/src/main/java/de/hype/bbsentials/fabric/DoubleFieldWidget.java +++ b/fabric/src/main/java/de/hype/bbsentials/fabric/DoubleFieldWidget.java @@ -20,7 +20,7 @@ public class DoubleFieldWidget extends IntegerFieldWidget { @Override public boolean charTyped(char chr, int modifiers) { - if (chr == '.' || chr == ',') return super.typeChar('.', modifiers); + if (chr == '.' || chr == ',') return super.typeChar('.', modifiers, true); return super.charTyped(chr, modifiers); } diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/IntegerFieldWidget.java b/fabric/src/main/java/de/hype/bbsentials/fabric/IntegerFieldWidget.java index fbbd649..d5f9a2e 100644 --- a/fabric/src/main/java/de/hype/bbsentials/fabric/IntegerFieldWidget.java +++ b/fabric/src/main/java/de/hype/bbsentials/fabric/IntegerFieldWidget.java @@ -20,6 +20,13 @@ public class IntegerFieldWidget extends TextFieldWidget { @Override public boolean charTyped(char chr, int modifiers) { + return typeChar(chr, modifiers, false); + } + + public boolean typeChar(char chr, int modifiers, boolean doNotBlock) { + if (doNotBlock) { + return super.charTyped(chr, modifiers); + } // Allow removal (backspace and delete) and specific key combinations (Ctrl+A) if (chr == 8 || chr == 127 || (modifiers & 1) == 1) { return super.charTyped(chr, modifiers); @@ -30,12 +37,4 @@ public class IntegerFieldWidget extends TextFieldWidget { } return false; // Block other characters } - - /** - * Use this to bypass the check from the own charTyped. Passes this to the super Class of this. - */ - public boolean typeChar(char chr, int modifiers) { - return charTyped(chr, modifiers); - } - } diff --git a/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java b/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java index 97845c6..5916a4a 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java @@ -1,13 +1,11 @@ package de.hype.bbsentials.forge; import com.google.common.collect.Lists; -import com.mojang.realmsclient.dto.PlayerInfo; import de.hype.bbsentials.common.chat.Chat; import de.hype.bbsentials.common.constants.enviromentShared.EnumUtils; import de.hype.bbsentials.common.constants.enviromentShared.Islands; import net.minecraft.client.Minecraft; import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.server.gui.PlayerListComponent; import java.util.Iterator; import java.util.List; diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandOpenConfig.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandOpenConfig.java index 69936da..0bf7716 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandOpenConfig.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandOpenConfig.java @@ -1,7 +1,5 @@ package de.hype.bbsentials.forge.CommandImplementations; -import de.hype.bbsentials.forge.ForgeMod; -import de.hype.bbsentials.forge.client.MoulConfigManager; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; @@ -20,7 +18,7 @@ public class CommandOpenConfig extends CommandBase { @Override public void processCommand(ICommandSender sender, String[] args) { - new MoulConfigManager().openConfigGui(); +// new MoulConfigManager().openConfigGui(); } @Override |