From 6acc76171a2e0ea07c1f9fc5fe074db60aa3ba8e Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 2 Jul 2023 10:09:56 +0700 Subject: [PATCH] some among us lol --- .../chomens_bot/commands/BruhifyCommand.java | 3 --- .../commands/ClearChatCommand.java | 2 -- .../commands/ClearChatQueueCommand.java | 24 ------------------- .../chomens_bot/commands/CreatorCommand.java | 3 --- .../chayapak/chomens_bot/data/BossBar.java | 2 +- .../chomens_bot/data/FilteredPlayer.java | 6 ++--- .../chayapak/chomens_bot/data/Mail.java | 10 ++++---- .../data/chat/MutablePlayerListEntry.java | 6 ++--- .../plugins/BossbarManagerPlugin.java | 4 ++-- .../chomens_bot/plugins/ChatPlugin.java | 2 +- .../plugins/CommandHandlerPlugin.java | 2 +- .../plugins/CommandSuggestionPlugin.java | 2 +- .../chomens_bot/plugins/DiscordPlugin.java | 2 +- .../chomens_bot/plugins/LoggerPlugin.java | 2 +- .../plugins/MusicPlayerPlugin.java | 2 +- .../plugins/PacketSnifferPlugin.java | 2 +- .../chomens_bot/plugins/SelfCarePlugin.java | 2 +- .../chomens_bot/plugins/TPSPlugin.java | 4 ++-- .../chayapak/chomens_bot/song/Note.java | 12 +++++----- .../chomens_bot/util/ComponentUtilities.java | 2 +- 20 files changed, 31 insertions(+), 63 deletions(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BruhifyCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BruhifyCommand.java index 37d0d81..247a67d 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BruhifyCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BruhifyCommand.java @@ -6,9 +6,6 @@ import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; import net.kyori.adventure.text.Component; -import java.util.ArrayList; -import java.util.List; - public class BruhifyCommand extends Command { public BruhifyCommand () { super( 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 2865e2a..e2283f6 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 @@ -8,8 +8,6 @@ import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; -import java.util.ArrayList; -import java.util.List; import java.util.UUID; public class ClearChatCommand extends Command { diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ClearChatQueueCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ClearChatQueueCommand.java index b99b7c0..830b6ae 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ClearChatQueueCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ClearChatQueueCommand.java @@ -20,30 +20,6 @@ public class ClearChatQueueCommand extends Command { ); } - public String name() { return "clearchatqueue"; } - - public String description() { - return "Clears the bot's chat queue"; - } - - public List usage() { - final List usages = new ArrayList<>(); - usages.add(""); - - return usages; - } - - public List alias() { - final List aliases = new ArrayList<>(); - aliases.add("ccq"); - - return aliases; - } - - public TrustLevel trustLevel() { - return TrustLevel.PUBLIC; - } - @Override public Component execute(CommandContext context, String[] args, String[] fullArgs) { final Bot bot = context.bot; diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CreatorCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CreatorCommand.java index 575d142..42bc16f 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CreatorCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CreatorCommand.java @@ -7,9 +7,6 @@ import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities; import net.kyori.adventure.text.Component; -import java.util.ArrayList; -import java.util.List; - public class CreatorCommand extends Command { public CreatorCommand () { super( diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/data/BossBar.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/data/BossBar.java index 2a739f0..e3e2867 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/data/BossBar.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/data/BossBar.java @@ -7,7 +7,7 @@ import net.kyori.adventure.text.Component; import java.util.UUID; public class BossBar { - public UUID uuid; + public final UUID uuid; public Component title; public BossBarColor color; diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/data/FilteredPlayer.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/data/FilteredPlayer.java index 88074c9..8ccf477 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/data/FilteredPlayer.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/data/FilteredPlayer.java @@ -1,9 +1,9 @@ package land.chipmunk.chayapak.chomens_bot.data; public class FilteredPlayer { - public String playerName; - public boolean regex; - public boolean ignoreCase; + public final String playerName; + public final boolean regex; + public final boolean ignoreCase; public FilteredPlayer ( String playerName, diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/data/Mail.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/data/Mail.java index 3ba185e..3954337 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/data/Mail.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/data/Mail.java @@ -1,11 +1,11 @@ package land.chipmunk.chayapak.chomens_bot.data; public class Mail { - public String sentBy; - public String sentTo; - public long timeSent; - public String server; - public String contents; + public final String sentBy; + public final String sentTo; + public final long timeSent; + public final String server; + public final String contents; public Mail ( String sentBy, 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/MutablePlayerListEntry.java index 9b57dbb..e5dcf65 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/MutablePlayerListEntry.java @@ -8,13 +8,13 @@ import net.kyori.adventure.text.Component; import java.security.PublicKey; public class MutablePlayerListEntry { - public GameProfile profile; + public final GameProfile profile; public GameMode gamemode; public int latency; public Component displayName; - public long expiresAt; + public final long expiresAt; public PublicKey publicKey; - public byte[] keySignature; + public final byte[] keySignature; public boolean listed; public MutablePlayerListEntry ( 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 a74f485..e62de89 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 @@ -22,9 +22,9 @@ public class BossbarManagerPlugin extends Bot.Listener { public final Map serverBossBars = new HashMap<>(); private final Map bossBars = new HashMap<>(); - public boolean enabled = true; + public final boolean enabled = true; - public String bossBarPrefix = "chomens_bot:"; + public final String bossBarPrefix = "chomens_bot:"; public BossbarManagerPlugin (Bot bot) { this.bot = bot; 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 b8da2a9..c8c8bb1 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 @@ -41,7 +41,7 @@ public class ChatPlugin extends Bot.Listener { private final List queue = new ArrayList<>(); - public int queueDelay; + public final int queueDelay; private final List listeners = new ArrayList<>(); diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java index 15e3535..1ada15d 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java @@ -22,7 +22,7 @@ public class CommandHandlerPlugin { public final List commands = new ArrayList<>(); - public boolean disabled = false; + public final boolean disabled = false; public CommandHandlerPlugin (Bot bot) { this.bot = bot; diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandSuggestionPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandSuggestionPlugin.java index 5df0f92..4ee95ae 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandSuggestionPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandSuggestionPlugin.java @@ -12,7 +12,7 @@ import java.util.List; public class CommandSuggestionPlugin extends ChatPlugin.Listener { private final Bot bot; - public String id = "chomens_bot_command_suggestion"; + public final String id = "chomens_bot_command_suggestion"; public CommandSuggestionPlugin (Bot bot) { this.bot = bot; diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/DiscordPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/DiscordPlugin.java index 43afeac..babc178 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/DiscordPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/DiscordPlugin.java @@ -29,7 +29,7 @@ import java.util.List; // please ignore my ohio code // also this is one of the classes which has >100 lines or actually >300 LMAO public class DiscordPlugin { - public JDA jda; + public final JDA jda; public final Map servers; diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/LoggerPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/LoggerPlugin.java index 6a2fc78..89be330 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/LoggerPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/LoggerPlugin.java @@ -16,7 +16,7 @@ public class LoggerPlugin extends ChatPlugin.Listener { private boolean addedListener = false; - public boolean logToConsole = true; + public final boolean logToConsole = true; private final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss"); diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MusicPlayerPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MusicPlayerPlugin.java index 5aca811..19e67f4 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MusicPlayerPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MusicPlayerPlugin.java @@ -29,7 +29,7 @@ public class MusicPlayerPlugin extends Bot.Listener { } public Song currentSong; - public List songQueue = new ArrayList<>(); + public final List songQueue = new ArrayList<>(); public SongLoaderRunnable loaderThread; public Loop loop = Loop.OFF; diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PacketSnifferPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PacketSnifferPlugin.java index 40b8f74..779c3c9 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PacketSnifferPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PacketSnifferPlugin.java @@ -11,7 +11,7 @@ import java.nio.charset.StandardCharsets; // normally unused in the main instance of the bot public class PacketSnifferPlugin extends Bot.Listener { - public boolean enabled = false; + public final boolean enabled = false; private OutputStreamWriter writer; diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/SelfCarePlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/SelfCarePlugin.java index 3820cfb..48fce0b 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/SelfCarePlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/SelfCarePlugin.java @@ -158,7 +158,7 @@ public class SelfCarePlugin extends Bot.Listener { final GameEvent notification = packet.getNotification(); final GameEventValue value = packet.getValue(); - if (notification == GameEvent.ENTER_CREDITS) { + if (notification == GameEvent.ENTER_CREDITS && bot.config.selfCare.endCredits) { bot.session.send(new ServerboundClientCommandPacket(ClientCommand.RESPAWN)); return; } diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/TPSPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/TPSPlugin.java index e45c17c..bd4b1f0 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/TPSPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/TPSPlugin.java @@ -70,9 +70,9 @@ public class TPSPlugin extends Bot.Listener { } private void updateTPSBar () { - try { - if (!enabled) return; + if (!enabled) return; + try { final double tickRate = getTickRate(); final DecimalFormat formatter = new DecimalFormat("##.##"); diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/song/Note.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/song/Note.java index e00c156..a10b4ae 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/song/Note.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/song/Note.java @@ -2,12 +2,12 @@ package land.chipmunk.chayapak.chomens_bot.song; // Author: hhhzzzsss public class Note implements Comparable { - public Instrument instrument; - public int pitch; - public float volume; - public long time; - public int panning; - public int stereo; + public final Instrument instrument; + public final int pitch; + public final float volume; + public final long time; + public final int panning; + public final int stereo; public Note ( Instrument instrument, diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/util/ComponentUtilities.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/util/ComponentUtilities.java index 744b678..cc72ccc 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/util/ComponentUtilities.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/util/ComponentUtilities.java @@ -62,7 +62,7 @@ public class ComponentUtilities { ansiMap.put("r", "\u001b[0m"); } - private static record PartiallyStringifiedOutput ( + private record PartiallyStringifiedOutput ( String output, String lastColor ) {}