feat: stop skids from making 69420 clones + some more stuff

This commit is contained in:
ChomeNS
2024-11-27 16:58:18 +07:00
parent 392120f28b
commit 06522fadcc
7 changed files with 26 additions and 69 deletions

View File

@@ -4,9 +4,9 @@ import net.kyori.adventure.text.Component;
public abstract class Command {
public final String name;
public final String description;
public final String[] usages;
public final String[] aliases;
public String description;
public String[] usages;
public String[] aliases;
public final TrustLevel trustLevel;
public final boolean consoleOnly;

View File

@@ -6,9 +6,11 @@ import me.chayapak1.chomens_bot.command.CommandContext;
import me.chayapak1.chomens_bot.command.CommandException;
import me.chayapak1.chomens_bot.command.TrustLevel;
import me.chayapak1.chomens_bot.data.PlayerEntry;
import me.chayapak1.chomens_bot.data.exploitMethods.Kick;
import me.chayapak1.chomens_bot.util.ColorUtilities;
import net.kyori.adventure.text.Component;
import java.util.Arrays;
import java.util.UUID;
public class KickCommand extends Command {
@@ -16,17 +18,23 @@ public class KickCommand extends Command {
super(
"kick",
"Kicks a player",
new String[] { "<player>" },
new String[] {},
new String[] {},
TrustLevel.TRUSTED,
false
);
final String allMethods = String.join("|", Arrays.stream(Kick.values()).map(Enum::name).toList());
this.usages = new String[] { "<" + allMethods + "> <player>" };
}
@Override
public Component execute(CommandContext context) throws CommandException {
final Bot bot = context.bot;
final Kick method = context.getEnum(Kick.class);
final PlayerEntry entry = bot.players.getEntry(context.getString(true, true));
if (entry == null) throw new CommandException(Component.text("Invalid player name"));
@@ -34,11 +42,16 @@ public class KickCommand extends Command {
final String name = entry.profile.getName();
final UUID uuid = entry.profile.getId();
bot.exploits.kick(uuid);
bot.exploits.kick(method, uuid);
return Component.empty()
.append(Component.text("Kicking player "))
.append(Component.text("Kicking player"))
.append(Component.space())
.append(Component.text(name).color(ColorUtilities.getColorByString(bot.config.colorPalette.username)))
.append(Component.space())
.append(Component.text("with method"))
.append(Component.space())
.append(Component.text(method.name()).color(ColorUtilities.getColorByString(bot.config.colorPalette.string)))
.color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor));
}
}

View File

@@ -1,39 +0,0 @@
package me.chayapak1.chomens_bot.commands;
import me.chayapak1.chomens_bot.Bot;
import me.chayapak1.chomens_bot.command.Command;
import me.chayapak1.chomens_bot.command.CommandContext;
import me.chayapak1.chomens_bot.command.CommandException;
import me.chayapak1.chomens_bot.command.TrustLevel;
import me.chayapak1.chomens_bot.data.PlayerEntry;
import me.chayapak1.chomens_bot.util.ColorUtilities;
import net.kyori.adventure.text.Component;
public class PCrashCommand extends Command {
public PCrashCommand () {
super(
"pcrash",
"Crashes a player using particle",
new String[] { "<player>" },
new String[] { "particlecrash" },
TrustLevel.TRUSTED,
false
);
}
@Override
public Component execute(CommandContext context) throws CommandException {
final Bot bot = context.bot;
final PlayerEntry player = bot.players.getEntry(context.getString(true, true));
if (player == null) throw new CommandException(Component.text("Invalid player name"));
bot.exploits.pcrash(player.profile.getId());
return Component.translatable(
"Attempting to crash %s",
Component.text(player.profile.getName()).color(ColorUtilities.getColorByString(bot.config.colorPalette.secondary))
).color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor));
}
}

View File

@@ -51,7 +51,6 @@ public class CommandHandlerPlugin {
registerCommand(new EvalCommand());
registerCommand(new InfoCommand());
registerCommand(new ConsoleCommand());
registerCommand(new PCrashCommand());
// registerCommand(new ScreenshareCommand());
registerCommand(new WhitelistCommand());
registerCommand(new SeenCommand());