MutablePlayerListEntry -> PlayerEntry + lazy fix

This commit is contained in:
Chayapak 2023-07-09 18:39:11 +07:00
parent c90597003d
commit 2411b97ea0
25 changed files with 97 additions and 96 deletions

View file

@ -32,11 +32,12 @@ repositories {
maven { maven {
url = uri('https://repo.maven.apache.org/maven2/') url = uri('https://repo.maven.apache.org/maven2/')
} }
mavenLocal()
} }
dependencies { dependencies {
implementation 'com.github.steveice10:mcprotocollib:1.20-1-SNAPSHOT' 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 'net.kyori:adventure-text-serializer-ansi:4.14.0'
implementation 'com.google.code.gson:gson:2.10.1' implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.google.guava:guava:31.1-jre' implementation 'com.google.guava:guava:31.1-jre'

View file

@ -4,7 +4,7 @@ import com.github.steveice10.mc.auth.data.GameProfile;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.data.chat.ChatParser; 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.data.chat.PlayerMessage;
import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@ -37,8 +37,8 @@ public class CreayunChatParser implements ChatParser {
final String displayName = matcher.group(1); final String displayName = matcher.group(1);
final String contents = matcher.group(2); final String contents = matcher.group(2);
MutablePlayerListEntry sender = bot.players.getEntry(displayName); PlayerEntry 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); 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)); return new PlayerMessage(sender, Component.text(displayName), Component.text(contents));
} }

View file

@ -4,7 +4,7 @@ import com.github.steveice10.mc.auth.data.GameProfile;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.data.chat.ChatParser; 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.data.chat.PlayerMessage;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TextComponent;
@ -43,9 +43,9 @@ public class KaboomChatParser implements ChatParser {
return null; 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 = 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); return new PlayerMessage(sender, displayName, contents);
} }

View file

@ -2,7 +2,7 @@ package land.chipmunk.chayapak.chomens_bot.chatParsers;
import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.data.chat.ChatParser; 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.data.chat.PlayerMessage;
import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@ -41,7 +41,7 @@ public class MinecraftChatParser implements ChatParser {
final Component senderComponent = args.get(0); final Component senderComponent = args.get(0);
final Component contents = args.get(1); final Component contents = args.get(1);
MutablePlayerListEntry sender; PlayerEntry sender;
final HoverEvent<?> hoverEvent = senderComponent.hoverEvent(); final HoverEvent<?> hoverEvent = senderComponent.hoverEvent();
if (hoverEvent != null && hoverEvent.action().equals(HoverEvent.Action.SHOW_ENTITY)) { if (hoverEvent != null && hoverEvent.action().equals(HoverEvent.Action.SHOW_ENTITY)) {

View file

@ -2,7 +2,7 @@ package land.chipmunk.chayapak.chomens_bot.chatParsers;
import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.data.chat.ChatParser; 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.data.chat.PlayerMessage;
import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@ -34,7 +34,7 @@ public class U203aChatParser implements ChatParser {
final Component senderComponent = args.get(1); final Component senderComponent = args.get(1);
final Component contents = args.get(2); final Component contents = args.get(2);
MutablePlayerListEntry sender; PlayerEntry sender;
final HoverEvent<?> hoverEvent = senderComponent.hoverEvent(); final HoverEvent<?> hoverEvent = senderComponent.hoverEvent();
if (hoverEvent != null && hoverEvent.action().equals(HoverEvent.Action.SHOW_ENTITY)) { if (hoverEvent != null && hoverEvent.action().equals(HoverEvent.Action.SHOW_ENTITY)) {
HoverEvent.ShowEntity entityInfo = (HoverEvent.ShowEntity) hoverEvent.value(); HoverEvent.ShowEntity entityInfo = (HoverEvent.ShowEntity) hoverEvent.value();

View file

@ -1,7 +1,7 @@
package land.chipmunk.chayapak.chomens_bot.command; package land.chipmunk.chayapak.chomens_bot.command;
import land.chipmunk.chayapak.chomens_bot.Bot; 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; import net.kyori.adventure.text.Component;
public class CommandContext { public class CommandContext {
@ -9,14 +9,14 @@ public class CommandContext {
public final String prefix; public final String prefix;
public final MutablePlayerListEntry sender; public final PlayerEntry sender;
public final String hash; public final String hash;
public final String ownerHash; public final String ownerHash;
public final boolean inGame; 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.bot = bot;
this.prefix = prefix; this.prefix = prefix;
this.sender = sender; this.sender = sender;

View file

@ -2,7 +2,7 @@ package land.chipmunk.chayapak.chomens_bot.command;
import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.auth.data.GameProfile;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; 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.util.CodeBlockUtilities;
import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities;
@ -23,7 +23,7 @@ public class DiscordCommandContext extends CommandContext {
super( super(
bot, bot,
prefix, prefix,
new MutablePlayerListEntry( new PlayerEntry(
new GameProfile( new GameProfile(
UUID.nameUUIDFromBytes(("OfflinePlayer:" + event.getAuthor().getName()).getBytes()), UUID.nameUUIDFromBytes(("OfflinePlayer:" + event.getAuthor().getName()).getBytes()),
event.getAuthor().getName() event.getAuthor().getName()

View file

@ -1,6 +1,6 @@
package land.chipmunk.chayapak.chomens_bot.command; 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 land.chipmunk.chayapak.chomens_bot.Bot;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@ -11,7 +11,7 @@ public class PlayerCommandContext extends CommandContext {
private final Bot bot; 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); super(bot, prefix, sender, hash, ownerHash, true);
this.bot = bot; this.bot = bot;
this.playerName = playerName; this.playerName = playerName;

View file

@ -2,7 +2,7 @@ package land.chipmunk.chayapak.chomens_bot.commands;
import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; 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.Command;
import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@ -26,7 +26,7 @@ public class ClearChatCommand extends Command {
final Bot bot = context.bot; final Bot bot = context.bot;
if (args.length > 0) { 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); if (entry == null) return Component.text("Invalid player name").color(NamedTextColor.RED);

View file

@ -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.Command;
import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; 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.ColorUtilities;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor; 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) { public Component execute(CommandContext context, String[] args, String[] fullArgs) {
final Bot bot = context.bot; 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); if (entry == null) return Component.text("Invalid player name").color(NamedTextColor.RED);

View file

@ -2,7 +2,7 @@ package land.chipmunk.chayapak.chomens_bot.commands;
import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; 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.Command;
import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities; 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) { public Component execute(CommandContext context, String[] args, String[] fullArgs) {
final Bot bot = context.bot; final Bot bot = context.bot;
final List<MutablePlayerListEntry> list = bot.players.list; final List<PlayerEntry> list = bot.players.list;
final List<Component> playersComponent = new ArrayList<>(); final List<Component> playersComponent = new ArrayList<>();
for (MutablePlayerListEntry entry : list) { for (PlayerEntry entry : list) {
playersComponent.add( playersComponent.add(
Component.translatable( Component.translatable(
"%s %s", "%s %s",

View file

@ -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.CommandContext;
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
import land.chipmunk.chayapak.chomens_bot.data.Mail; 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.plugins.MailPlugin;
import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities; import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities;
import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities;
@ -47,7 +47,7 @@ public class MailCommand extends Command {
final Bot bot = context.bot; final Bot bot = context.bot;
final MutablePlayerListEntry sender = context.sender; final PlayerEntry sender = context.sender;
final Gson gson = new Gson(); final Gson gson = new Gson();

View file

@ -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.Command;
import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; 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.ColorUtilities;
import land.chipmunk.chayapak.chomens_bot.util.MathUtilities; import land.chipmunk.chayapak.chomens_bot.util.MathUtilities;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@ -25,7 +25,7 @@ public class RandomTeleportCommand extends Command {
public Component execute(CommandContext context, String[] args, String[] fullArgs) { public Component execute(CommandContext context, String[] args, String[] fullArgs) {
final Bot bot = context.bot; 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 positionX = MathUtilities.between(-1_000_000, 1_000_000);
final int positionZ = MathUtilities.between(-1_000_000, 1_000_000); final int positionZ = MathUtilities.between(-1_000_000, 1_000_000);

View file

@ -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.Command;
import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; 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.ColorUtilities;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.ClickEvent;
@ -27,7 +27,7 @@ public class UUIDCommand extends Command {
final Bot bot = context.bot; final Bot bot = context.bot;
if (args.length > 0) { 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); 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(ColorUtilities.getColorByString(bot.config.colorPalette.uuid))
).color(NamedTextColor.GREEN); ).color(NamedTextColor.GREEN);
} else { } else {
final MutablePlayerListEntry entry = context.sender; final PlayerEntry entry = context.sender;
final String uuid = entry.profile.getIdAsString(); final String uuid = entry.profile.getIdAsString();

View file

@ -7,7 +7,7 @@ import net.kyori.adventure.text.Component;
import java.security.PublicKey; import java.security.PublicKey;
public class MutablePlayerListEntry { public class PlayerEntry {
public final GameProfile profile; public final GameProfile profile;
public GameMode gamemode; public GameMode gamemode;
public int latency; public int latency;
@ -17,7 +17,7 @@ public class MutablePlayerListEntry {
public final byte[] keySignature; public final byte[] keySignature;
public boolean listed; public boolean listed;
public MutablePlayerListEntry ( public PlayerEntry(
GameProfile profile, GameProfile profile,
GameMode gamemode, GameMode gamemode,
int latency, int latency,
@ -37,7 +37,7 @@ public class MutablePlayerListEntry {
this.listed = listed; 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()); this(entry.getProfile(), entry.getGameMode(), entry.getLatency(), entry.getDisplayName(), entry.getExpiresAt(), entry.getPublicKey(), entry.getKeySignature(), entry.isListed());
} }
} }

View file

@ -3,12 +3,12 @@ package land.chipmunk.chayapak.chomens_bot.data.chat;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
public class PlayerMessage { public class PlayerMessage {
public final MutablePlayerListEntry sender; public final PlayerEntry sender;
public final Component displayName; public final Component displayName;
public final Component contents; public final Component contents;
public PlayerMessage ( public PlayerMessage (
MutablePlayerListEntry sender, PlayerEntry sender,
Component displayName, Component displayName,
Component contents Component contents
) { ) {

View file

@ -7,7 +7,7 @@ import com.github.steveice10.packetlib.packet.Packet;
import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.data.BossBar; import land.chipmunk.chayapak.chomens_bot.data.BossBar;
import land.chipmunk.chayapak.chomens_bot.data.BotBossBar; 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 land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
@ -33,7 +33,7 @@ public class BossbarManagerPlugin extends Bot.Listener {
bot.players.addListener(new PlayersPlugin.Listener() { bot.players.addListener(new PlayersPlugin.Listener() {
@Override @Override
public void playerJoined(MutablePlayerListEntry target) { public void playerJoined(PlayerEntry target) {
BossbarManagerPlugin.this.playerJoined(); BossbarManagerPlugin.this.playerJoined();
} }
}); });

View file

@ -1,7 +1,7 @@
package land.chipmunk.chayapak.chomens_bot.plugins; package land.chipmunk.chayapak.chomens_bot.plugins;
import land.chipmunk.chayapak.chomens_bot.Bot; 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.data.chat.PlayerMessage;
import land.chipmunk.chayapak.chomens_bot.command.PlayerCommandContext; import land.chipmunk.chayapak.chomens_bot.command.PlayerCommandContext;
import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities;
@ -26,7 +26,7 @@ public class ChatCommandHandlerPlugin extends ChatPlugin.Listener {
bot.commandSpy.addListener(new CommandSpyPlugin.Listener() { bot.commandSpy.addListener(new CommandSpyPlugin.Listener() {
@Override @Override
public void commandReceived(MutablePlayerListEntry sender, String command) { public void commandReceived(PlayerEntry sender, String command) {
ChatCommandHandlerPlugin.this.commandSpyMessageReceived(sender, command); ChatCommandHandlerPlugin.this.commandSpyMessageReceived(sender, command);
} }
}); });
@ -63,7 +63,7 @@ public class ChatCommandHandlerPlugin extends ChatPlugin.Listener {
if (output != null) context.sendOutput(output); if (output != null) context.sendOutput(output);
} }
public void commandSpyMessageReceived (MutablePlayerListEntry sender, String command) { public void commandSpyMessageReceived (PlayerEntry sender, String command) {
try { try {
if (sender.profile.getId().equals(bot.profile.getId())) return; if (sender.profile.getId().equals(bot.profile.getId())) return;
} catch (Exception ignored) { } catch (Exception ignored) {

View file

@ -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.MinecraftChatParser;
import land.chipmunk.chayapak.chomens_bot.chatParsers.U203aChatParser; 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.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.data.chat.PlayerMessage;
import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities;
import land.chipmunk.chayapak.chomens_bot.util.IllegalCharactersUtilities; import land.chipmunk.chayapak.chomens_bot.util.IllegalCharactersUtilities;
@ -111,7 +111,7 @@ public class ChatPlugin extends Bot.Listener {
public void packetReceived (ClientboundPlayerChatPacket packet) { public void packetReceived (ClientboundPlayerChatPacket packet) {
final UUID senderUUID = packet.getSender(); final UUID senderUUID = packet.getSender();
final MutablePlayerListEntry entry = bot.players.getEntry(senderUUID); final PlayerEntry entry = bot.players.getEntry(senderUUID);
if (entry == null) return; if (entry == null) return;

View file

@ -1,7 +1,7 @@
package land.chipmunk.chayapak.chomens_bot.plugins; package land.chipmunk.chayapak.chomens_bot.plugins;
import land.chipmunk.chayapak.chomens_bot.Bot; 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 land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TextComponent;
@ -44,7 +44,7 @@ public class CommandSpyPlugin extends ChatPlugin.Listener {
final String username = textComponent.content(); final String username = textComponent.content();
final String command = ComponentUtilities.stringify(children.get(1)); 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; if (sender == null) return;
@ -55,6 +55,6 @@ public class CommandSpyPlugin extends ChatPlugin.Listener {
public void addListener (Listener listener) { listeners.add(listener); } public void addListener (Listener listener) { listeners.add(listener); }
public static class Listener { public static class Listener {
public void commandReceived (MutablePlayerListEntry sender, String command) {} public void commandReceived (PlayerEntry sender, String command) {}
} }
} }

View file

@ -5,7 +5,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.data.FilteredPlayer; 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.data.chat.PlayerMessage;
import land.chipmunk.chayapak.chomens_bot.util.PersistentDataUtilities; import land.chipmunk.chayapak.chomens_bot.util.PersistentDataUtilities;
import land.chipmunk.chayapak.chomens_bot.util.UUIDUtilities; import land.chipmunk.chayapak.chomens_bot.util.UUIDUtilities;
@ -42,7 +42,7 @@ public class FilterPlugin extends PlayersPlugin.Listener {
bot.commandSpy.addListener(new CommandSpyPlugin.Listener() { bot.commandSpy.addListener(new CommandSpyPlugin.Listener() {
@Override @Override
public void commandReceived(MutablePlayerListEntry sender, String command) { public void commandReceived(PlayerEntry sender, String command) {
FilterPlugin.this.commandSpyMessageReceived(sender); FilterPlugin.this.commandSpyMessageReceived(sender);
} }
}); });
@ -94,7 +94,7 @@ public class FilterPlugin extends PlayersPlugin.Listener {
} }
@Override @Override
public void playerJoined (MutablePlayerListEntry target) { public void playerJoined (PlayerEntry target) {
final FilteredPlayer player = getPlayer(target.profile.getName()); final FilteredPlayer player = getPlayer(target.profile.getName());
if (player == null) return; if (player == null) return;
@ -105,7 +105,7 @@ public class FilterPlugin extends PlayersPlugin.Listener {
bot.exploits.kick(target.profile.getId()); bot.exploits.kick(target.profile.getId());
} }
public void commandSpyMessageReceived (MutablePlayerListEntry sender) { public void commandSpyMessageReceived (PlayerEntry sender) {
final FilteredPlayer player = getPlayer(sender.profile.getName()); final FilteredPlayer player = getPlayer(sender.profile.getName());
if (player == null) return; if (player == null) return;
@ -124,16 +124,16 @@ public class FilterPlugin extends PlayersPlugin.Listener {
mute(message.sender); mute(message.sender);
} }
private void mute (MutablePlayerListEntry target) { private void mute (PlayerEntry target) {
bot.core.run("essentials:mute " + target.profile.getIdAsString() + " 10y"); 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())); bot.core.run("minecraft:execute run deop " + UUIDUtilities.selector(target.profile.getId()));
} }
public void kick () { public void kick () {
for (MutablePlayerListEntry target : bot.players.list) { for (PlayerEntry target : bot.players.list) {
final FilteredPlayer player = getPlayer(target.profile.getName()); final FilteredPlayer player = getPlayer(target.profile.getName());
if (player == null) continue; if (player == null) continue;
@ -147,7 +147,7 @@ public class FilterPlugin extends PlayersPlugin.Listener {
PersistentDataUtilities.put("filters", filteredPlayers); 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; if (target == null) return;

View file

@ -5,7 +5,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.data.Mail; 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.ColorUtilities;
import land.chipmunk.chayapak.chomens_bot.util.PersistentDataUtilities; import land.chipmunk.chayapak.chomens_bot.util.PersistentDataUtilities;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@ -34,7 +34,7 @@ public class MailPlugin extends PlayersPlugin.Listener {
} }
@Override @Override
public void playerJoined(MutablePlayerListEntry target) { public void playerJoined(PlayerEntry target) {
final String name = target.profile.getName(); final String name = target.profile.getName();
final List<String> sendTos = new ArrayList<>(); // confusing name,.,. final List<String> sendTos = new ArrayList<>(); // confusing name,.,.

View file

@ -10,7 +10,7 @@ import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.packet.Packet;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import land.chipmunk.chayapak.chomens_bot.Bot; 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 land.chipmunk.chayapak.chomens_bot.util.PersistentDataUtilities;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@ -23,7 +23,7 @@ import java.util.UUID;
public class PlayersPlugin extends Bot.Listener { public class PlayersPlugin extends Bot.Listener {
private final Bot bot; private final Bot bot;
public final List<MutablePlayerListEntry> list = new ArrayList<>(); public final List<PlayerEntry> list = new ArrayList<>();
private final List<Listener> listeners = new ArrayList<>(); private final List<Listener> listeners = new ArrayList<>();
@ -69,8 +69,8 @@ public class PlayersPlugin extends Bot.Listener {
} }
} }
public final MutablePlayerListEntry getEntry (UUID uuid) { public final PlayerEntry getEntry (UUID uuid) {
for (MutablePlayerListEntry candidate : list) { for (PlayerEntry candidate : list) {
if (candidate.profile.getId().equals(uuid)) { if (candidate.profile.getId().equals(uuid)) {
return candidate; return candidate;
} }
@ -79,8 +79,8 @@ public class PlayersPlugin extends Bot.Listener {
return null; return null;
} }
public final MutablePlayerListEntry getEntry (String username) { public final PlayerEntry getEntry (String username) {
for (MutablePlayerListEntry candidate : list) { for (PlayerEntry candidate : list) {
if (getName(candidate).equals(username)) { if (getName(candidate).equals(username)) {
return candidate; return candidate;
} }
@ -89,8 +89,8 @@ public class PlayersPlugin extends Bot.Listener {
return null; return null;
} }
public final MutablePlayerListEntry getEntry (Component displayName) { public final PlayerEntry getEntry (Component displayName) {
for (MutablePlayerListEntry candidate : list) { for (PlayerEntry candidate : list) {
if (candidate.displayName != null && candidate.displayName.equals(displayName)) { if (candidate.displayName != null && candidate.displayName.equals(displayName)) {
return candidate; return candidate;
} }
@ -99,35 +99,35 @@ public class PlayersPlugin extends Bot.Listener {
return null; 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()); return getEntry(other.getProfile().getId());
} }
private void initializeChat (PlayerListEntry newEntry) { private void initializeChat (PlayerListEntry newEntry) {
final MutablePlayerListEntry target = getEntry(newEntry); final PlayerEntry target = getEntry(newEntry);
if (target == null) return; if (target == null) return;
target.publicKey = newEntry.getPublicKey(); target.publicKey = newEntry.getPublicKey();
} }
private void updateListed (PlayerListEntry newEntry) { private void updateListed (PlayerListEntry newEntry) {
final MutablePlayerListEntry target = getEntry(newEntry); final PlayerEntry target = getEntry(newEntry);
if (target == null) return; if (target == null) return;
target.listed = newEntry.isListed(); 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(); return bot.options.creayun ? target.profile.getName().replaceAll("§.", "") : target.profile.getName();
} }
private void addPlayer (PlayerListEntry newEntry) { private void addPlayer (PlayerListEntry newEntry) {
final MutablePlayerListEntry duplicate = getEntry(newEntry); final PlayerEntry duplicate = getEntry(newEntry);
if (duplicate != null) list.remove(duplicate); if (duplicate != null) list.remove(duplicate);
final MutablePlayerListEntry target = new MutablePlayerListEntry(newEntry); final PlayerEntry target = new PlayerEntry(newEntry);
list.add(target); list.add(target);
@ -148,7 +148,7 @@ public class PlayersPlugin extends Bot.Listener {
} }
private void updateGamemode (PlayerListEntry newEntry) { private void updateGamemode (PlayerListEntry newEntry) {
final MutablePlayerListEntry target = getEntry(newEntry); final PlayerEntry target = getEntry(newEntry);
if (target == null) return; if (target == null) return;
final GameMode gameMode = newEntry.getGameMode(); final GameMode gameMode = newEntry.getGameMode();
@ -159,7 +159,7 @@ public class PlayersPlugin extends Bot.Listener {
} }
private void updateLatency (PlayerListEntry newEntry) { private void updateLatency (PlayerListEntry newEntry) {
final MutablePlayerListEntry target = getEntry(newEntry); final PlayerEntry target = getEntry(newEntry);
if (target == null) return; if (target == null) return;
final int ping = newEntry.getLatency(); final int ping = newEntry.getLatency();
@ -170,7 +170,7 @@ public class PlayersPlugin extends Bot.Listener {
} }
private void updateDisplayName (PlayerListEntry newEntry) { private void updateDisplayName (PlayerListEntry newEntry) {
final MutablePlayerListEntry target = getEntry(newEntry); final PlayerEntry target = getEntry(newEntry);
if (target == null) return; if (target == null) return;
final Component displayName = newEntry.getDisplayName(); final Component displayName = newEntry.getDisplayName();
@ -181,7 +181,7 @@ public class PlayersPlugin extends Bot.Listener {
} }
private void removePlayer (UUID uuid) { private void removePlayer (UUID uuid) {
final MutablePlayerListEntry target = getEntry(uuid); final PlayerEntry target = getEntry(uuid);
if (target == null) return; if (target == null) return;
bot.tabComplete.tabComplete("/minecraft:scoreboard players add ").thenApply(packet -> { 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 void addListener (Listener listener) { listeners.add(listener); }
public static class Listener { public static class Listener {
public void playerJoined (MutablePlayerListEntry target) {} public void playerJoined (PlayerEntry target) {}
public void playerUnVanished (MutablePlayerListEntry target) {} public void playerUnVanished (PlayerEntry target) {}
public void playerGameModeUpdated (MutablePlayerListEntry target, GameMode gameMode) {} public void playerGameModeUpdated (PlayerEntry target, GameMode gameMode) {}
public void playerLatencyUpdated (MutablePlayerListEntry target, int ping) {} public void playerLatencyUpdated (PlayerEntry target, int ping) {}
public void playerDisplayNameUpdated (MutablePlayerListEntry target, Component displayName) {} public void playerDisplayNameUpdated (PlayerEntry target, Component displayName) {}
public void playerLeft (MutablePlayerListEntry target) {} public void playerLeft (PlayerEntry target) {}
public void playerVanished (MutablePlayerListEntry target) {} public void playerVanished (PlayerEntry target) {}
} }
} }

View file

@ -11,7 +11,7 @@ import com.github.steveice10.packetlib.Session;
import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.packet.Packet;
import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.data.Rotation; 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.Vector3f;
import org.cloudburstmc.math.vector.Vector3i; import org.cloudburstmc.math.vector.Vector3i;
@ -28,7 +28,7 @@ public class PositionPlugin extends Bot.Listener {
public Vector3i position = Vector3i.from(0, 0, 0); public Vector3i position = Vector3i.from(0, 0, 0);
private final Map<Integer, MutablePlayerListEntry> entityIdMap = new HashMap<>(); private final Map<Integer, PlayerEntry> entityIdMap = new HashMap<>();
private final Map<Integer, Vector3f> positionMap = new HashMap<>(); private final Map<Integer, Vector3f> positionMap = new HashMap<>();
private final Map<Integer, Rotation> rotationMap = new HashMap<>(); private final Map<Integer, Rotation> rotationMap = new HashMap<>();
@ -55,7 +55,7 @@ public class PositionPlugin extends Bot.Listener {
} }
public void packetReceived (ClientboundAddPlayerPacket packet) { 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; if (entry == null) return;
@ -79,7 +79,7 @@ public class PositionPlugin extends Bot.Listener {
} }
public void packetReceived (ClientboundMoveEntityRotPacket packet) { public void packetReceived (ClientboundMoveEntityRotPacket packet) {
final MutablePlayerListEntry player = entityIdMap.get(packet.getEntityId()); final PlayerEntry player = entityIdMap.get(packet.getEntityId());
if (player == null) return; if (player == null) return;
@ -91,7 +91,7 @@ public class PositionPlugin extends Bot.Listener {
} }
public void packetReceived (ClientboundMoveEntityPosPacket packet) { public void packetReceived (ClientboundMoveEntityPosPacket packet) {
final MutablePlayerListEntry player = entityIdMap.get(packet.getEntityId()); final PlayerEntry player = entityIdMap.get(packet.getEntityId());
if (player == null) return; if (player == null) return;
@ -111,7 +111,7 @@ public class PositionPlugin extends Bot.Listener {
} }
public void packetReceived (ClientboundMoveEntityPosRotPacket packet) { public void packetReceived (ClientboundMoveEntityPosRotPacket packet) {
final MutablePlayerListEntry player = entityIdMap.get(packet.getEntityId()); final PlayerEntry player = entityIdMap.get(packet.getEntityId());
if (player == null) return; if (player == null) return;
@ -136,7 +136,7 @@ public class PositionPlugin extends Bot.Listener {
public Vector3f getPlayerPosition (String playerName) { public Vector3f getPlayerPosition (String playerName) {
int entityId = -1; int entityId = -1;
for (Map.Entry<Integer, MutablePlayerListEntry> entry : entityIdMap.entrySet()) { for (Map.Entry<Integer, PlayerEntry> entry : entityIdMap.entrySet()) {
if (entry.getValue().profile.getName().equals(playerName)) entityId = entry.getKey(); 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) { public Rotation getPlayerRotation (String playerName) {
int entityId = -1; int entityId = -1;
for (Map.Entry<Integer, MutablePlayerListEntry> entry : entityIdMap.entrySet()) { for (Map.Entry<Integer, PlayerEntry> entry : entityIdMap.entrySet()) {
if (entry.getValue().profile.getName().equals(playerName)) entityId = entry.getKey(); 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 static class Listener {
public void positionChange (Vector3i position) {} public void positionChange (Vector3i position) {}
public void playerMoved (MutablePlayerListEntry player, Vector3f position, Rotation rotation) {} public void playerMoved (PlayerEntry player, Vector3f position, Rotation rotation) {}
} }
} }

View file

@ -1,7 +1,7 @@
package land.chipmunk.chayapak.chomens_bot.plugins; package land.chipmunk.chayapak.chomens_bot.plugins;
import land.chipmunk.chayapak.chomens_bot.Bot; 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 land.chipmunk.chayapak.chomens_bot.util.ColorUtilities;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor; 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); bot.logger.custom(Component.text("Trusted Broadcast").color(NamedTextColor.AQUA), component);
for (String player : list) { for (String player : list) {
final MutablePlayerListEntry entry = bot.players.getEntry(player); final PlayerEntry entry = bot.players.getEntry(player);
if (entry == null) continue; if (entry == null) continue;
@ -53,7 +53,7 @@ public class TrustedPlugin extends PlayersPlugin.Listener {
public void broadcast (Component message) { broadcast(message, null); } public void broadcast (Component message) { broadcast(message, null); }
@Override @Override
public void playerJoined (MutablePlayerListEntry target) { public void playerJoined (PlayerEntry target) {
if (!list.contains(target.profile.getName())) return; if (!list.contains(target.profile.getName())) return;
// based (VERY) // based (VERY)
@ -95,7 +95,7 @@ public class TrustedPlugin extends PlayersPlugin.Listener {
} }
@Override @Override
public void playerLeft (MutablePlayerListEntry target) { public void playerLeft (PlayerEntry target) {
if (!list.contains(target.profile.getName())) return; if (!list.contains(target.profile.getName())) return;
broadcast( broadcast(