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

This commit is contained in:
Chayapak 2024-11-27 16:58:18 +07:00
parent 392120f28b
commit 06522fadcc
Signed by: ChomeNS
SSH key fingerprint: SHA256:0YoxhdyXsgbc0nfeB2N6FYE60mxMU7DS4uCUMaw2mvA
7 changed files with 26 additions and 69 deletions

3
.gitignore vendored
View file

@ -9,8 +9,9 @@ run/
*.ipr *.ipr
*.iws *.iws
# Exploits plugin # Exploits stuff
src/main/java/me/chayapak1/chomens_bot/plugins/ExploitsPlugin.java src/main/java/me/chayapak1/chomens_bot/plugins/ExploitsPlugin.java
src/main/java/me/chayapak1/chomens_bot/data/exploitMethods/
# Testing plugins # Testing plugins
src/main/java/me/chayapak1/chomens_bot/plugins/testing src/main/java/me/chayapak1/chomens_bot/plugins/testing

View file

@ -1,27 +1,10 @@
# ChomeNS Bot Java # ChomeNS Bot Java
A Java verison of ChomeNS Bot. A Java version of ChomeNS Bot.
# Compiling # Compiling
You will see that the exploits plugin is missing because I gitignored it to prevent exploit leaks
To make this successfully compile just make `ExploitsPlugin.java` in the plugins folder and add this code: To make this successfully compile, you will have to fix the missing `ExploitsPlugin.java` in the `plugins` package, and also some enums related to it.
```java After that, you can now run `./gradlew build` to actually get the `.jar` file.
package me.chayapak1.chomens_bot.plugins;
import me.chayapak1.chomens_bot.Bot; The .jar file will be at `build/libs`, to run the bot simply do `java -jar chomens_bot-rolling-all.jar`
import java.util.UUID;
public class ExploitsPlugin {
public ExploitsPlugin (Bot bot) {}
public void kick (UUID uuid) {}
public void pcrash (UUID uuid) {}
}
```
Then at the root of the project run `./gradlew build` to build.
The .jar file will be at `build/libs`, to run the bot do `java -jar chomens_bot-rolling-all.jar`

View file

@ -1 +1 @@
1107 1111

View file

@ -4,9 +4,9 @@ import net.kyori.adventure.text.Component;
public abstract class Command { public abstract class Command {
public final String name; public final String name;
public final String description; public String description;
public final String[] usages; public String[] usages;
public final String[] aliases; public String[] aliases;
public final TrustLevel trustLevel; public final TrustLevel trustLevel;
public final boolean consoleOnly; 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.CommandException;
import me.chayapak1.chomens_bot.command.TrustLevel; import me.chayapak1.chomens_bot.command.TrustLevel;
import me.chayapak1.chomens_bot.data.PlayerEntry; import me.chayapak1.chomens_bot.data.PlayerEntry;
import me.chayapak1.chomens_bot.data.exploitMethods.Kick;
import me.chayapak1.chomens_bot.util.ColorUtilities; import me.chayapak1.chomens_bot.util.ColorUtilities;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import java.util.Arrays;
import java.util.UUID; import java.util.UUID;
public class KickCommand extends Command { public class KickCommand extends Command {
@ -16,17 +18,23 @@ public class KickCommand extends Command {
super( super(
"kick", "kick",
"Kicks a player", "Kicks a player",
new String[] { "<player>" }, new String[] {},
new String[] {}, new String[] {},
TrustLevel.TRUSTED, TrustLevel.TRUSTED,
false false
); );
final String allMethods = String.join("|", Arrays.stream(Kick.values()).map(Enum::name).toList());
this.usages = new String[] { "<" + allMethods + "> <player>" };
} }
@Override @Override
public Component execute(CommandContext context) throws CommandException { public Component execute(CommandContext context) throws CommandException {
final Bot bot = context.bot; final Bot bot = context.bot;
final Kick method = context.getEnum(Kick.class);
final PlayerEntry entry = bot.players.getEntry(context.getString(true, true)); final PlayerEntry entry = bot.players.getEntry(context.getString(true, true));
if (entry == null) throw new CommandException(Component.text("Invalid player name")); 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 String name = entry.profile.getName();
final UUID uuid = entry.profile.getId(); final UUID uuid = entry.profile.getId();
bot.exploits.kick(uuid); bot.exploits.kick(method, uuid);
return Component.empty() 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.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)); .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 EvalCommand());
registerCommand(new InfoCommand()); registerCommand(new InfoCommand());
registerCommand(new ConsoleCommand()); registerCommand(new ConsoleCommand());
registerCommand(new PCrashCommand());
// registerCommand(new ScreenshareCommand()); // registerCommand(new ScreenshareCommand());
registerCommand(new WhitelistCommand()); registerCommand(new WhitelistCommand());
registerCommand(new SeenCommand()); registerCommand(new SeenCommand());