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
*.iws
# Exploits plugin
# Exploits stuff
src/main/java/me/chayapak1/chomens_bot/plugins/ExploitsPlugin.java
src/main/java/me/chayapak1/chomens_bot/data/exploitMethods/
# Testing plugins
src/main/java/me/chayapak1/chomens_bot/plugins/testing

View file

@ -1,27 +1,10 @@
# ChomeNS Bot Java
A Java verison of ChomeNS Bot.
A Java version of ChomeNS Bot.
# 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
package me.chayapak1.chomens_bot.plugins;
After that, you can now run `./gradlew build` to actually get the `.jar` file.
import me.chayapak1.chomens_bot.Bot;
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`
The .jar file will be at `build/libs`, to run the bot simply 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 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());