diff --git a/build.gradle b/build.gradle index f2eddfd..7d5cef5 100644 --- a/build.gradle +++ b/build.gradle @@ -32,11 +32,12 @@ repositories { maven { url = uri('https://repo.maven.apache.org/maven2/') } + + mavenLocal() } dependencies { implementation 'com.github.steveice10:mcprotocollib:1.20-1-SNAPSHOT' - implementation 'com.github.steveice10:mcauthlib:1.5-SNAPSHOT' implementation 'net.kyori:adventure-text-serializer-ansi:4.14.0' implementation 'com.google.code.gson:gson:2.10.1' implementation 'com.google.guava:guava:31.1-jre' diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/CreayunChatParser.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/CreayunChatParser.java index 8016a2c..7437d91 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/CreayunChatParser.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/CreayunChatParser.java @@ -4,7 +4,7 @@ import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.data.chat.ChatParser; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerMessage; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import net.kyori.adventure.text.Component; @@ -37,8 +37,8 @@ public class CreayunChatParser implements ChatParser { final String displayName = matcher.group(1); final String contents = matcher.group(2); - MutablePlayerListEntry sender = bot.players.getEntry(displayName); - if (sender == null) sender = new MutablePlayerListEntry(new GameProfile(new UUID(0L, 0L), displayName), GameMode.SURVIVAL, 0, Component.text(displayName), 0L, null, new byte[0], true); + PlayerEntry sender = bot.players.getEntry(displayName); + if (sender == null) sender = new PlayerEntry(new GameProfile(new UUID(0L, 0L), displayName), GameMode.SURVIVAL, 0, Component.text(displayName), 0L, null, new byte[0], true); return new PlayerMessage(sender, Component.text(displayName), Component.text(contents)); } diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/KaboomChatParser.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/KaboomChatParser.java index 947a65b..0e4c33a 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/KaboomChatParser.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/KaboomChatParser.java @@ -4,7 +4,7 @@ import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.data.chat.ChatParser; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerMessage; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; @@ -43,9 +43,9 @@ public class KaboomChatParser implements ChatParser { return null; } - MutablePlayerListEntry sender = bot.players.getEntry(Component.empty().append(prefix).append(displayName)); + PlayerEntry sender = bot.players.getEntry(Component.empty().append(prefix).append(displayName)); if (sender == null) sender = bot.players.getEntry(prefix.append(displayName)); // old - if (sender == null) sender = new MutablePlayerListEntry(new GameProfile(new UUID(0L, 0L), null), GameMode.SURVIVAL, 0, displayName, 0L, null, new byte[0], true); // new and currently using + if (sender == null) sender = new PlayerEntry(new GameProfile(new UUID(0L, 0L), null), GameMode.SURVIVAL, 0, displayName, 0L, null, new byte[0], true); // new and currently using return new PlayerMessage(sender, displayName, contents); } diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/MinecraftChatParser.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/MinecraftChatParser.java index 48499c8..462ee5c 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/MinecraftChatParser.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/MinecraftChatParser.java @@ -2,7 +2,7 @@ package land.chipmunk.chayapak.chomens_bot.chatParsers; import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.data.chat.ChatParser; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerMessage; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import net.kyori.adventure.text.Component; @@ -41,7 +41,7 @@ public class MinecraftChatParser implements ChatParser { final Component senderComponent = args.get(0); final Component contents = args.get(1); - MutablePlayerListEntry sender; + PlayerEntry sender; final HoverEvent hoverEvent = senderComponent.hoverEvent(); if (hoverEvent != null && hoverEvent.action().equals(HoverEvent.Action.SHOW_ENTITY)) { diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/U203aChatParser.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/U203aChatParser.java index 1618c7e..b2439f9 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/U203aChatParser.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/chatParsers/U203aChatParser.java @@ -2,7 +2,7 @@ package land.chipmunk.chayapak.chomens_bot.chatParsers; import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.data.chat.ChatParser; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerMessage; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import net.kyori.adventure.text.Component; @@ -34,7 +34,7 @@ public class U203aChatParser implements ChatParser { final Component senderComponent = args.get(1); final Component contents = args.get(2); - MutablePlayerListEntry sender; + PlayerEntry sender; final HoverEvent hoverEvent = senderComponent.hoverEvent(); if (hoverEvent != null && hoverEvent.action().equals(HoverEvent.Action.SHOW_ENTITY)) { HoverEvent.ShowEntity entityInfo = (HoverEvent.ShowEntity) hoverEvent.value(); diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/command/CommandContext.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/command/CommandContext.java index f914ebd..cc36b3c 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/command/CommandContext.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/command/CommandContext.java @@ -1,7 +1,7 @@ package land.chipmunk.chayapak.chomens_bot.command; import land.chipmunk.chayapak.chomens_bot.Bot; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import net.kyori.adventure.text.Component; public class CommandContext { @@ -9,14 +9,14 @@ public class CommandContext { public final String prefix; - public final MutablePlayerListEntry sender; + public final PlayerEntry sender; public final String hash; public final String ownerHash; public final boolean inGame; - public CommandContext(Bot bot, String prefix, MutablePlayerListEntry sender, String hash, String ownerHash, boolean inGame) { + public CommandContext(Bot bot, String prefix, PlayerEntry sender, String hash, String ownerHash, boolean inGame) { this.bot = bot; this.prefix = prefix; this.sender = sender; diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/command/DiscordCommandContext.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/command/DiscordCommandContext.java index f729090..b1ee572 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/command/DiscordCommandContext.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/command/DiscordCommandContext.java @@ -2,7 +2,7 @@ package land.chipmunk.chayapak.chomens_bot.command; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.util.CodeBlockUtilities; import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; @@ -23,7 +23,7 @@ public class DiscordCommandContext extends CommandContext { super( bot, prefix, - new MutablePlayerListEntry( + new PlayerEntry( new GameProfile( UUID.nameUUIDFromBytes(("OfflinePlayer:" + event.getAuthor().getName()).getBytes()), event.getAuthor().getName() diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/command/PlayerCommandContext.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/command/PlayerCommandContext.java index 55257c2..a9d89e5 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/command/PlayerCommandContext.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/command/PlayerCommandContext.java @@ -1,6 +1,6 @@ package land.chipmunk.chayapak.chomens_bot.command; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.Bot; import net.kyori.adventure.text.Component; @@ -11,7 +11,7 @@ public class PlayerCommandContext extends CommandContext { private final Bot bot; - public PlayerCommandContext (Bot bot, String playerName, String prefix, String selector, MutablePlayerListEntry sender, String hash, String ownerHash) { + public PlayerCommandContext (Bot bot, String playerName, String prefix, String selector, PlayerEntry sender, String hash, String ownerHash) { super(bot, prefix, sender, hash, ownerHash, true); this.bot = bot; this.playerName = playerName; diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ClearChatCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ClearChatCommand.java index e2283f6..753e772 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ClearChatCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ClearChatCommand.java @@ -2,7 +2,7 @@ package land.chipmunk.chayapak.chomens_bot.commands; import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.command.Command; import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import net.kyori.adventure.text.Component; @@ -26,7 +26,7 @@ public class ClearChatCommand extends Command { final Bot bot = context.bot; if (args.length > 0) { - final MutablePlayerListEntry entry = bot.players.getEntry(String.join(" ", args)); + final PlayerEntry entry = bot.players.getEntry(String.join(" ", args)); if (entry == null) return Component.text("Invalid player name").color(NamedTextColor.RED); diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/KickCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/KickCommand.java index 25232bd..54cc5e3 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/KickCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/KickCommand.java @@ -4,7 +4,7 @@ import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.command.Command; import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; @@ -26,7 +26,7 @@ public class KickCommand extends Command { public Component execute(CommandContext context, String[] args, String[] fullArgs) { final Bot bot = context.bot; - final MutablePlayerListEntry entry = bot.players.getEntry(String.join(" ", args)); + final PlayerEntry entry = bot.players.getEntry(String.join(" ", args)); if (entry == null) return Component.text("Invalid player name").color(NamedTextColor.RED); diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ListCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ListCommand.java index 36b2fb1..20eb9e6 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ListCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ListCommand.java @@ -2,7 +2,7 @@ package land.chipmunk.chayapak.chomens_bot.commands; import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.command.Command; import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities; @@ -30,11 +30,11 @@ public class ListCommand extends Command { public Component execute(CommandContext context, String[] args, String[] fullArgs) { final Bot bot = context.bot; - final List list = bot.players.list; + final List list = bot.players.list; final List playersComponent = new ArrayList<>(); - for (MutablePlayerListEntry entry : list) { + for (PlayerEntry entry : list) { playersComponent.add( Component.translatable( "%s › %s", diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/MailCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/MailCommand.java index 8540240..7f3db71 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/MailCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/MailCommand.java @@ -9,7 +9,7 @@ import land.chipmunk.chayapak.chomens_bot.command.Command; import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; import land.chipmunk.chayapak.chomens_bot.data.Mail; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.plugins.MailPlugin; import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; @@ -47,7 +47,7 @@ public class MailCommand extends Command { final Bot bot = context.bot; - final MutablePlayerListEntry sender = context.sender; + final PlayerEntry sender = context.sender; final Gson gson = new Gson(); diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/RandomTeleportCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/RandomTeleportCommand.java index 3dd5001..e064e6e 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/RandomTeleportCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/RandomTeleportCommand.java @@ -4,7 +4,7 @@ import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.command.Command; import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities; import land.chipmunk.chayapak.chomens_bot.util.MathUtilities; import net.kyori.adventure.text.Component; @@ -25,7 +25,7 @@ public class RandomTeleportCommand extends Command { public Component execute(CommandContext context, String[] args, String[] fullArgs) { final Bot bot = context.bot; - final MutablePlayerListEntry sender = context.sender; + final PlayerEntry sender = context.sender; final int positionX = MathUtilities.between(-1_000_000, 1_000_000); final int positionZ = MathUtilities.between(-1_000_000, 1_000_000); diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UUIDCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UUIDCommand.java index f7ef159..4d0470f 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UUIDCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UUIDCommand.java @@ -4,7 +4,7 @@ import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.command.Command; import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; @@ -27,7 +27,7 @@ public class UUIDCommand extends Command { final Bot bot = context.bot; if (args.length > 0) { - final MutablePlayerListEntry entry = bot.players.getEntry(String.join(" ", args)); + final PlayerEntry entry = bot.players.getEntry(String.join(" ", args)); if (entry == null) return Component.text("Invalid player name").color(NamedTextColor.RED); @@ -50,7 +50,7 @@ public class UUIDCommand extends Command { .color(ColorUtilities.getColorByString(bot.config.colorPalette.uuid)) ).color(NamedTextColor.GREEN); } else { - final MutablePlayerListEntry entry = context.sender; + final PlayerEntry entry = context.sender; final String uuid = entry.profile.getIdAsString(); diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/data/chat/MutablePlayerListEntry.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/data/chat/PlayerEntry.java similarity index 90% rename from src/main/java/land/chipmunk/chayapak/chomens_bot/data/chat/MutablePlayerListEntry.java rename to src/main/java/land/chipmunk/chayapak/chomens_bot/data/chat/PlayerEntry.java index e5dcf65..fc8748d 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/data/chat/MutablePlayerListEntry.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/data/chat/PlayerEntry.java @@ -7,7 +7,7 @@ import net.kyori.adventure.text.Component; import java.security.PublicKey; -public class MutablePlayerListEntry { +public class PlayerEntry { public final GameProfile profile; public GameMode gamemode; public int latency; @@ -17,7 +17,7 @@ public class MutablePlayerListEntry { public final byte[] keySignature; public boolean listed; - public MutablePlayerListEntry ( + public PlayerEntry( GameProfile profile, GameMode gamemode, int latency, @@ -37,7 +37,7 @@ public class MutablePlayerListEntry { this.listed = listed; } - public MutablePlayerListEntry (PlayerListEntry entry) { + public PlayerEntry(PlayerListEntry entry) { this(entry.getProfile(), entry.getGameMode(), entry.getLatency(), entry.getDisplayName(), entry.getExpiresAt(), entry.getPublicKey(), entry.getKeySignature(), entry.isListed()); } } diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/data/chat/PlayerMessage.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/data/chat/PlayerMessage.java index d14c472..1e7ab83 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/data/chat/PlayerMessage.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/data/chat/PlayerMessage.java @@ -3,12 +3,12 @@ package land.chipmunk.chayapak.chomens_bot.data.chat; import net.kyori.adventure.text.Component; public class PlayerMessage { - public final MutablePlayerListEntry sender; + public final PlayerEntry sender; public final Component displayName; public final Component contents; public PlayerMessage ( - MutablePlayerListEntry sender, + PlayerEntry sender, Component displayName, Component contents ) { diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/BossbarManagerPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/BossbarManagerPlugin.java index 85d177c..e2b2ed7 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/BossbarManagerPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/BossbarManagerPlugin.java @@ -7,7 +7,7 @@ import com.github.steveice10.packetlib.packet.Packet; import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.data.BossBar; import land.chipmunk.chayapak.chomens_bot.data.BotBossBar; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; @@ -33,7 +33,7 @@ public class BossbarManagerPlugin extends Bot.Listener { bot.players.addListener(new PlayersPlugin.Listener() { @Override - public void playerJoined(MutablePlayerListEntry target) { + public void playerJoined(PlayerEntry target) { BossbarManagerPlugin.this.playerJoined(); } }); diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatCommandHandlerPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatCommandHandlerPlugin.java index 62984b9..485fedf 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatCommandHandlerPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatCommandHandlerPlugin.java @@ -1,7 +1,7 @@ package land.chipmunk.chayapak.chomens_bot.plugins; import land.chipmunk.chayapak.chomens_bot.Bot; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerMessage; import land.chipmunk.chayapak.chomens_bot.command.PlayerCommandContext; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; @@ -26,7 +26,7 @@ public class ChatCommandHandlerPlugin extends ChatPlugin.Listener { bot.commandSpy.addListener(new CommandSpyPlugin.Listener() { @Override - public void commandReceived(MutablePlayerListEntry sender, String command) { + public void commandReceived(PlayerEntry sender, String command) { ChatCommandHandlerPlugin.this.commandSpyMessageReceived(sender, command); } }); @@ -63,7 +63,7 @@ public class ChatCommandHandlerPlugin extends ChatPlugin.Listener { if (output != null) context.sendOutput(output); } - public void commandSpyMessageReceived (MutablePlayerListEntry sender, String command) { + public void commandSpyMessageReceived (PlayerEntry sender, String command) { try { if (sender.profile.getId().equals(bot.profile.getId())) return; } catch (Exception ignored) { diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java index 6418edc..d779872 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java @@ -13,7 +13,7 @@ import land.chipmunk.chayapak.chomens_bot.chatParsers.KaboomChatParser; import land.chipmunk.chayapak.chomens_bot.chatParsers.MinecraftChatParser; import land.chipmunk.chayapak.chomens_bot.chatParsers.U203aChatParser; import land.chipmunk.chayapak.chomens_bot.data.chat.ChatParser; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerMessage; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import land.chipmunk.chayapak.chomens_bot.util.IllegalCharactersUtilities; @@ -111,7 +111,7 @@ public class ChatPlugin extends Bot.Listener { public void packetReceived (ClientboundPlayerChatPacket packet) { final UUID senderUUID = packet.getSender(); - final MutablePlayerListEntry entry = bot.players.getEntry(senderUUID); + final PlayerEntry entry = bot.players.getEntry(senderUUID); if (entry == null) return; diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandSpyPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandSpyPlugin.java index bbe8fde..bb3849c 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandSpyPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandSpyPlugin.java @@ -1,7 +1,7 @@ package land.chipmunk.chayapak.chomens_bot.plugins; import land.chipmunk.chayapak.chomens_bot.Bot; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; @@ -44,7 +44,7 @@ public class CommandSpyPlugin extends ChatPlugin.Listener { final String username = textComponent.content(); final String command = ComponentUtilities.stringify(children.get(1)); - final MutablePlayerListEntry sender = bot.players.getEntry(username); + final PlayerEntry sender = bot.players.getEntry(username); if (sender == null) return; @@ -55,6 +55,6 @@ public class CommandSpyPlugin extends ChatPlugin.Listener { public void addListener (Listener listener) { listeners.add(listener); } public static class Listener { - public void commandReceived (MutablePlayerListEntry sender, String command) {} + public void commandReceived (PlayerEntry sender, String command) {} } } diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/FilterPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/FilterPlugin.java index caf5a54..1aed8f7 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/FilterPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/FilterPlugin.java @@ -5,7 +5,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.data.FilteredPlayer; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerMessage; import land.chipmunk.chayapak.chomens_bot.util.PersistentDataUtilities; import land.chipmunk.chayapak.chomens_bot.util.UUIDUtilities; @@ -42,7 +42,7 @@ public class FilterPlugin extends PlayersPlugin.Listener { bot.commandSpy.addListener(new CommandSpyPlugin.Listener() { @Override - public void commandReceived(MutablePlayerListEntry sender, String command) { + public void commandReceived(PlayerEntry sender, String command) { FilterPlugin.this.commandSpyMessageReceived(sender); } }); @@ -94,7 +94,7 @@ public class FilterPlugin extends PlayersPlugin.Listener { } @Override - public void playerJoined (MutablePlayerListEntry target) { + public void playerJoined (PlayerEntry target) { final FilteredPlayer player = getPlayer(target.profile.getName()); if (player == null) return; @@ -105,7 +105,7 @@ public class FilterPlugin extends PlayersPlugin.Listener { bot.exploits.kick(target.profile.getId()); } - public void commandSpyMessageReceived (MutablePlayerListEntry sender) { + public void commandSpyMessageReceived (PlayerEntry sender) { final FilteredPlayer player = getPlayer(sender.profile.getName()); if (player == null) return; @@ -124,16 +124,16 @@ public class FilterPlugin extends PlayersPlugin.Listener { mute(message.sender); } - private void mute (MutablePlayerListEntry target) { + private void mute (PlayerEntry target) { bot.core.run("essentials:mute " + target.profile.getIdAsString() + " 10y"); } - private void deOp (MutablePlayerListEntry target) { + private void deOp (PlayerEntry target) { bot.core.run("minecraft:execute run deop " + UUIDUtilities.selector(target.profile.getId())); } public void kick () { - for (MutablePlayerListEntry target : bot.players.list) { + for (PlayerEntry target : bot.players.list) { final FilteredPlayer player = getPlayer(target.profile.getName()); if (player == null) continue; @@ -147,7 +147,7 @@ public class FilterPlugin extends PlayersPlugin.Listener { PersistentDataUtilities.put("filters", filteredPlayers); - final MutablePlayerListEntry target = bot.players.getEntry(playerName); // fix not working for regex and ignorecase + final PlayerEntry target = bot.players.getEntry(playerName); // fix not working for regex and ignorecase if (target == null) return; diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MailPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MailPlugin.java index c96dc75..e907872 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MailPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MailPlugin.java @@ -5,7 +5,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.data.Mail; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities; import land.chipmunk.chayapak.chomens_bot.util.PersistentDataUtilities; import net.kyori.adventure.text.Component; @@ -34,7 +34,7 @@ public class MailPlugin extends PlayersPlugin.Listener { } @Override - public void playerJoined(MutablePlayerListEntry target) { + public void playerJoined(PlayerEntry target) { final String name = target.profile.getName(); final List sendTos = new ArrayList<>(); // confusing name,.,. diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PlayersPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PlayersPlugin.java index 1b632dd..0bd59dc 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PlayersPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PlayersPlugin.java @@ -10,7 +10,7 @@ import com.github.steveice10.packetlib.event.session.DisconnectedEvent; import com.github.steveice10.packetlib.packet.Packet; import com.google.gson.JsonObject; import land.chipmunk.chayapak.chomens_bot.Bot; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.util.PersistentDataUtilities; import net.kyori.adventure.text.Component; @@ -23,7 +23,7 @@ import java.util.UUID; public class PlayersPlugin extends Bot.Listener { private final Bot bot; - public final List list = new ArrayList<>(); + public final List list = new ArrayList<>(); private final List listeners = new ArrayList<>(); @@ -69,8 +69,8 @@ public class PlayersPlugin extends Bot.Listener { } } - public final MutablePlayerListEntry getEntry (UUID uuid) { - for (MutablePlayerListEntry candidate : list) { + public final PlayerEntry getEntry (UUID uuid) { + for (PlayerEntry candidate : list) { if (candidate.profile.getId().equals(uuid)) { return candidate; } @@ -79,8 +79,8 @@ public class PlayersPlugin extends Bot.Listener { return null; } - public final MutablePlayerListEntry getEntry (String username) { - for (MutablePlayerListEntry candidate : list) { + public final PlayerEntry getEntry (String username) { + for (PlayerEntry candidate : list) { if (getName(candidate).equals(username)) { return candidate; } @@ -89,8 +89,8 @@ public class PlayersPlugin extends Bot.Listener { return null; } - public final MutablePlayerListEntry getEntry (Component displayName) { - for (MutablePlayerListEntry candidate : list) { + public final PlayerEntry getEntry (Component displayName) { + for (PlayerEntry candidate : list) { if (candidate.displayName != null && candidate.displayName.equals(displayName)) { return candidate; } @@ -99,35 +99,35 @@ public class PlayersPlugin extends Bot.Listener { return null; } - public MutablePlayerListEntry getBotEntry () { return getEntry(bot.username); } + public PlayerEntry getBotEntry () { return getEntry(bot.username); } - private MutablePlayerListEntry getEntry (PlayerListEntry other) { + private PlayerEntry getEntry (PlayerListEntry other) { return getEntry(other.getProfile().getId()); } private void initializeChat (PlayerListEntry newEntry) { - final MutablePlayerListEntry target = getEntry(newEntry); + final PlayerEntry target = getEntry(newEntry); if (target == null) return; target.publicKey = newEntry.getPublicKey(); } private void updateListed (PlayerListEntry newEntry) { - final MutablePlayerListEntry target = getEntry(newEntry); + final PlayerEntry target = getEntry(newEntry); if (target == null) return; target.listed = newEntry.isListed(); } - private String getName(MutablePlayerListEntry target) { + private String getName(PlayerEntry target) { return bot.options.creayun ? target.profile.getName().replaceAll("§.", "") : target.profile.getName(); } private void addPlayer (PlayerListEntry newEntry) { - final MutablePlayerListEntry duplicate = getEntry(newEntry); + final PlayerEntry duplicate = getEntry(newEntry); if (duplicate != null) list.remove(duplicate); - final MutablePlayerListEntry target = new MutablePlayerListEntry(newEntry); + final PlayerEntry target = new PlayerEntry(newEntry); list.add(target); @@ -148,7 +148,7 @@ public class PlayersPlugin extends Bot.Listener { } private void updateGamemode (PlayerListEntry newEntry) { - final MutablePlayerListEntry target = getEntry(newEntry); + final PlayerEntry target = getEntry(newEntry); if (target == null) return; final GameMode gameMode = newEntry.getGameMode(); @@ -159,7 +159,7 @@ public class PlayersPlugin extends Bot.Listener { } private void updateLatency (PlayerListEntry newEntry) { - final MutablePlayerListEntry target = getEntry(newEntry); + final PlayerEntry target = getEntry(newEntry); if (target == null) return; final int ping = newEntry.getLatency(); @@ -170,7 +170,7 @@ public class PlayersPlugin extends Bot.Listener { } private void updateDisplayName (PlayerListEntry newEntry) { - final MutablePlayerListEntry target = getEntry(newEntry); + final PlayerEntry target = getEntry(newEntry); if (target == null) return; final Component displayName = newEntry.getDisplayName(); @@ -181,7 +181,7 @@ public class PlayersPlugin extends Bot.Listener { } private void removePlayer (UUID uuid) { - final MutablePlayerListEntry target = getEntry(uuid); + final PlayerEntry target = getEntry(uuid); if (target == null) return; bot.tabComplete.tabComplete("/minecraft:scoreboard players add ").thenApply(packet -> { @@ -227,12 +227,12 @@ public class PlayersPlugin extends Bot.Listener { public void addListener (Listener listener) { listeners.add(listener); } public static class Listener { - public void playerJoined (MutablePlayerListEntry target) {} - public void playerUnVanished (MutablePlayerListEntry target) {} - public void playerGameModeUpdated (MutablePlayerListEntry target, GameMode gameMode) {} - public void playerLatencyUpdated (MutablePlayerListEntry target, int ping) {} - public void playerDisplayNameUpdated (MutablePlayerListEntry target, Component displayName) {} - public void playerLeft (MutablePlayerListEntry target) {} - public void playerVanished (MutablePlayerListEntry target) {} + public void playerJoined (PlayerEntry target) {} + public void playerUnVanished (PlayerEntry target) {} + public void playerGameModeUpdated (PlayerEntry target, GameMode gameMode) {} + public void playerLatencyUpdated (PlayerEntry target, int ping) {} + public void playerDisplayNameUpdated (PlayerEntry target, Component displayName) {} + public void playerLeft (PlayerEntry target) {} + public void playerVanished (PlayerEntry target) {} } } diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PositionPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PositionPlugin.java index d190ab6..eed52c9 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PositionPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PositionPlugin.java @@ -11,7 +11,7 @@ import com.github.steveice10.packetlib.Session; import com.github.steveice10.packetlib.packet.Packet; import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.data.Rotation; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3i; @@ -28,7 +28,7 @@ public class PositionPlugin extends Bot.Listener { public Vector3i position = Vector3i.from(0, 0, 0); - private final Map entityIdMap = new HashMap<>(); + private final Map entityIdMap = new HashMap<>(); private final Map positionMap = new HashMap<>(); private final Map rotationMap = new HashMap<>(); @@ -55,7 +55,7 @@ public class PositionPlugin extends Bot.Listener { } public void packetReceived (ClientboundAddPlayerPacket packet) { - final MutablePlayerListEntry entry = bot.players.getEntry(packet.getUuid()); + final PlayerEntry entry = bot.players.getEntry(packet.getUuid()); if (entry == null) return; @@ -79,7 +79,7 @@ public class PositionPlugin extends Bot.Listener { } public void packetReceived (ClientboundMoveEntityRotPacket packet) { - final MutablePlayerListEntry player = entityIdMap.get(packet.getEntityId()); + final PlayerEntry player = entityIdMap.get(packet.getEntityId()); if (player == null) return; @@ -91,7 +91,7 @@ public class PositionPlugin extends Bot.Listener { } public void packetReceived (ClientboundMoveEntityPosPacket packet) { - final MutablePlayerListEntry player = entityIdMap.get(packet.getEntityId()); + final PlayerEntry player = entityIdMap.get(packet.getEntityId()); if (player == null) return; @@ -111,7 +111,7 @@ public class PositionPlugin extends Bot.Listener { } public void packetReceived (ClientboundMoveEntityPosRotPacket packet) { - final MutablePlayerListEntry player = entityIdMap.get(packet.getEntityId()); + final PlayerEntry player = entityIdMap.get(packet.getEntityId()); if (player == null) return; @@ -136,7 +136,7 @@ public class PositionPlugin extends Bot.Listener { public Vector3f getPlayerPosition (String playerName) { int entityId = -1; - for (Map.Entry entry : entityIdMap.entrySet()) { + for (Map.Entry entry : entityIdMap.entrySet()) { if (entry.getValue().profile.getName().equals(playerName)) entityId = entry.getKey(); } @@ -151,7 +151,7 @@ public class PositionPlugin extends Bot.Listener { public Rotation getPlayerRotation (String playerName) { int entityId = -1; - for (Map.Entry entry : entityIdMap.entrySet()) { + for (Map.Entry entry : entityIdMap.entrySet()) { if (entry.getValue().profile.getName().equals(playerName)) entityId = entry.getKey(); } @@ -168,6 +168,6 @@ public class PositionPlugin extends Bot.Listener { public static class Listener { public void positionChange (Vector3i position) {} - public void playerMoved (MutablePlayerListEntry player, Vector3f position, Rotation rotation) {} + public void playerMoved (PlayerEntry player, Vector3f position, Rotation rotation) {} } } diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/TrustedPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/TrustedPlugin.java index ef9a3a0..9ac7126 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/TrustedPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/TrustedPlugin.java @@ -1,7 +1,7 @@ package land.chipmunk.chayapak.chomens_bot.plugins; import land.chipmunk.chayapak.chomens_bot.Bot; -import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; @@ -39,7 +39,7 @@ public class TrustedPlugin extends PlayersPlugin.Listener { bot.logger.custom(Component.text("Trusted Broadcast").color(NamedTextColor.AQUA), component); for (String player : list) { - final MutablePlayerListEntry entry = bot.players.getEntry(player); + final PlayerEntry entry = bot.players.getEntry(player); if (entry == null) continue; @@ -53,7 +53,7 @@ public class TrustedPlugin extends PlayersPlugin.Listener { public void broadcast (Component message) { broadcast(message, null); } @Override - public void playerJoined (MutablePlayerListEntry target) { + public void playerJoined (PlayerEntry target) { if (!list.contains(target.profile.getName())) return; // based (VERY) @@ -95,7 +95,7 @@ public class TrustedPlugin extends PlayersPlugin.Listener { } @Override - public void playerLeft (MutablePlayerListEntry target) { + public void playerLeft (PlayerEntry target) { if (!list.contains(target.profile.getName())) return; broadcast(