JsonSerializable needs fixing
This commit is contained in:
48
build.sh
Executable file
48
build.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Run Gradle build
|
||||
./gradlew build
|
||||
|
||||
# Check if the build was successful
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Gradle build successful."
|
||||
|
||||
# SFTP upload
|
||||
SFTP_HOST="192.168.1.199"
|
||||
SFTP_USER="trouper"
|
||||
SFTP_PASSWORD="Trouper12()1"
|
||||
SFTP_REMOTE_DIR="/home/trouper/docker/data/plugins/"
|
||||
|
||||
# Create a temporary file with a unique name
|
||||
TEMP_FILE=$(mktemp)
|
||||
|
||||
# Specify the local file to upload
|
||||
LOCAL_FILE="/run/media/trouper/'1TB drive'/IJ/IdeaProjects/Sentinel/build/libs/Sentinel-0.2.2.jar"
|
||||
|
||||
# Write the SFTP commands to the temporary file
|
||||
echo "put $LOCAL_FILE $SFTP_REMOTE_DIR" > "$TEMP_FILE"
|
||||
echo "bye" >> "$TEMP_FILE"
|
||||
|
||||
# Use sftp non-interactively with the specified commands
|
||||
sftp -oStrictHostKeyChecking=no -oBatchMode=no -b "$TEMP_FILE" "$SFTP_USER@$SFTP_HOST" <<EOF
|
||||
$SFTP_PASSWORD
|
||||
EOF
|
||||
|
||||
# Remove the temporary file
|
||||
rm -f "$TEMP_FILE"
|
||||
|
||||
# SSH command to reload the plugin on the host
|
||||
SSH_COMMANDS=(
|
||||
"pm reload Sentinel"
|
||||
"execute at @a run playsound minecraft:entity.experience_orb.pickup master @a \~ \~ \~ 100 1 1"
|
||||
"tellraw @a '\"'[Server] Reload Complete, Upload Successful.'\"'"
|
||||
)
|
||||
|
||||
for cmd in "${SSH_COMMANDS[@]}"; do
|
||||
ssh -oStrictHostKeyChecking=no -oBatchMode=no "$SFTP_USER@$SFTP_HOST" "docker exec docker-mc-1 mc-send-to-console $cmd"
|
||||
done
|
||||
|
||||
echo "Plugin reloaded."
|
||||
else
|
||||
echo "Gradle build failed."
|
||||
fi
|
||||
@@ -4,14 +4,12 @@ import io.github.itzispyder.pdk.PDK;
|
||||
import io.github.thetrouper.sentinel.auth.Auth;
|
||||
import io.github.thetrouper.sentinel.cmds.*;
|
||||
import io.github.thetrouper.sentinel.events.*;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.LanguageFile;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import io.github.thetrouper.sentinel.server.config.*;
|
||||
import io.github.thetrouper.sentinel.server.functions.AntiSpam;
|
||||
import io.github.thetrouper.sentinel.server.functions.Authenticator;
|
||||
import io.github.thetrouper.sentinel.server.functions.ProfanityFilter;
|
||||
import io.github.thetrouper.sentinel.server.functions.Telemetry;
|
||||
import io.github.thetrouper.sentinel.server.util.JsonSerializable;
|
||||
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
@@ -23,8 +21,18 @@ import java.util.logging.Logger;
|
||||
public final class Sentinel extends JavaPlugin {
|
||||
private static Sentinel instance;
|
||||
public static LanguageFile dict;
|
||||
private static File cfgfile = new File("plugins/Sentinel/main-config.json");
|
||||
private static final File cfgfile = new File("plugins/Sentinel/main-config.json");
|
||||
private static final File nbtcfg = new File("plugins/Sentinel/nbt-config.json");
|
||||
private static final File strctcfg = new File("plugins/Sentinel/strict.json");
|
||||
private static final File swrcfg = new File("plugins/Sentinel/swears.json");
|
||||
private static final File fpcfg = new File("plugins/Sentinel/false-positives.json");
|
||||
private static final File advcfg = new File("plugins/Sentinel/advanced-config.json");
|
||||
public static MainConfig mainConfig = JsonSerializable.load(cfgfile, MainConfig.class, new MainConfig());
|
||||
public static FPConfig fpConfig = JsonSerializable.load(fpcfg, FPConfig.class, new FPConfig());
|
||||
public static SwearsConfig swearConfig = JsonSerializable.load(swrcfg, SwearsConfig.class, new SwearsConfig());
|
||||
public static StrictConfig strictConfig = JsonSerializable.load(strctcfg, StrictConfig.class, new StrictConfig());
|
||||
public static NBTConfig nbtConfig = JsonSerializable.load(nbtcfg, NBTConfig.class, new NBTConfig());
|
||||
public static AdvancedConfig advConfig = JsonSerializable.load(advcfg, AdvancedConfig.class, new AdvancedConfig());
|
||||
public static final PluginManager manager = Bukkit.getPluginManager();
|
||||
public static String prefix = "";
|
||||
public static String key = "";
|
||||
@@ -45,7 +53,7 @@ public final class Sentinel extends JavaPlugin {
|
||||
log.info("Initializing Server ID...");
|
||||
String serverID = Authenticator.getServerID();
|
||||
identifier = serverID;
|
||||
log.info("Pre-load finished!\n]====---- Requesting Authentication (" + dict.get("example-message") + ") ----====[ \n- License Key: " + key + " \n- Server ID: " + serverID);
|
||||
log.info("Pre-load finished!\n]====---- Requesting Authentication (" + dict.get("if-you-see-this-lang-is-broken") + ") ----====[ \n- License Key: " + key + " \n- Server ID: " + serverID);
|
||||
String authStatus = "ERROR";
|
||||
String authstatus = "ERROR";
|
||||
try {
|
||||
@@ -138,14 +146,21 @@ public final class Sentinel extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void loadConfig() {
|
||||
|
||||
// Init
|
||||
mainConfig = JsonSerializable.load(cfgfile,MainConfig.class,new MainConfig());
|
||||
advConfig = JsonSerializable.load(advcfg,AdvancedConfig.class,new AdvancedConfig());
|
||||
fpConfig = JsonSerializable.load(fpcfg,FPConfig.class,new FPConfig());
|
||||
strictConfig = JsonSerializable.load(strctcfg,StrictConfig.class,new StrictConfig());
|
||||
swearConfig = JsonSerializable.load(swrcfg,SwearsConfig.class,new SwearsConfig());
|
||||
nbtConfig = JsonSerializable.load(nbtcfg,NBTConfig.class,new NBTConfig());
|
||||
|
||||
log.info("Loading Dictionary (" + MainConfig.Plugin.lang + ")...");
|
||||
dict = JsonSerializable.load(LanguageFile.PATH,LanguageFile.class,new LanguageFile());
|
||||
|
||||
log.info("Verifying Config...");
|
||||
getConfig().options().copyDefaults();
|
||||
saveDefaultConfig();
|
||||
//getConfig().options().copyDefaults();
|
||||
//saveDefaultConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,8 +6,7 @@ import io.github.itzispyder.pdk.commands.CustomCommand;
|
||||
import io.github.itzispyder.pdk.commands.Permission;
|
||||
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.functions.AntiSpam;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import io.github.thetrouper.sentinel.server.functions.ProfanityFilter;
|
||||
import io.github.thetrouper.sentinel.server.util.Text;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -44,7 +43,7 @@ public class SentinelCommand implements CustomCommand {
|
||||
players.add(p);
|
||||
String msg = args.getAll(1).toString().trim();
|
||||
AsyncPlayerChatEvent e = new AsyncPlayerChatEvent(true, p, msg, players);
|
||||
AntiSpam.handleAntiSpam(e);
|
||||
io.github.thetrouper.sentinel.server.functions.AntiSpam.handleAntiSpam(e);
|
||||
}
|
||||
case "lang" -> {
|
||||
p.sendMessage(Sentinel.dict.get("exmaple-message"));
|
||||
@@ -61,7 +60,7 @@ public class SentinelCommand implements CustomCommand {
|
||||
p.sendMessage(Text.prefix("Invalid Player!"));
|
||||
return;
|
||||
}
|
||||
p.sendMessage(Text.prefix("Heat of " + target.getName() + ": &8(&c" + AntiSpam.heatMap.get(target) + "&7/&4" + Config.punishHeat + "&8)"));
|
||||
p.sendMessage(Text.prefix("Heat of " + target.getName() + ": &8(&c" + io.github.thetrouper.sentinel.server.functions.AntiSpam.heatMap.get(target) + "&7/&4" + MainConfig.Chat.AntiSpam.punishHeat + "&8)"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package io.github.thetrouper.sentinel.data;
|
||||
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public enum FAT {
|
||||
BLOCK_SWEAR("Sentinel Profanity Filter",null,"swear-block-warn", "swear-block-notification", null,null),
|
||||
BLOCK_SPAM("Sentinel Anti-Spam", null, "spam-block-warn", "spam-notification",null,null),
|
||||
SWEAR("Sentinel Anti-Swear Log","Anti-Swear", "profanity-mute-warn", "profanity-mute-notification", Config.swearPunishCommand, Color.orange),
|
||||
SLUR("Sentinel Anti-Slur Log", "Anti-Slur", "slur-mute-warn", "slur-mute-notification", Config.strictPunishCommand, Color.red),
|
||||
SPAM("Sentinel Anti-Spam Log", "Anti-Spam", "spam-mute-warn", "spam-mute-notification", Config.spamPunishCommand, Color.pink);
|
||||
SWEAR("Sentinel Anti-Swear Log","Anti-Swear", "profanity-mute-warn", "profanity-mute-notification", MainConfig.Chat.AntiSwear.swearPunishCommand, Color.orange),
|
||||
SLUR("Sentinel Anti-Slur Log", "Anti-Slur", "slur-mute-warn", "slur-mute-notification", MainConfig.Chat.AntiSwear.strictPunishCommand, Color.red),
|
||||
SPAM("Sentinel Anti-Spam Log", "Anti-Spam", "spam-mute-warn", "spam-mute-notification", MainConfig.Chat.AntiSpam.spamPunishCommand, Color.pink);
|
||||
|
||||
private final String title;
|
||||
private final String name;
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.github.itzispyder.pdk.events.CustomListener;
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.data.ActionType;
|
||||
import io.github.thetrouper.sentinel.server.Action;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -16,9 +16,9 @@ public class CMDBlockPlace implements CustomListener {
|
||||
@EventHandler
|
||||
private void onCMDBlockPlace(BlockPlaceEvent e) {
|
||||
ServerUtils.sendDebugMessage("CommandBlockPlace: Detected block place");
|
||||
if (!Config.preventCmdBlockPlace) return;
|
||||
if (!MainConfig.Plugin.preventCmdBlockPlace) return;
|
||||
ServerUtils.sendDebugMessage("CommandBlockPlace: Enabled");
|
||||
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||
if (MainConfig.Plugin.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||
ServerUtils.sendDebugMessage("CommandBlockPlace: Player is operator");
|
||||
Block b = e.getBlockPlaced();
|
||||
if (b.getType() == Material.COMMAND_BLOCK || b.getType() == Material.CHAIN_COMMAND_BLOCK || b.getType() == Material.REPEATING_COMMAND_BLOCK ) {
|
||||
@@ -33,8 +33,8 @@ public class CMDBlockPlace implements CustomListener {
|
||||
.setBlock(b)
|
||||
.setPlayer(p)
|
||||
.setDenied(true)
|
||||
.setPunished(Config.cmdBlockPunish)
|
||||
.setnotifyDiscord(Config.logCmdBlocks)
|
||||
.setPunished(MainConfig.Plugin.cmdBlockPunish)
|
||||
.setnotifyDiscord(MainConfig.Plugin.logCmdBlocks)
|
||||
.setNotifyTrusted(true)
|
||||
.setNotifyConsole(true)
|
||||
.execute();
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.github.itzispyder.pdk.events.CustomListener;
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.data.ActionType;
|
||||
import io.github.thetrouper.sentinel.server.Action;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -19,9 +19,9 @@ public class CMDBlockUse implements CustomListener {
|
||||
@EventHandler
|
||||
private void onCMDBlockUse(PlayerInteractEvent e) {
|
||||
ServerUtils.sendDebugMessage("CommandBlockUse: Detected Interaction");
|
||||
if (!Config.preventCmdBlockUse) return;
|
||||
if (!MainConfig.Plugin.preventCmdBlockUse) return;
|
||||
ServerUtils.sendDebugMessage("CommandBlockUse: Enabled");
|
||||
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||
if (MainConfig.Plugin.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||
ServerUtils.sendDebugMessage("CommandBlockUse: Player is op");
|
||||
if (e.getClickedBlock() == null) return;
|
||||
ServerUtils.sendDebugMessage("CommandBlockUse: Block isn't null");
|
||||
@@ -38,9 +38,9 @@ public class CMDBlockUse implements CustomListener {
|
||||
.setBlock(b)
|
||||
.setPlayer(p)
|
||||
.setDenied(true)
|
||||
.setPunished(Config.cmdBlockPunish)
|
||||
.setDeoped(Config.deop)
|
||||
.setnotifyDiscord(Config.logCmdBlocks)
|
||||
.setPunished(MainConfig.Plugin.cmdBlockPunish)
|
||||
.setDeoped(MainConfig.Plugin.deop)
|
||||
.setnotifyDiscord(MainConfig.Plugin.logCmdBlocks)
|
||||
.setNotifyTrusted(true)
|
||||
.setNotifyConsole(true)
|
||||
.execute();
|
||||
@@ -52,9 +52,9 @@ public class CMDBlockUse implements CustomListener {
|
||||
ServerUtils.sendDebugMessage("CommandBlockChange: Detected change block");
|
||||
if (!(e.getEntity() instanceof Player p)) return;
|
||||
ServerUtils.sendDebugMessage("CommandBlockChange: Changer is a player");
|
||||
if (!Config.preventCmdBlockUse) return;
|
||||
if (!MainConfig.Plugin.preventCmdBlockUse) return;
|
||||
ServerUtils.sendDebugMessage("CommandBlockChange: Enabled");
|
||||
if (Config.cmdBlockOpCheck && !p.isOp()) return;
|
||||
if (MainConfig.Plugin.cmdBlockOpCheck && !p.isOp()) return;
|
||||
ServerUtils.sendDebugMessage("CommandBlockChange: Player is op");
|
||||
Block b = e.getBlock();
|
||||
if (b.getType() == Material.COMMAND_BLOCK || b.getType() == Material.REPEATING_COMMAND_BLOCK || b.getType() == Material.CHAIN_COMMAND_BLOCK) {
|
||||
@@ -71,9 +71,9 @@ public class CMDBlockUse implements CustomListener {
|
||||
.setCommand(cb.getCommand())
|
||||
.setPlayer(p)
|
||||
.setDenied(true)
|
||||
.setPunished(Config.cmdBlockPunish)
|
||||
.setDeoped(Config.deop)
|
||||
.setnotifyDiscord(Config.logCmdBlocks)
|
||||
.setPunished(MainConfig.Plugin.cmdBlockPunish)
|
||||
.setDeoped(MainConfig.Plugin.deop)
|
||||
.setnotifyDiscord(MainConfig.Plugin.logCmdBlocks)
|
||||
.setNotifyTrusted(true)
|
||||
.setNotifyConsole(true)
|
||||
.execute();
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.github.itzispyder.pdk.events.CustomListener;
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.data.ActionType;
|
||||
import io.github.thetrouper.sentinel.server.Action;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -16,9 +16,9 @@ public class CMDMinecartPlace implements CustomListener {
|
||||
@EventHandler
|
||||
private void onCMDMinecartPlace(PlayerInteractEvent e) {
|
||||
ServerUtils.sendDebugMessage("MinecartCommandPlace: Detected interaction");
|
||||
if (Config.preventCmdCartPlace) {
|
||||
if (MainConfig.Plugin.preventCmdCartPlace) {
|
||||
ServerUtils.sendDebugMessage("MinecartCommandPlace: Enabled");
|
||||
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||
if (MainConfig.Plugin.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||
ServerUtils.sendDebugMessage("MinecartCommandPlace: Player is op");
|
||||
if (e.getItem() == null) return;
|
||||
ServerUtils.sendDebugMessage("MinecartCommandPlace: Item isn't null");
|
||||
@@ -38,12 +38,12 @@ public class CMDMinecartPlace implements CustomListener {
|
||||
.setEvent(e)
|
||||
.setPlayer(p)
|
||||
.setBlock(e.getClickedBlock())
|
||||
.setDenied(Config.preventCmdCartPlace)
|
||||
.setPunished(Config.cmdBlockPunish)
|
||||
.setDeoped(Config.deop)
|
||||
.setDenied(MainConfig.Plugin.preventCmdCartPlace)
|
||||
.setPunished(MainConfig.Plugin.cmdBlockPunish)
|
||||
.setDeoped(MainConfig.Plugin.deop)
|
||||
.setNotifyConsole(true)
|
||||
.setNotifyTrusted(true)
|
||||
.setnotifyDiscord(Config.logCmdBlocks)
|
||||
.setnotifyDiscord(MainConfig.Plugin.logCmdBlocks)
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.github.itzispyder.pdk.events.CustomListener;
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.data.ActionType;
|
||||
import io.github.thetrouper.sentinel.server.Action;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,9 +15,9 @@ public class CMDMinecartUse implements CustomListener {
|
||||
@EventHandler
|
||||
private void onCMDBlockMinecartUse(PlayerInteractEntityEvent e) {
|
||||
ServerUtils.sendDebugMessage("MinecartCommandUse: Detected Interaction with entity");
|
||||
if (!Config.preventCmdCartUse) return;
|
||||
if (!MainConfig.Plugin.preventCmdCartUse) return;
|
||||
ServerUtils.sendDebugMessage("MinecartCommandUse: Enabled");
|
||||
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||
if (MainConfig.Plugin.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||
ServerUtils.sendDebugMessage("MinecartCommandUse: Player op");
|
||||
if (e.getRightClicked().getType() == EntityType.MINECART_COMMAND) {
|
||||
ServerUtils.sendDebugMessage("MinecartCommandUse: Entity is minecart command");
|
||||
@@ -30,8 +30,8 @@ public class CMDMinecartUse implements CustomListener {
|
||||
.setEvent(e)
|
||||
.setPlayer(p)
|
||||
.setDenied(true)
|
||||
.setPunished(Config.cmdBlockPunish)
|
||||
.setnotifyDiscord(Config.logCmdBlocks)
|
||||
.setPunished(MainConfig.Plugin.cmdBlockPunish)
|
||||
.setnotifyDiscord(MainConfig.Plugin.logCmdBlocks)
|
||||
.setNotifyTrusted(true)
|
||||
.setNotifyConsole(true)
|
||||
.execute();
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.github.thetrouper.sentinel.events;
|
||||
|
||||
import io.github.itzispyder.pdk.events.CustomListener;
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import io.github.thetrouper.sentinel.server.functions.AntiSpam;
|
||||
import io.github.thetrouper.sentinel.server.functions.AntiUnicode;
|
||||
@@ -26,14 +25,14 @@ public class ChatEvent implements CustomListener {
|
||||
}
|
||||
if (!Sentinel.isTrusted(e.getPlayer()) || !e.getPlayer().hasPermission("sentinel.chat.antiswear.bypass")) {
|
||||
ServerUtils.sendDebugMessage("ChatEvent: Permission bypass failed, checking for swears");
|
||||
if (Config.antiSwearEnabled) {
|
||||
if (MainConfig.Chat.AntiSwear.antiSwearEnabled) {
|
||||
ServerUtils.sendDebugMessage(("ChatEvent: Enabled, Continuing swear check!"));
|
||||
ProfanityFilter.handleProfanityFilter(e);
|
||||
}
|
||||
}
|
||||
if (!Sentinel.isTrusted(e.getPlayer()) || !e.getPlayer().hasPermission("sentinel.chat.antispam.bypass")) {
|
||||
ServerUtils.sendDebugMessage(("ChatEvent: Permission bypass failed, checking for spam"));
|
||||
if (Config.antiSpamEnabled) {
|
||||
if (MainConfig.Chat.AntiSpam.antiSpamEnabled) {
|
||||
ServerUtils.sendDebugMessage(("ChatEvent: Enabled, Continuing spam check!"));
|
||||
AntiSpam.handleAntiSpam(e);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.github.itzispyder.pdk.events.CustomListener;
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.data.ActionType;
|
||||
import io.github.thetrouper.sentinel.server.Action;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -29,15 +29,15 @@ public class CommandEvent implements CustomListener {
|
||||
.setPlayer(p)
|
||||
.setCommand(fullcommand)
|
||||
.setDenied(true)
|
||||
.setDeoped(Config.deop)
|
||||
.setPunished(Config.commandPunish)
|
||||
.setnotifyDiscord(Config.logDangerous)
|
||||
.setDeoped(MainConfig.Plugin.deop)
|
||||
.setPunished(MainConfig.Plugin.commandPunish)
|
||||
.setnotifyDiscord(MainConfig.Plugin.logDangerous)
|
||||
.setNotifyConsole(true)
|
||||
.setNotifyTrusted(true)
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
if (Config.blockSpecific) {
|
||||
if (MainConfig.Plugin.blockSpecific) {
|
||||
ServerUtils.sendDebugMessage("CommandEvent: Checking command for specific");
|
||||
if (command.contains(":")) {
|
||||
ServerUtils.sendDebugMessage("CommandEvent: Failed check");
|
||||
@@ -50,9 +50,9 @@ public class CommandEvent implements CustomListener {
|
||||
.setPlayer(p)
|
||||
.setCommand(command)
|
||||
.setDenied(true)
|
||||
.setDeoped(Config.deop)
|
||||
.setPunished(Config.specificPunish)
|
||||
.setnotifyDiscord(Config.logSpecific)
|
||||
.setDeoped(MainConfig.Plugin.deop)
|
||||
.setPunished(MainConfig.Plugin.specificPunish)
|
||||
.setnotifyDiscord(MainConfig.Plugin.logSpecific)
|
||||
.setNotifyConsole(true)
|
||||
.setNotifyTrusted(true)
|
||||
.execute();
|
||||
|
||||
@@ -4,7 +4,8 @@ import io.github.itzispyder.pdk.events.CustomListener;
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.data.ActionType;
|
||||
import io.github.thetrouper.sentinel.server.Action;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import io.github.thetrouper.sentinel.server.config.NBTConfig;
|
||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@@ -25,7 +26,7 @@ public class NBTEvents implements CustomListener {
|
||||
@EventHandler
|
||||
private void onNBTPull(InventoryCreativeEvent e) {
|
||||
ServerUtils.sendDebugMessage("NBT: Detected creative mode action");
|
||||
if (!Config.preventNBT) return;
|
||||
if (!MainConfig.Plugin.preventNBT) return;
|
||||
ServerUtils.sendDebugMessage("NBT: Enabled");
|
||||
if (!(e.getWhoClicked() instanceof Player p)) return;
|
||||
ServerUtils.sendDebugMessage("NBT: Clicker is a player");
|
||||
@@ -45,13 +46,13 @@ public class NBTEvents implements CustomListener {
|
||||
.setAction(ActionType.NBT)
|
||||
.setPlayer(Bukkit.getPlayer(e.getWhoClicked().getName()))
|
||||
.setItem(e.getCursor())
|
||||
.setDenied(Config.preventNBT)
|
||||
.setDeoped(Config.deop)
|
||||
.setPunished(Config.nbtPunish)
|
||||
.setRevertGM(Config.preventNBT)
|
||||
.setDenied(MainConfig.Plugin.preventNBT)
|
||||
.setDeoped(MainConfig.Plugin.deop)
|
||||
.setPunished(MainConfig.Plugin.nbtPunish)
|
||||
.setRevertGM(MainConfig.Plugin.preventNBT)
|
||||
.setNotifyConsole(true)
|
||||
.setNotifyTrusted(true)
|
||||
.setnotifyDiscord(Config.logNBT)
|
||||
.setnotifyDiscord(MainConfig.Plugin.logNBT)
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
@@ -118,19 +119,19 @@ public class NBTEvents implements CustomListener {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!Config.allowName && meta.hasDisplayName()) {
|
||||
if (!NBTConfig.allowName && meta.hasDisplayName()) {
|
||||
ServerUtils.sendDebugMessage("NBT: No pass N");
|
||||
return false;
|
||||
}
|
||||
if (!Config.allowLore && meta.hasLore()) {
|
||||
if (!NBTConfig.allowLore && meta.hasLore()) {
|
||||
ServerUtils.sendDebugMessage("NBT: No Pass L ");
|
||||
return false;
|
||||
}
|
||||
if (!Config.allowAttributes && meta.hasAttributeModifiers()) {
|
||||
if (!NBTConfig.allowAttributes && meta.hasAttributeModifiers()) {
|
||||
ServerUtils.sendDebugMessage("NBT: No pass A");
|
||||
return false;
|
||||
}
|
||||
if (Config.globalMaxEnchant != 0 && hasIllegalEnchants(i)) {
|
||||
if (NBTConfig.globalMaxEnchant != 0 && hasIllegalEnchants(i)) {
|
||||
ServerUtils.sendDebugMessage("NBT: No pass E");
|
||||
return false;
|
||||
}
|
||||
@@ -155,174 +156,174 @@ public class NBTEvents implements CustomListener {
|
||||
final ItemMeta meta = i.getItemMeta();
|
||||
final Map<Enchantment, Integer> enchantments = meta.getEnchants();
|
||||
for (Integer value : enchantments.values()) {
|
||||
if (value > Config.globalMaxEnchant) {
|
||||
if (value > NBTConfig.globalMaxEnchant) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// ALL
|
||||
if (meta.hasEnchant(Enchantment.MENDING)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.MENDING);
|
||||
return level > Config.maxMending || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxMending || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.DURABILITY)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.DURABILITY);
|
||||
return level > Config.maxUnbreaking || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxUnbreaking || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.VANISHING_CURSE)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.VANISHING_CURSE);
|
||||
return level > Config.maxVanishing || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxVanishing || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
|
||||
// ARMOR
|
||||
if (meta.hasEnchant(Enchantment.BINDING_CURSE)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.BINDING_CURSE);
|
||||
return level > Config.maxCurseOfBinding || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxCurseOfBinding || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.WATER_WORKER)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.WATER_WORKER);
|
||||
return level > Config.maxAquaAffinity || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxAquaAffinity || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.PROTECTION_ENVIRONMENTAL)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.PROTECTION_ENVIRONMENTAL);
|
||||
return level > Config.maxProtection || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxProtection || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.PROTECTION_EXPLOSIONS)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.PROTECTION_EXPLOSIONS);
|
||||
return level > Config.maxBlastProtection || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxBlastProtection || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.DEPTH_STRIDER)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.DEPTH_STRIDER);
|
||||
return level > Config.maxDepthStrider || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxDepthStrider || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.PROTECTION_FALL)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.PROTECTION_FALL);
|
||||
return level > Config.maxFeatherFalling || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxFeatherFalling || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.PROTECTION_FIRE)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.PROTECTION_FIRE);
|
||||
return level > Config.maxFireProtection || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxFireProtection || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.FROST_WALKER)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.FROST_WALKER);
|
||||
return level > Config.maxFrostWalker || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxFrostWalker || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.PROTECTION_PROJECTILE)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.PROTECTION_PROJECTILE);
|
||||
return level > Config.maxProjectileProtection || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxProjectileProtection || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.OXYGEN)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.OXYGEN);
|
||||
return level > Config.maxRespiration || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxRespiration || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.SOUL_SPEED)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.SOUL_SPEED);
|
||||
return level > Config.maxSoulSpeed || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxSoulSpeed || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.THORNS)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.THORNS);
|
||||
return level > Config.maxThorns || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxThorns || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.SWEEPING_EDGE)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.SWEEPING_EDGE);
|
||||
return level > Config.maxSweepingEdge || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxSweepingEdge || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.FROST_WALKER)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.FROST_WALKER);
|
||||
return level > Config.maxFrostWalker || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxFrostWalker || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
|
||||
// MELEE WEAPONS
|
||||
if (meta.hasEnchant(Enchantment.DAMAGE_ARTHROPODS)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.DAMAGE_ARTHROPODS);
|
||||
return level > Config.maxBaneOfArthropods || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxBaneOfArthropods || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.FIRE_ASPECT)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.FIRE_ASPECT);
|
||||
return level > Config.maxFireAspect || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxFireAspect || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.LOOT_BONUS_MOBS)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.LOOT_BONUS_MOBS);
|
||||
return level > Config.maxLooting || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxLooting || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.IMPALING)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.IMPALING);
|
||||
return level > Config.maxImpaling || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxImpaling || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.KNOCKBACK)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.KNOCKBACK);
|
||||
return level > Config.maxKnockback || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxKnockback || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.DAMAGE_ALL)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.DAMAGE_ALL);
|
||||
return level > Config.maxSharpness || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxSharpness || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.DAMAGE_UNDEAD)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.DAMAGE_UNDEAD);
|
||||
return level > Config.maxSmite || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxSmite || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
|
||||
// RANGED WEAPONS
|
||||
if (meta.hasEnchant(Enchantment.CHANNELING)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.CHANNELING);
|
||||
return level > Config.maxChanneling || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxChanneling || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.ARROW_FIRE)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.ARROW_FIRE);
|
||||
return level > Config.maxFlame || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxFlame || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.ARROW_INFINITE)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.ARROW_INFINITE);
|
||||
return level > Config.maxInfinity || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxInfinity || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.LOYALTY)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.LOYALTY);
|
||||
return level > Config.maxLoyalty || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxLoyalty || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.RIPTIDE)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.RIPTIDE);
|
||||
return level > Config.maxRiptide || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxRiptide || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.MULTISHOT)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.MULTISHOT);
|
||||
return level > Config.maxMultishot || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxMultishot || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.PIERCING)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.PIERCING);
|
||||
return level > Config.maxPiercing || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxPiercing || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.ARROW_DAMAGE)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.ARROW_DAMAGE);
|
||||
return level > Config.maxPower || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxPower || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.ARROW_KNOCKBACK)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.ARROW_KNOCKBACK);
|
||||
return level > Config.maxPunch || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxPunch || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.QUICK_CHARGE)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.QUICK_CHARGE);
|
||||
return level > Config.maxQuickCharge || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxQuickCharge || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
|
||||
// TOOLS
|
||||
if (meta.hasEnchant(Enchantment.DIG_SPEED)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.DIG_SPEED);
|
||||
return level > Config.maxEfficiency || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxEfficiency || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.LOOT_BONUS_BLOCKS)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.LOOT_BONUS_BLOCKS);
|
||||
return level > Config.maxFortune || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxFortune || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.LUCK)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.LUCK);
|
||||
return level > Config.maxLuckOfTheSea || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxLuckOfTheSea || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.LURE)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.LURE);
|
||||
return level > Config.maxLure || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxLure || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
if (meta.hasEnchant(Enchantment.SILK_TOUCH)) {
|
||||
final int level = meta.getEnchantLevel(Enchantment.SILK_TOUCH);
|
||||
return level > Config.maxSilkTouch || level > Config.globalMaxEnchant;
|
||||
return level > NBTConfig.maxSilkTouch || level > NBTConfig.globalMaxEnchant;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.data.ActionType;
|
||||
import io.github.thetrouper.sentinel.data.Emojis;
|
||||
import io.github.thetrouper.sentinel.discord.DiscordWebhook;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import io.github.thetrouper.sentinel.server.util.FileUtils;
|
||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||
import io.github.thetrouper.sentinel.server.util.Text;
|
||||
@@ -102,7 +102,7 @@ public class Action {
|
||||
String itemLog = (item != null) ? FileUtils.createNBTLog(item.getItemMeta().getAsString()) : "";
|
||||
String commandLog = (loggedCommand != null) ? FileUtils.createCommandLog(loggedCommand) : "";
|
||||
|
||||
final List<String> punishCommands = Config.getPunishCommands();
|
||||
final List<String> punishCommands = MainConfig.Plugin.punishCommands;
|
||||
|
||||
if (denied) {
|
||||
event.setCancelled(true);
|
||||
@@ -159,7 +159,7 @@ public class Action {
|
||||
}
|
||||
|
||||
if (notifyDiscord) {
|
||||
DiscordWebhook webhook = new DiscordWebhook(Config.webhook);
|
||||
DiscordWebhook webhook = new DiscordWebhook(MainConfig.Plugin.webhook);
|
||||
webhook.setAvatarUrl("https://r2.e-z.host/d440b58a-ba90-4839-8df6-8bba298cf817/3lwit5nt.png");
|
||||
webhook.setUsername("Sentinel Anti-Nuke | Logs");
|
||||
String description = (player != null) ? Emojis.rightSort + " **Player:** " + player.getName() + " " + Emojis.member + "\n" : "";
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.data.Emojis;
|
||||
import io.github.thetrouper.sentinel.data.FAT;
|
||||
import io.github.thetrouper.sentinel.discord.DiscordWebhook;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import io.github.thetrouper.sentinel.server.functions.ReportFalsePositives;
|
||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||
import io.github.thetrouper.sentinel.server.util.Text;
|
||||
@@ -43,7 +43,7 @@ public class FilterAction {
|
||||
|
||||
String notiftext = Sentinel.dict.get(type.getNotifTranslationKey());
|
||||
|
||||
notif.setText(Text.prefix((type != FAT.SPAM && type != FAT.BLOCK_SPAM ? notiftext.formatted(offender.getName(), scoreMap.get(offender), Config.punishScore) : notiftext.formatted(offender.getName(),heatMap.get(offender),Config.punishHeat))));
|
||||
notif.setText(Text.prefix((type != FAT.SPAM && type != FAT.BLOCK_SPAM ? notiftext.formatted(offender.getName(), scoreMap.get(offender), MainConfig.Chat.AntiSwear.punishScore) : notiftext.formatted(offender.getName(),heatMap.get(offender),MainConfig.Chat.AntiSpam.punishHeat))));
|
||||
|
||||
ServerUtils.forEachStaff(staffmember -> {
|
||||
staffmember.spigot().sendMessage(notif);
|
||||
@@ -53,16 +53,16 @@ public class FilterAction {
|
||||
ServerUtils.sendCommand(type.getExecutedCommand().replace("%player%", offender.getName()));
|
||||
}
|
||||
|
||||
if (type == FAT.SWEAR && Config.logSwear) {
|
||||
if (type == FAT.SWEAR && MainConfig.Chat.AntiSwear.logSwears) {
|
||||
sendDiscordLog(offender,e,type);
|
||||
sendConsoleLog(offender,e,type);
|
||||
}
|
||||
|
||||
if (type == FAT.SLUR && Config.logSwear) {
|
||||
if (type == FAT.SLUR && MainConfig.Chat.AntiSwear.logSwears) {
|
||||
sendDiscordLog(offender,e,type);
|
||||
sendConsoleLog(offender,e,type);
|
||||
}
|
||||
if (type == FAT.SPAM && Config.logSpam) {
|
||||
if (type == FAT.SPAM && MainConfig.Chat.AntiSpam.logSpam) {
|
||||
sendDiscordLog(offender,e,type);
|
||||
sendConsoleLog(offender,e,type);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class FilterAction {
|
||||
public static void sendConsoleLog(Player offender, AsyncPlayerChatEvent e, FAT type) {
|
||||
String log = "]=-" + type.getTitle() + "-=[\n" +
|
||||
"Player: " + offender.getName() +
|
||||
(type != FAT.BLOCK_SPAM && type != FAT.SPAM ? "> Score: `" + scoreMap.get(offender) + "/" + Config.punishScore : "> Heat: `" + heatMap.get(offender) + "/" + Config.punishHeat) + "\n" +
|
||||
(type != FAT.BLOCK_SPAM && type != FAT.SPAM ? "> Score: `" + scoreMap.get(offender) + "/" + MainConfig.Chat.AntiSwear.punishScore : "> Heat: `" + heatMap.get(offender) + "/" + MainConfig.Chat.AntiSpam.punishHeat) + "\n" +
|
||||
"> UUID: " + offender.getUniqueId() + "\n" +
|
||||
(type != FAT.BLOCK_SPAM && type != FAT.SPAM ? "Message: " + e.getMessage() : "Previous: " + lastMessageMap.get(offender)) + "\n" +
|
||||
(type != FAT.BLOCK_SPAM && type != FAT.SPAM ? "Reduced: " + fullSimplify(e.getMessage()) : "Current: " + e.getMessage()) + "\n" +
|
||||
@@ -83,7 +83,7 @@ public class FilterAction {
|
||||
String title = offender.getName() + " has triggered the " + type.getName() + "!";
|
||||
String executed = type.getExecutedCommand() != null ? type.getExecutedCommand() : "Nothing, its a standard flag. You shouldn't be seeing this, please report it.";
|
||||
|
||||
DiscordWebhook webhook = new DiscordWebhook(Config.webhook);
|
||||
DiscordWebhook webhook = new DiscordWebhook(MainConfig.Plugin.webhook);
|
||||
webhook.setAvatarUrl("https://r2.e-z.host/d440b58a-ba90-4839-8df6-8bba298cf817/3lwit5nt.png");
|
||||
webhook.setUsername("Sentinel Anti-Nuke | Logs");
|
||||
|
||||
@@ -92,7 +92,7 @@ public class FilterAction {
|
||||
.setTitle(title)
|
||||
.setDescription(
|
||||
Emojis.rightSort + "Player: " + offender.getName() + " " + Emojis.target + "\\n" +
|
||||
Emojis.space + Emojis.arrowRight + (type != FAT.BLOCK_SPAM ? "Score: `" + scoreMap.get(offender) + "/" + Config.punishScore : "Heat: `" + heatMap.get(offender) + "/" + Config.punishHeat) + "`\\n" +
|
||||
Emojis.space + Emojis.arrowRight + (type != FAT.BLOCK_SPAM ? "Score: `" + scoreMap.get(offender) + "/" + MainConfig.Chat.AntiSwear.punishScore : "Heat: `" + heatMap.get(offender) + "/" + MainConfig.Chat.AntiSpam.punishHeat) + "`\\n" +
|
||||
Emojis.space + Emojis.arrowRight + "UUID: `" + offender.getUniqueId() + "`\\n" +
|
||||
Emojis.rightSort + "Executed: " + executed + " " + Emojis.mute + "\\n"
|
||||
)
|
||||
|
||||
@@ -32,7 +32,7 @@ public class AdvancedConfig implements JsonSerializable<AdvancedConfig> {
|
||||
put("v", "u");
|
||||
}};
|
||||
public static String falsePosRegex = "";
|
||||
public static String swearRegex;
|
||||
public static String strictRegex;
|
||||
public static String swearRegex = "";
|
||||
public static String strictRegex = "";
|
||||
public static String urlRegex = "^(https?://)?([a-zA-Z0-9-]+\\.)*[a-zA-Z0-9-]+\\.[a-zA-Z]{2,}(/\\S*)?$\n";
|
||||
}
|
||||
|
||||
@@ -1,281 +0,0 @@
|
||||
/**
|
||||
* This file is for tutorial purposes made by ImproperIssues. Distribute if you want :)
|
||||
*/
|
||||
|
||||
package io.github.thetrouper.sentinel.server.config;
|
||||
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Config loader
|
||||
*/
|
||||
public abstract class Config {
|
||||
|
||||
private static final FileConfiguration mainConfig = Sentinel.getInstance().getConfig();
|
||||
private static final FileConfiguration nbtConfig = getConfig("nbt-config.yml");
|
||||
private static final FileConfiguration falsePositives = getConfig("false-positives.yml");
|
||||
private static final FileConfiguration strictWords = getConfig("strict.yml");
|
||||
private static final FileConfiguration swearWords = getConfig("swears.yml");
|
||||
|
||||
public static List<String> getPunishCommands() {
|
||||
return punishCommands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Config plugin section
|
||||
*/
|
||||
public class Plugin {
|
||||
public static String getPrefix() {
|
||||
return mainConfig.getString("config.plugin.prefix");
|
||||
}
|
||||
}
|
||||
public static String webhook;
|
||||
public static String lang;
|
||||
public static List<String> trustedPlayers;
|
||||
public static boolean blockSpecific;
|
||||
public static boolean preventNBT;
|
||||
public static boolean preventCmdBlockPlace;
|
||||
public static boolean preventCmdBlockUse;
|
||||
public static boolean preventCmdBlockChange;
|
||||
public static boolean preventCmdCartPlace;
|
||||
public static boolean preventCmdCartUse;
|
||||
public static boolean cmdBlockOpCheck;
|
||||
public static List<String> dangerous;
|
||||
public static boolean logDangerous;
|
||||
public static boolean logCmdBlocks;
|
||||
public static boolean logNBT;
|
||||
public static boolean logSpecific;
|
||||
public static List<String> logged;
|
||||
public static boolean deop;
|
||||
public static boolean nbtPunish;
|
||||
public static boolean cmdBlockPunish;
|
||||
public static boolean commandPunish;
|
||||
public static boolean specificPunish;
|
||||
public static List<String> punishCommands;
|
||||
public static boolean reopCommand;
|
||||
|
||||
// NBT
|
||||
|
||||
public static boolean allowName;
|
||||
public static boolean allowLore;
|
||||
public static boolean allowAttributes;
|
||||
public static int globalMaxEnchant;
|
||||
public static int maxMending;
|
||||
public static int maxUnbreaking;
|
||||
public static int maxVanishing;
|
||||
public static int maxAquaAffinity;
|
||||
public static int maxBlastProtection;
|
||||
public static int maxCurseOfBinding;
|
||||
public static int maxDepthStrider;
|
||||
public static int maxFeatherFalling;
|
||||
public static int maxFireProtection;
|
||||
public static int maxFrostWalker;
|
||||
public static int maxProjectileProtection;
|
||||
public static int maxProtection;
|
||||
public static int maxRespiration;
|
||||
public static int maxSoulSpeed;
|
||||
public static int maxThorns;
|
||||
public static int maxSwiftSneak;
|
||||
public static int maxBaneOfArthropods;
|
||||
public static int maxEfficiency;
|
||||
public static int maxFireAspect;
|
||||
public static int maxLooting;
|
||||
public static int maxImpaling;
|
||||
public static int maxKnockback;
|
||||
public static int maxSharpness;
|
||||
public static int maxSmite;
|
||||
public static int maxSweepingEdge;
|
||||
public static int maxChanneling;
|
||||
public static int maxFlame;
|
||||
public static int maxInfinity;
|
||||
public static int maxLoyalty;
|
||||
public static int maxRiptide;
|
||||
public static int maxMultishot;
|
||||
public static int maxPiercing;
|
||||
public static int maxPower;
|
||||
public static int maxPunch;
|
||||
public static int maxQuickCharge;
|
||||
public static int maxFortune;
|
||||
public static int maxLuckOfTheSea;
|
||||
public static int maxLure;
|
||||
public static int maxSilkTouch;
|
||||
|
||||
// Chat Filter Setup & AntiSpam
|
||||
public static boolean antiUnicode;
|
||||
public static boolean antiSpamEnabled;
|
||||
public static int defaultGain;
|
||||
public static int lowGain;
|
||||
public static int mediumGain;
|
||||
public static int highGain;
|
||||
public static int heatDecay;
|
||||
public static int blockHeat;
|
||||
public static int punishHeat;
|
||||
public static boolean clearChat;
|
||||
public static String chatClearCommand;
|
||||
public static String spamPunishCommand;
|
||||
public static boolean logSpam;
|
||||
public static boolean antiSwearEnabled;
|
||||
public static int lowScore;
|
||||
public static int mediumLowScore;
|
||||
public static int mediumScore;
|
||||
public static int mediumHighScore;
|
||||
public static int highScore;
|
||||
public static int scoreDecay;
|
||||
public static int punishScore;
|
||||
public static boolean strictInstaPunish;
|
||||
public static String swearPunishCommand;
|
||||
public static String strictPunishCommand;
|
||||
public static boolean logSwear;
|
||||
public static List<String> swearWhitelist;
|
||||
public static List<String> swearBlacklist;
|
||||
public static List<String> slurs;
|
||||
public static Map<String, String> leetPatterns;
|
||||
public static FileConfiguration getConfig(String fileName) {
|
||||
File configFile = new File(Sentinel.getInstance().getDataFolder(), fileName);
|
||||
|
||||
if (!configFile.exists()) {
|
||||
Sentinel.getInstance().saveResource(fileName, false);
|
||||
}
|
||||
|
||||
return YamlConfiguration.loadConfiguration(configFile);
|
||||
}
|
||||
public static void loadConfiguration() {
|
||||
|
||||
Sentinel.prefix = mainConfig.getString("config.plugin.prefix");
|
||||
Sentinel.key = mainConfig.getString("config.plugin.key");
|
||||
lang = mainConfig.getString("config.plugin.lang");
|
||||
webhook = mainConfig.getString("config.plugin.webhook");
|
||||
trustedPlayers = mainConfig.getStringList("config.plugin.trusted");
|
||||
blockSpecific = mainConfig.getBoolean("config.plugin.block-specific");
|
||||
preventNBT = mainConfig.getBoolean("config.plugin.prevent-nbt");
|
||||
preventCmdBlockPlace = mainConfig.getBoolean("config.plugin.prevent-cmdblock-place");
|
||||
preventCmdBlockUse = mainConfig.getBoolean("config.plugin.prevent-cmdblock-use");
|
||||
preventCmdBlockChange = mainConfig.getBoolean("config.plugin.prevent-cmdblock-change");
|
||||
preventCmdCartPlace = mainConfig.getBoolean("config.plugin.prevent-cmdcart-place");
|
||||
preventCmdCartUse = mainConfig.getBoolean("config.plugin.prevent-cmdcart-use");
|
||||
cmdBlockOpCheck = mainConfig.getBoolean("config.plugin.cmdblock-op-check");
|
||||
dangerous = mainConfig.getStringList("config.plugin.dangerous");
|
||||
logDangerous = mainConfig.getBoolean("config.plugin.log-dangerous");
|
||||
logCmdBlocks = mainConfig.getBoolean("config.plugin.log-cmdblocks");
|
||||
logNBT = mainConfig.getBoolean("config.plugin.log-nbt");
|
||||
logSpecific = mainConfig.getBoolean("config.plugin.log-specific");
|
||||
logged = mainConfig.getStringList("config.plugin.logged");
|
||||
deop = mainConfig.getBoolean("config.plugin.deop");
|
||||
nbtPunish = mainConfig.getBoolean("config.plugin.nbt-punish");
|
||||
cmdBlockPunish = mainConfig.getBoolean("config.plugin.cmdblock-punish");
|
||||
commandPunish = mainConfig.getBoolean("config.plugin.command-punish");
|
||||
specificPunish = mainConfig.getBoolean("config.plugin.specific-punish");
|
||||
punishCommands = mainConfig.getStringList("config.plugin.punish-commands");
|
||||
reopCommand = mainConfig.getBoolean("config.plugin.reop-command");
|
||||
|
||||
// NBT
|
||||
allowName = nbtConfig.getBoolean("nbt.allow-name");
|
||||
allowLore = nbtConfig.getBoolean("nbt.allow-lore");
|
||||
allowAttributes = nbtConfig.getBoolean("nbt.allow-attributes");
|
||||
globalMaxEnchant = nbtConfig.getInt("nbt.global-max-enchant");
|
||||
|
||||
// ALL
|
||||
maxMending = nbtConfig.getInt("nbt.max-mending");
|
||||
maxUnbreaking = nbtConfig.getInt("nbt.max-unbreaking");
|
||||
maxVanishing = nbtConfig.getInt("nbt.max-vanishing");
|
||||
|
||||
// ARMOR
|
||||
maxAquaAffinity = nbtConfig.getInt("nbt.max-aqua-affinity");
|
||||
maxBlastProtection = nbtConfig.getInt("nbt.max-blast-protection");
|
||||
maxCurseOfBinding = nbtConfig.getInt("nbt.max-curse-of-binding");
|
||||
maxDepthStrider = nbtConfig.getInt("nbt.max-depth-strider");
|
||||
maxFeatherFalling = nbtConfig.getInt("nbt.max-feather-falling");
|
||||
maxFireProtection = nbtConfig.getInt("nbt.max-fire-protection");
|
||||
maxFrostWalker = nbtConfig.getInt("nbt.max-frost-walker");
|
||||
maxProjectileProtection = nbtConfig.getInt("nbt.max-projectile-protection");
|
||||
maxProtection = nbtConfig.getInt("nbt.max-protection");
|
||||
maxRespiration = nbtConfig.getInt("nbt.max-respiration");
|
||||
maxSoulSpeed = nbtConfig.getInt("nbt.max-soul-speed");
|
||||
maxThorns = nbtConfig.getInt("nbt.max-thorns");
|
||||
maxSwiftSneak = nbtConfig.getInt("nbt.max-swift-sneak");
|
||||
|
||||
// MELEE WEAPONS
|
||||
maxBaneOfArthropods = nbtConfig.getInt("nbt.max-bane-of-arthropods");
|
||||
maxEfficiency = nbtConfig.getInt("nbt.max-efficiency");
|
||||
maxFireAspect = nbtConfig.getInt("nbt.max-fire-aspect");
|
||||
maxLooting = nbtConfig.getInt("nbt.max-looting");
|
||||
maxImpaling = nbtConfig.getInt("nbt.max-impaling");
|
||||
maxKnockback = nbtConfig.getInt("nbt.max-knockback");
|
||||
maxSharpness = nbtConfig.getInt("nbt.max-sharpness");
|
||||
maxSmite = nbtConfig.getInt("nbt.max-smite");
|
||||
maxSweepingEdge = nbtConfig.getInt("nbt.max-sweeping-edge");
|
||||
|
||||
// RANGED WEAPONS
|
||||
maxChanneling = nbtConfig.getInt("nbt.max-channeling");
|
||||
maxFlame = nbtConfig.getInt("nbt.max-flame");
|
||||
maxInfinity = nbtConfig.getInt("nbt.max-infinity");
|
||||
maxLoyalty = nbtConfig.getInt("nbt.max-loyalty");
|
||||
maxRiptide = nbtConfig.getInt("nbt.max-riptide");
|
||||
maxMultishot = nbtConfig.getInt("nbt.max-multishot");
|
||||
maxPiercing = nbtConfig.getInt("nbt.max-piercing");
|
||||
maxPower = nbtConfig.getInt("nbt.max-power");
|
||||
maxPunch = nbtConfig.getInt("nbt.max-punch");
|
||||
maxQuickCharge = nbtConfig.getInt("nbt.max-quick-charge");
|
||||
|
||||
// TOOLS
|
||||
maxEfficiency = nbtConfig.getInt("nbt.max-efficiency");
|
||||
maxFortune = nbtConfig.getInt("nbt.max-fortune");
|
||||
maxLuckOfTheSea = nbtConfig.getInt("nbt.max-luck-of-the-sea");
|
||||
maxLure = nbtConfig.getInt("nbt.max-lure");
|
||||
maxSilkTouch = nbtConfig.getInt("nbt.max-silk-touch");
|
||||
|
||||
// Chat Filter Setup & AntiSpam
|
||||
antiUnicode = mainConfig.getBoolean("config.chat.anti-unicode");
|
||||
antiSpamEnabled = mainConfig.getBoolean("config.chat.anti-spam.enabled");
|
||||
defaultGain = mainConfig.getInt("config.chat.anti-spam.default-gain");
|
||||
lowGain = mainConfig.getInt("config.chat.anti-spam.low-gain");
|
||||
mediumGain = mainConfig.getInt("config.chat.anti-spam.medium-gain");
|
||||
highGain = mainConfig.getInt("config.chat.anti-spam.high-gain");
|
||||
heatDecay = mainConfig.getInt("config.chat.anti-spam.heat-decay");
|
||||
blockHeat = mainConfig.getInt("config.chat.anti-spam.block-heat");
|
||||
punishHeat = mainConfig.getInt("config.chat.anti-spam.punish-heat");
|
||||
clearChat = mainConfig.getBoolean("config.chat.anti-spam.clear-chat");
|
||||
chatClearCommand = mainConfig.getString("config.chat.anti-spam.chat-clear-command");
|
||||
spamPunishCommand = mainConfig.getString("config.chat.anti-spam.punish-command");
|
||||
logSpam = mainConfig.getBoolean("config.chat.anti-spam.log-spam");
|
||||
antiSwearEnabled = mainConfig.getBoolean("config.chat.anti-swear.enabled");
|
||||
lowScore = mainConfig.getInt("config.chat.anti-swear.low-score");
|
||||
mediumLowScore = mainConfig.getInt("config.chat.anti-swear.medium-low-score");
|
||||
mediumScore = mainConfig.getInt("config.chat.anti-swear.medium-score");
|
||||
mediumHighScore = mainConfig.getInt("config.chat.anti-swear.medium-high-score");
|
||||
highScore = mainConfig.getInt("config.chat.anti-swear.high-score");
|
||||
scoreDecay = mainConfig.getInt("config.chat.anti-swear.score-decay");
|
||||
punishScore = mainConfig.getInt("config.chat.anti-swear.punish-score");
|
||||
strictInstaPunish = mainConfig.getBoolean("config.chat.anti-swear.strict-insta-punish");
|
||||
swearPunishCommand = mainConfig.getString("config.chat.anti-swear.punish-command");
|
||||
strictPunishCommand = mainConfig.getString("config.chat.anti-swear.strict-command");
|
||||
logSwear = mainConfig.getBoolean("config.chat.anti-swear.log-swear");
|
||||
swearWhitelist = falsePositives.getStringList("false-positives");
|
||||
swearBlacklist = swearWords.getStringList("blacklisted");
|
||||
slurs = strictWords.getStringList("strict");
|
||||
leetPatterns = loadLeetPatterns();
|
||||
logSwear = mainConfig.getBoolean("config.chat.anti-swear.log-swear");
|
||||
|
||||
}
|
||||
private static Map<String, String> loadLeetPatterns() {
|
||||
Map<String, String> dictionary = new HashMap<>();
|
||||
ConfigurationSection section = mainConfig.getConfigurationSection("config.chat.anti-swear.leet-patterns");
|
||||
|
||||
if (section != null) {
|
||||
for (String key : section.getKeys(false)) {
|
||||
dictionary.put(key, section.getString(key));
|
||||
}
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package io.github.thetrouper.sentinel.server.config;
|
||||
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class FPConfig implements JsonSerializable<FPConfig> {
|
||||
@@ -12,5 +14,60 @@ public class FPConfig implements JsonSerializable<FPConfig> {
|
||||
return new File("plugins/Sentinel/false-positives.json");
|
||||
}
|
||||
|
||||
public static List<String> swearWhitelist;
|
||||
public static List<String> swearWhitelist = new ArrayList<>(Arrays.asList(
|
||||
"but then",
|
||||
"was scamming",
|
||||
"an alt",
|
||||
"can also",
|
||||
"analysis",
|
||||
"analytics",
|
||||
"arsenal",
|
||||
"assassin",
|
||||
"as saying",
|
||||
"assert",
|
||||
"assign",
|
||||
"assimil",
|
||||
"assist",
|
||||
"associat",
|
||||
"assum",
|
||||
"assur",
|
||||
"basement",
|
||||
"bass",
|
||||
"cass",
|
||||
"butter",
|
||||
"canvass",
|
||||
"cocktail",
|
||||
"cumber",
|
||||
"document",
|
||||
"evaluate",
|
||||
"exclusive",
|
||||
"expensive",
|
||||
"explain",
|
||||
"expression",
|
||||
"grape",
|
||||
"grass",
|
||||
"harass",
|
||||
"hotwater",
|
||||
"identit",
|
||||
"kassa",
|
||||
"kassi",
|
||||
"lass",
|
||||
"leafage",
|
||||
"libshitz",
|
||||
"magnacumlaude",
|
||||
"mass",
|
||||
"mocha",
|
||||
"pass",
|
||||
"phoebe",
|
||||
"phoenix",
|
||||
"push it",
|
||||
"sassy",
|
||||
"saturday",
|
||||
"scrap",
|
||||
"serfage",
|
||||
"sexist",
|
||||
"shoe",
|
||||
"stitch",
|
||||
"therapist"
|
||||
));
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package io.github.thetrouper.sentinel.server.config;
|
||||
|
||||
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class Lang implements JsonSerializable<Lang> {
|
||||
|
||||
@Override
|
||||
public File getFile() {
|
||||
return new File("plugins/Sentinel/lang/" + Config.lang);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package io.github.thetrouper.sentinel.server.config;
|
||||
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.server.util.JsonSerializable;
|
||||
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class LanguageFile implements JsonSerializable<LanguageFile> {
|
||||
public static final File PATH = new File(Sentinel.getInstance().getDataFolder(), "/lang/" + Config.lang);
|
||||
public static final File PATH = new File(Sentinel.getInstance().getDataFolder(), "/lang/" + MainConfig.Plugin.lang);
|
||||
private final Map<String,String> dictionary = new HashMap<>();
|
||||
public LanguageFile() {}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package io.github.thetrouper.sentinel.server.config;
|
||||
|
||||
import io.github.thetrouper.sentinel.server.util.JsonSerializable;
|
||||
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MainConfig implements JsonSerializable<MainConfig> {
|
||||
|
||||
@@ -15,62 +15,82 @@ public class MainConfig implements JsonSerializable<MainConfig> {
|
||||
|
||||
public static class Plugin {
|
||||
public static String prefix = "§d§lSentinel §8» §7";
|
||||
public static String webhook;
|
||||
public static String lang;
|
||||
public static List<String> trustedPlayers;
|
||||
public static boolean blockSpecific;
|
||||
public static boolean preventNBT;
|
||||
public static boolean preventCmdBlockPlace;
|
||||
public static boolean preventCmdBlockUse;
|
||||
public static boolean preventCmdBlockChange;
|
||||
public static boolean preventCmdCartPlace;
|
||||
public static boolean preventCmdCartUse;
|
||||
public static boolean cmdBlockOpCheck;
|
||||
public static List<String> dangerous;
|
||||
public static boolean logDangerous;
|
||||
public static boolean logCmdBlocks;
|
||||
public static boolean logNBT;
|
||||
public static boolean logSpecific;
|
||||
public static List<String> logged;
|
||||
public static boolean deop;
|
||||
public static boolean nbtPunish;
|
||||
public static boolean cmdBlockPunish;
|
||||
public static boolean commandPunish;
|
||||
public static boolean specificPunish;
|
||||
public static List<String> punishCommands;
|
||||
public static boolean reopCommand;
|
||||
public static String webhook = "https://discord.com/api/webhooks/id/token";
|
||||
public static String lang = "en-us.json";
|
||||
public static List<String> trustedPlayers = new ArrayList<>() {{
|
||||
add("049460f7-21cb-42f5-8059-d42752bf406f");
|
||||
}};
|
||||
public static boolean blockSpecific = true;
|
||||
public static boolean preventNBT = true;
|
||||
public static boolean preventCmdBlockPlace = true;
|
||||
public static boolean preventCmdBlockUse = true;
|
||||
public static boolean preventCmdBlockChange = true;
|
||||
public static boolean preventCmdCartPlace = true;
|
||||
public static boolean preventCmdCartUse = true;
|
||||
public static boolean cmdBlockOpCheck = true;
|
||||
public static List<String> dangerous = new ArrayList<>() {{
|
||||
add("op");
|
||||
add("deop");
|
||||
add("stop");
|
||||
add("restart");
|
||||
add("execute");
|
||||
add("sudo");
|
||||
add("esudo");
|
||||
add("fill");
|
||||
add("setblock");
|
||||
add("data");
|
||||
add("whitelist");
|
||||
}};
|
||||
public static boolean logDangerous = true;
|
||||
public static boolean logCmdBlocks = true;
|
||||
public static boolean logNBT = true;
|
||||
public static boolean logSpecific = false;
|
||||
public static List<String> logged = new ArrayList<>() {{
|
||||
add("give");
|
||||
add("item");
|
||||
}};
|
||||
public static boolean deop = true;
|
||||
public static boolean nbtPunish = false;
|
||||
public static boolean cmdBlockPunish = false;
|
||||
public static boolean commandPunish = false;
|
||||
public static boolean specificPunish = false;
|
||||
public static List<String> punishCommands = new ArrayList<>() {{
|
||||
add("smite %player%");
|
||||
add("ban %player% ]=- Sentinel -=[ You have been banned for attempting a dangerous action. If you believe this to be a mistake, please contact the server owner.");
|
||||
}};
|
||||
public static boolean reopCommand = false;
|
||||
}
|
||||
|
||||
public static class Chat {
|
||||
public static boolean antiUnicode;
|
||||
public static boolean antiUnicode = true;
|
||||
|
||||
public static class antiSpam {
|
||||
public static boolean antiSpamEnabled;
|
||||
public static int defaultGain;
|
||||
public static int lowGain;
|
||||
public static int mediumGain;
|
||||
public static int highGain;
|
||||
public static int heatDecay;
|
||||
public static int blockHeat;
|
||||
public static int punishHeat;
|
||||
public static boolean clearChat;
|
||||
public static String chatClearCommand;
|
||||
public static String spamPunishCommand;
|
||||
public static boolean logSpam;
|
||||
public static class AntiSpam {
|
||||
public static boolean antiSpamEnabled = true;
|
||||
public static int defaultGain = 1;
|
||||
public static int lowGain = 2;
|
||||
public static int mediumGain = 4;
|
||||
public static int highGain = 6;
|
||||
public static int heatDecay = 1;
|
||||
public static int blockHeat = 10;
|
||||
public static int punishHeat = 25;
|
||||
public static boolean clearChat = true;
|
||||
public static String chatClearCommand = "cc";
|
||||
public static String spamPunishCommand = "mute %player% 1m Please refrain from spamming!";
|
||||
public static boolean logSpam = true;
|
||||
}
|
||||
public static class antiSwear {
|
||||
public static boolean antiSwearEnabled;
|
||||
public static int lowScore;
|
||||
public static int mediumLowScore;
|
||||
public static int mediumScore;
|
||||
public static int mediumHighScore;
|
||||
public static int highScore;
|
||||
public static int scoreDecay;
|
||||
public static int punishScore;
|
||||
public static boolean strictInstaPunish;
|
||||
public static String swearPunishCommand;
|
||||
public static String strictPunishCommand;
|
||||
public static boolean logSwears;
|
||||
public static class AntiSwear {
|
||||
public static boolean antiSwearEnabled = true;
|
||||
public static int lowScore = 0;
|
||||
public static int mediumLowScore = 1;
|
||||
public static int mediumScore = 3;
|
||||
public static int mediumHighScore = 5;
|
||||
public static int highScore = 7;
|
||||
public static int scoreDecay = 3;
|
||||
public static int punishScore = 20;
|
||||
public static boolean strictInstaPunish = true;
|
||||
public static String swearPunishCommand = "mute %player% 15m Do not attempt to bypass the Profanity Filter";
|
||||
public static String strictPunishCommand = "mute %player% 1h Discriminatory speech is not tolerated on this server!";
|
||||
public static boolean logSwears = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,47 +13,47 @@ public class NBTConfig implements JsonSerializable<NBTConfig> {
|
||||
return new File("plugins/Sentinel/NBTConfig.json");
|
||||
}
|
||||
|
||||
public static boolean allowName;
|
||||
public static boolean allowLore;
|
||||
public static boolean allowAttributes;
|
||||
public static int globalMaxEnchant;
|
||||
public static int maxMending;
|
||||
public static int maxUnbreaking;
|
||||
public static int maxVanishing;
|
||||
public static int maxAquaAffinity;
|
||||
public static int maxBlastProtection;
|
||||
public static int maxCurseOfBinding;
|
||||
public static int maxDepthStrider;
|
||||
public static int maxFeatherFalling;
|
||||
public static int maxFireProtection;
|
||||
public static int maxFrostWalker;
|
||||
public static int maxProjectileProtection;
|
||||
public static int maxProtection;
|
||||
public static int maxRespiration;
|
||||
public static int maxSoulSpeed;
|
||||
public static int maxThorns;
|
||||
public static int maxSwiftSneak;
|
||||
public static int maxBaneOfArthropods;
|
||||
public static int maxEfficiency;
|
||||
public static int maxFireAspect;
|
||||
public static int maxLooting;
|
||||
public static int maxImpaling;
|
||||
public static int maxKnockback;
|
||||
public static int maxSharpness;
|
||||
public static int maxSmite;
|
||||
public static int maxSweepingEdge;
|
||||
public static int maxChanneling;
|
||||
public static int maxFlame;
|
||||
public static int maxInfinity;
|
||||
public static int maxLoyalty;
|
||||
public static int maxRiptide;
|
||||
public static int maxMultishot;
|
||||
public static int maxPiercing;
|
||||
public static int maxPower;
|
||||
public static int maxPunch;
|
||||
public static int maxQuickCharge;
|
||||
public static int maxFortune;
|
||||
public static int maxLuckOfTheSea;
|
||||
public static int maxLure;
|
||||
public static int maxSilkTouch;
|
||||
public static boolean allowName = true;
|
||||
public static boolean allowLore = true;
|
||||
public static boolean allowAttributes = false;
|
||||
public static int globalMaxEnchant = 5;
|
||||
public static int maxMending = 1;
|
||||
public static int maxUnbreaking = 3;
|
||||
public static int maxVanishing = 1;
|
||||
public static int maxAquaAffinity = 1;
|
||||
public static int maxBlastProtection = 4;
|
||||
public static int maxCurseOfBinding = 1;
|
||||
public static int maxDepthStrider = 3;
|
||||
public static int maxFeatherFalling = 4;
|
||||
public static int maxFireProtection = 4;
|
||||
public static int maxFrostWalker = 2;
|
||||
public static int maxProjectileProtection = 4;
|
||||
public static int maxProtection = 4;
|
||||
public static int maxRespiration = 3;
|
||||
public static int maxSoulSpeed = 3;
|
||||
public static int maxThorns = 3;
|
||||
public static int maxSwiftSneak = 3;
|
||||
public static int maxBaneOfArthropods = 5;
|
||||
public static int maxEfficiency = 5;
|
||||
public static int maxFireAspect = 2;
|
||||
public static int maxLooting = 3;
|
||||
public static int maxImpaling = 5;
|
||||
public static int maxKnockback = 2;
|
||||
public static int maxSharpness = 5;
|
||||
public static int maxSmite = 5;
|
||||
public static int maxSweepingEdge = 3;
|
||||
public static int maxChanneling = 1;
|
||||
public static int maxFlame = 1;
|
||||
public static int maxInfinity = 1;
|
||||
public static int maxLoyalty = 3;
|
||||
public static int maxRiptide = 3;
|
||||
public static int maxMultishot = 1;
|
||||
public static int maxPiercing = 4;
|
||||
public static int maxPower = 5;
|
||||
public static int maxPunch = 2;
|
||||
public static int maxQuickCharge = 3;
|
||||
public static int maxFortune = 3;
|
||||
public static int maxLuckOfTheSea = 3;
|
||||
public static int maxLure = 3;
|
||||
public static int maxSilkTouch = 1;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.github.thetrouper.sentinel.server.config;
|
||||
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class StrictConfig implements JsonSerializable<StrictConfig> {
|
||||
@@ -11,5 +12,14 @@ public class StrictConfig implements JsonSerializable<StrictConfig> {
|
||||
return new File("plugins/Sentinel/strict.json");
|
||||
}
|
||||
|
||||
public static List<String> strict;
|
||||
public static List<String> strict = new ArrayList<>() {{
|
||||
add("nigg");
|
||||
add("niger");
|
||||
add("nlgg");
|
||||
add("nlger");
|
||||
add("njgg");
|
||||
add("tranny");
|
||||
add("fag");
|
||||
add("beaner");
|
||||
}};
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.github.thetrouper.sentinel.server.config;
|
||||
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SwearsConfig implements JsonSerializable<SwearsConfig> {
|
||||
@@ -11,5 +12,84 @@ public class SwearsConfig implements JsonSerializable<SwearsConfig> {
|
||||
return new File("plugins/Sentinel/swears.json");
|
||||
}
|
||||
|
||||
public static List<String> swears;
|
||||
public static List<String> swears = new ArrayList<>() {{
|
||||
add("anal");
|
||||
add("anus");
|
||||
add("arse");
|
||||
add("ass");
|
||||
add("ballsack");
|
||||
add("balls");
|
||||
add("bastard");
|
||||
add("bitch");
|
||||
add("btch");
|
||||
add("biatch");
|
||||
add("blowjob");
|
||||
add("bollock");
|
||||
add("bollok");
|
||||
add("boner");
|
||||
add("boob");
|
||||
add("bugger");
|
||||
add("butt");
|
||||
add("choad");
|
||||
add("clitoris");
|
||||
add("cock");
|
||||
add("coon");
|
||||
add("crap");
|
||||
add("cum");
|
||||
add("cunt");
|
||||
add("dick");
|
||||
add("dildo");
|
||||
add("douchebag");
|
||||
add("dyke");
|
||||
add("feck");
|
||||
add("fellate");
|
||||
add("fellatio");
|
||||
add("felching");
|
||||
add("fuck");
|
||||
add("fudgepacker");
|
||||
add("flange");
|
||||
add("gtfo");
|
||||
add("hoe");
|
||||
add("horny");
|
||||
add("incest");
|
||||
add("jerk");
|
||||
add("jizz");
|
||||
add("labia");
|
||||
add("masturb");
|
||||
add("muff");
|
||||
add("nazi");
|
||||
add("nipple");
|
||||
add("nips");
|
||||
add("nude");
|
||||
add("pedophile");
|
||||
add("penis");
|
||||
add("piss");
|
||||
add("poop");
|
||||
add("porn");
|
||||
add("prick");
|
||||
add("prostit");
|
||||
add("pube");
|
||||
add("pussie");
|
||||
add("pussy");
|
||||
add("queer");
|
||||
add("rape");
|
||||
add("rapist");
|
||||
add("retard");
|
||||
add("rimjob");
|
||||
add("scrotum");
|
||||
add("sex");
|
||||
add("shit");
|
||||
add("slut");
|
||||
add("spunk");
|
||||
add("stfu");
|
||||
add("suckmy");
|
||||
add("tits");
|
||||
add("tittie");
|
||||
add("titty");
|
||||
add("turd");
|
||||
add("twat");
|
||||
add("vagina");
|
||||
add("wank");
|
||||
add("whore");
|
||||
}};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package io.github.thetrouper.sentinel.server.functions;
|
||||
|
||||
public class AdvancedBlockers {
|
||||
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package io.github.thetrouper.sentinel.server.functions;
|
||||
|
||||
import io.github.thetrouper.sentinel.data.FAT;
|
||||
import io.github.thetrouper.sentinel.server.FilterAction;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import io.github.thetrouper.sentinel.server.util.GPTUtils;
|
||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||
import io.github.thetrouper.sentinel.server.util.Text;
|
||||
@@ -38,29 +38,29 @@ public class AntiSpam {
|
||||
if (lastMessageMap.containsKey(p)) {
|
||||
String lastMessage = lastMessageMap.get(p);
|
||||
double similarity = GPTUtils.calcSim(message, lastMessage);
|
||||
ServerUtils.sendDebugMessage("AntiSpam: " + p.getName() + " has a heat of " + heatMap.get(p) + "/" + Config.punishHeat + ". Current Message: \"" + message + "\" Last message: \"" + lastMessage + "\"");
|
||||
ServerUtils.sendDebugMessage("AntiSpam: " + p.getName() + " has a heat of " + heatMap.get(p) + "/" + MainConfig.Chat.AntiSpam.punishHeat + ". Current Message: \"" + message + "\" Last message: \"" + lastMessage + "\"");
|
||||
if (similarity > 90) {
|
||||
heatMap.put(p, heatMap.get(p) + Config.highGain);
|
||||
ServerUtils.sendDebugMessage("AntiSpam: Similarity: " + similarity + ", is greater than 90% for " + p.getName() + ". Adding " + Config.highGain);
|
||||
heatMap.put(p, heatMap.get(p) + MainConfig.Chat.AntiSpam.highGain);
|
||||
ServerUtils.sendDebugMessage("AntiSpam: Similarity: " + similarity + ", is greater than 90% for " + p.getName() + ". Adding " + MainConfig.Chat.AntiSpam.highGain);
|
||||
} else if (similarity > 50) {
|
||||
heatMap.put(p, heatMap.get(p) + Config.mediumGain);
|
||||
ServerUtils.sendDebugMessage("AntiSpam: Similarity: " + similarity + ", is greater than 50% for " + p.getName() + ". Adding " + Config.mediumGain);
|
||||
heatMap.put(p, heatMap.get(p) + MainConfig.Chat.AntiSpam.mediumGain);
|
||||
ServerUtils.sendDebugMessage("AntiSpam: Similarity: " + similarity + ", is greater than 50% for " + p.getName() + ". Adding " + MainConfig.Chat.AntiSpam.mediumGain);
|
||||
} else if (similarity > 25) {
|
||||
heatMap.put(p, heatMap.get(p) + Config.lowGain);
|
||||
ServerUtils.sendDebugMessage("AntiSpam: Similarity: " + similarity + ", is greater than 25% for " + p.getName() + ". Adding " + Config.lowGain);
|
||||
heatMap.put(p, heatMap.get(p) + MainConfig.Chat.AntiSpam.lowGain);
|
||||
ServerUtils.sendDebugMessage("AntiSpam: Similarity: " + similarity + ", is greater than 25% for " + p.getName() + ". Adding " + MainConfig.Chat.AntiSpam.lowGain);
|
||||
}
|
||||
}
|
||||
|
||||
if (heatMap.get(p) > Config.punishHeat) {
|
||||
if (heatMap.get(p) > MainConfig.Chat.AntiSpam.punishHeat) {
|
||||
e.setCancelled(true);
|
||||
FilterAction.filterAction(p,e,null,null, GPTUtils.calcSim(e.getMessage(),lastMessageMap.get(p)), FAT.SPAM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (heatMap.get(p) > Config.blockHeat) {
|
||||
if (heatMap.get(p) > MainConfig.Chat.AntiSpam.blockHeat) {
|
||||
e.setCancelled(true);
|
||||
FilterAction.filterAction(p,e,null,null, GPTUtils.calcSim(e.getMessage(),lastMessageMap.get(p)), FAT.BLOCK_SPAM);
|
||||
heatMap.put(p, heatMap.get(p) + Config.highGain);
|
||||
heatMap.put(p, heatMap.get(p) + MainConfig.Chat.AntiSpam.highGain);
|
||||
return;
|
||||
}
|
||||
lastMessageMap.put(p, message);
|
||||
@@ -69,7 +69,7 @@ public class AntiSpam {
|
||||
for (Player p : heatMap.keySet()) {
|
||||
int heat = heatMap.get(p);
|
||||
if (heat > 0) {
|
||||
heat = heat - Config.heatDecay;
|
||||
heat = heat - MainConfig.Chat.AntiSpam.heatDecay;
|
||||
heatMap.put(p, Math.max(0, heat));
|
||||
}
|
||||
//ServerUtils.sendDebugMessage("AntiSpam: Decaying heat for " + p.getName() + ": " + heatMap.get(p));
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.github.thetrouper.sentinel.server.functions;
|
||||
import io.github.itzispyder.pdk.utils.ServerUtils;
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.cmds.SocialSpyCommand;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.chat.hover.content.Text;
|
||||
@@ -23,9 +23,9 @@ public class Message {
|
||||
receivers.add(sender);
|
||||
AsyncPlayerChatEvent checkEvent = new AsyncPlayerChatEvent(true,sender,message,receivers);
|
||||
if (checkEvent.isCancelled()) return;
|
||||
if (!Sentinel.isTrusted(sender) || !sender.hasPermission("sentinel.chat.antiswear.bypass")) if (Config.antiSwearEnabled) ProfanityFilter.handleProfanityFilter(checkEvent);
|
||||
if (!Sentinel.isTrusted(sender) || !sender.hasPermission("sentinel.chat.antispam.bypass")) if (Config.antiSpamEnabled) AntiSpam.handleAntiSpam(checkEvent);
|
||||
if (!Sentinel.isTrusted(sender) || !sender.hasPermission("sentinel.chat.antiunicode.bypass")) if (Config.antiUnicode) AntiUnicode.handleAntiUnicode(checkEvent);
|
||||
if (!Sentinel.isTrusted(sender) || !sender.hasPermission("sentinel.chat.antiswear.bypass")) if (MainConfig.Chat.AntiSwear.antiSwearEnabled) ProfanityFilter.handleProfanityFilter(checkEvent);
|
||||
if (!Sentinel.isTrusted(sender) || !sender.hasPermission("sentinel.chat.antispam.bypass")) if (MainConfig.Chat.AntiSpam.antiSpamEnabled) AntiSpam.handleAntiSpam(checkEvent);
|
||||
if (!Sentinel.isTrusted(sender) || !sender.hasPermission("sentinel.chat.antiunicode.bypass")) if (MainConfig.Chat.antiUnicode) AntiUnicode.handleAntiUnicode(checkEvent);
|
||||
if (checkEvent.isCancelled()) return;
|
||||
|
||||
sender.sendMessage(Sentinel.dict.get("message-sent").formatted(receiver.getName(),message));
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.github.thetrouper.sentinel.server.functions;
|
||||
|
||||
import io.github.thetrouper.sentinel.data.FAT;
|
||||
import io.github.thetrouper.sentinel.server.FilterAction;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.*;
|
||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||
import io.github.thetrouper.sentinel.server.util.Text;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -14,9 +14,9 @@ import java.util.Map;
|
||||
|
||||
public class ProfanityFilter {
|
||||
public static Map<Player, Integer> scoreMap;
|
||||
private static final List<String> swearBlacklist = Config.swearBlacklist;
|
||||
private static final List<String> swearWhitelist = Config.swearWhitelist;
|
||||
private static final List<String> slurs = Config.slurs;
|
||||
private static final List<String> swearBlacklist = SwearsConfig.swears;
|
||||
private static final List<String> swearWhitelist = FPConfig.swearWhitelist;
|
||||
private static final List<String> slurs = StrictConfig.strict;
|
||||
|
||||
public static void enableAntiSwear() {
|
||||
scoreMap = new HashMap<>();
|
||||
@@ -28,48 +28,48 @@ public class ProfanityFilter {
|
||||
String severity = ProfanityFilter.checkSeverity(message);
|
||||
if (!scoreMap.containsKey(p)) scoreMap.put(p, 0);
|
||||
// Old: if (scoreMap.get(p) > Config.punishScore) punishSwear(p,highlighted,message,e);
|
||||
if (scoreMap.get(p) > Config.punishScore) FilterAction.filterAction(p,e,highlighted,severity, null, FAT.SWEAR);
|
||||
if (scoreMap.get(p) > MainConfig.Chat.AntiSwear.punishScore) FilterAction.filterAction(p,e,highlighted,severity, null, FAT.SWEAR);
|
||||
|
||||
switch (severity) {
|
||||
case "low" -> {
|
||||
ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + Config.lowScore);
|
||||
scoreMap.put(p, scoreMap.get(p) + Config.lowScore);
|
||||
ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + MainConfig.Chat.AntiSwear.lowScore);
|
||||
scoreMap.put(p, scoreMap.get(p) + MainConfig.Chat.AntiSwear.lowScore);
|
||||
e.setCancelled(true);
|
||||
// Old: blockSwear(p,highlighted,message,severity,e);
|
||||
FilterAction.filterAction(p,e,highlighted,severity, null, FAT.BLOCK_SWEAR);
|
||||
}
|
||||
case "medium-low" -> {
|
||||
ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + Config.mediumLowScore);
|
||||
scoreMap.put(p, scoreMap.get(p) + Config.mediumLowScore);
|
||||
ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + MainConfig.Chat.AntiSwear.mediumLowScore);
|
||||
scoreMap.put(p, scoreMap.get(p) + MainConfig.Chat.AntiSwear.mediumLowScore);
|
||||
e.setCancelled(true);
|
||||
// Old: blockSwear(p,highlighted,message,severity,e);
|
||||
FilterAction.filterAction(p,e,highlighted,severity, null, FAT.BLOCK_SWEAR);
|
||||
}
|
||||
case "medium" -> {
|
||||
ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + Config.mediumScore);
|
||||
scoreMap.put(p, scoreMap.get(p) + Config.mediumScore);
|
||||
ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + MainConfig.Chat.AntiSwear.mediumScore);
|
||||
scoreMap.put(p, scoreMap.get(p) + MainConfig.Chat.AntiSwear.mediumScore);
|
||||
e.setCancelled(true);
|
||||
// Old: blockSwear(p,highlighted,message,severity,e);
|
||||
FilterAction.filterAction(p,e,highlighted,severity, null, FAT.BLOCK_SWEAR);
|
||||
}
|
||||
case "medium-high" -> {
|
||||
ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + Config.mediumHighScore);
|
||||
scoreMap.put(p, scoreMap.get(p) + Config.mediumHighScore);
|
||||
ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + MainConfig.Chat.AntiSwear.mediumHighScore);
|
||||
scoreMap.put(p, scoreMap.get(p) + MainConfig.Chat.AntiSwear.mediumHighScore);
|
||||
e.setCancelled(true);
|
||||
// Old: blockSwear(p,highlighted,message,severity,e);
|
||||
FilterAction.filterAction(p,e,highlighted,severity, null, FAT.BLOCK_SWEAR);
|
||||
}
|
||||
case "high" -> {
|
||||
ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + Config.highScore);
|
||||
scoreMap.put(p, scoreMap.get(p) + Config.highScore);
|
||||
ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + MainConfig.Chat.AntiSwear.highScore);
|
||||
scoreMap.put(p, scoreMap.get(p) + MainConfig.Chat.AntiSwear.highScore);
|
||||
e.setCancelled(true);
|
||||
// Old: blockSwear(p,highlighted,message,severity,e);
|
||||
FilterAction.filterAction(p,e,highlighted,severity, null, FAT.BLOCK_SWEAR);
|
||||
}
|
||||
case "slur" -> {
|
||||
// Insta-Punish
|
||||
ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + Config.highScore);
|
||||
scoreMap.put(p, scoreMap.get(p) + Config.highScore);
|
||||
ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + MainConfig.Chat.AntiSwear.highScore);
|
||||
scoreMap.put(p, scoreMap.get(p) + MainConfig.Chat.AntiSwear.highScore);
|
||||
e.setCancelled(true);
|
||||
// Old: punishSlur(p,highlighted,message,e);
|
||||
FilterAction.filterAction(p,e,highlighted,severity, null,FAT.SLUR);
|
||||
@@ -286,7 +286,7 @@ public class ProfanityFilter {
|
||||
for (Player p : scoreMap.keySet()) {
|
||||
int score = scoreMap.get(p);
|
||||
if (score > 0) {
|
||||
score = score - Config.scoreDecay;
|
||||
score = score - MainConfig.Chat.AntiSwear.scoreDecay;
|
||||
scoreMap.put(p, Math.max(0, score));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.github.thetrouper.sentinel.server.functions;
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.data.Emojis;
|
||||
import io.github.thetrouper.sentinel.discord.DiscordWebhook;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.MainConfig;
|
||||
import io.github.thetrouper.sentinel.server.util.Randomizer;
|
||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -53,7 +53,7 @@ public class ReportFalsePositives {
|
||||
String simplifyRep,
|
||||
String sanitized) {
|
||||
ServerUtils.sendDebugMessage("Creating FalsePositive Webhook...");
|
||||
DiscordWebhook webhook = new DiscordWebhook(Config.webhook);
|
||||
DiscordWebhook webhook = new DiscordWebhook(MainConfig.Plugin.webhook);
|
||||
webhook.setAvatarUrl("https://r2.e-z.host/d440b58a-ba90-4839-8df6-8bba298cf817/3lwit5nt.png");
|
||||
webhook.setUsername("Sentinel Anti-Nuke | Logs");
|
||||
DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject()
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
package io.github.thetrouper.sentinel.server.util;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public interface JsonSerializable<T> {
|
||||
|
||||
Gson gson = new GsonBuilder().serializeNulls().setPrettyPrinting().create();
|
||||
File getFile();
|
||||
|
||||
default String serialize(boolean pretty) {
|
||||
Gson gson;
|
||||
if (pretty) {
|
||||
gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
}
|
||||
else {
|
||||
gson = new Gson();
|
||||
}
|
||||
|
||||
try {
|
||||
String json = gson.toJson(this);
|
||||
if (json == null) {
|
||||
throw new IllegalStateException("json parse failed for " + this.getClass().getSimpleName());
|
||||
}
|
||||
return json;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return "{}";
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default T deserialize(String json) {
|
||||
try {
|
||||
JsonSerializable<?> v = gson.fromJson(json, this.getClass());
|
||||
if (v == null) {
|
||||
throw new IllegalStateException("json parse failed");
|
||||
}
|
||||
return (T)v;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
default void save() {
|
||||
String json = serialize(true);
|
||||
File f = getFile();
|
||||
|
||||
if (FileValidationUtils.validate(f)) {
|
||||
try {
|
||||
FileWriter fw = new FileWriter(f);
|
||||
BufferedWriter bw = new BufferedWriter(fw);
|
||||
bw.write(json);
|
||||
bw.close();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default <O> O getOrDef(O val, O def) {
|
||||
return val != null ? val : def;
|
||||
}
|
||||
|
||||
static <T extends JsonSerializable<?>> T load(File file, Class<T> jsonSerializable, T fallback) {
|
||||
if (FileValidationUtils.validate(file)) {
|
||||
try {
|
||||
FileReader fr = new FileReader(file);
|
||||
BufferedReader br = new BufferedReader(fr);
|
||||
T t = gson.fromJson(br, jsonSerializable);
|
||||
|
||||
if (t == null) {
|
||||
throw new IllegalStateException("json parse failed!");
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
static <T extends JsonSerializable<?>> T load(String path, Class<T> jsonSerializable, T fallback) {
|
||||
return load(new File(path), jsonSerializable, fallback);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package io.github.thetrouper.sentinel.server.util;
|
||||
|
||||
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.server.config.Config;
|
||||
import io.github.thetrouper.sentinel.server.config.AdvancedConfig;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
@@ -48,7 +48,7 @@ public class Text {
|
||||
return result.toString();
|
||||
}
|
||||
public static String fromLeetString(String s) {
|
||||
Map<String, String> dictionary = Config.leetPatterns;
|
||||
Map<String, String> dictionary = AdvancedConfig.leetPatterns;
|
||||
String msg = s;
|
||||
|
||||
for (String key : dictionary.keySet()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"dictionary" : {
|
||||
"example-message" : "Test Message",
|
||||
"if-you-see-this-lang-is-broken" : "Sentinel language is working!",
|
||||
"no-permission" : "§cInsufficient Permissions!",
|
||||
"cooldown" : "This action is on cooldown!",
|
||||
"false-positive-report-success" : "Successfully reported a false positive!",
|
||||
|
||||
Reference in New Issue
Block a user