Trying to fix dictionary saving

This commit is contained in:
obvWolf
2024-01-18 01:17:54 -06:00
parent c92cf71b07
commit dba308efd2
4 changed files with 120 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
package io.github.thetrouper.sentinel.data;
import io.github.thetrouper.sentinel.Sentinel;
public enum FilterSeverity {
LOW(Sentinel.mainConfig.chat.antiSwear.lowScore),
MEDIUM_LOW(Sentinel.mainConfig.chat.antiSwear.mediumLowScore),
MEDIUM(Sentinel.mainConfig.chat.antiSwear.mediumScore),
MEDIUM_HIGH(Sentinel.mainConfig.chat.antiSwear.mediumHighScore),
HIGH(Sentinel.mainConfig.chat.antiSwear.highScore),
SLUR(Sentinel.mainConfig.chat.antiSwear.highScore),
SAFE(0);
private final int score;
FilterSeverity(int score) {
this.score = score;
}
public int getScore() {
return score;
}
}

View File

@@ -1,6 +1,20 @@
package io.github.thetrouper.sentinel.server.functions; package io.github.thetrouper.sentinel.server.functions;
import io.github.thetrouper.sentinel.Sentinel;
import io.github.thetrouper.sentinel.server.util.Text;
import org.bukkit.event.player.AsyncPlayerChatEvent;
public class AdvancedBlockers { public class AdvancedBlockers {
public static void handleAntiURL(AsyncPlayerChatEvent e) {
String message = Text.removeFirstColor(e.getMessage());
String nonAllowed = message.replaceAll("[A-Za-z0-9\\[,./?><|\\]§()*&^%$#@!~`{}:;'\"-_]", "").trim();
if (message.matches("https?://(www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)")) {
} }
if (nonAllowed.length() != 0) {
e.getPlayer().sendMessage(Text.prefix(Sentinel.dict.get("unicode-warn")));
e.setCancelled(true);
}
}
}

View File

@@ -1,6 +1,6 @@
{ {
"dictionary" : { "dictionary" : { // Comment!
"if-you-see-this-lang-is-broken" : "Sentinel language is working!", "if-you-see-this-lang-is-broken" : "Sentinel language is working!", // Comment!
"no-permission" : "§cInsufficient Permissions!", "no-permission" : "§cInsufficient Permissions!",
"cooldown" : "This action is on cooldown!", "cooldown" : "This action is on cooldown!",
"false-positive-report-success" : "Successfully reported a false positive!", "false-positive-report-success" : "Successfully reported a false positive!",

View File

@@ -0,0 +1,81 @@
{ // Comment!
"plugin": {
"license": "beta", // Here is a comment!
"prefix": "§d§lSentinel §8» §7", // Here is another one!
"webhook": "https://discord.com/api/webhooks/id/token",
"lang": "en-us.json",
"trustedPlayers": [
"049460f7-21cb-42f5-8059-d42752bf406f"
],
"blockSpecific": true,
"preventNBT": true,
"preventCmdBlockPlace": true,
"preventCmdBlockUse": true,
"preventCmdBlockChange": true,
"preventCmdCartPlace": true,
"preventCmdCartUse": true,
"cmdBlockOpCheck": true,
"dangerous": [
"op",
"deop",
"stop",
"restart",
"execute",
"sudo",
"esudo",
"fill",
"setblock",
"data",
"whitelist"
],
"logDangerous": true,
"logCmdBlocks": true,
"logNBT": true,
"logSpecific": false,
"logged": [
"give",
"item"
],
"deop": true,
"nbtPunish": false,
"cmdBlockPunish": false,
"commandPunish": false,
"specificPunish": false,
"punishCommands": [
"smite %player%",
"ban %player% ]\u003d- Sentinel -\u003d[ You have been banned for attempting a dangerous action. If you believe this to be a mistake, please contact the server owner."
],
"reopCommand": false
},
"chat": {
"antiSwear": {
"antiSwearEnabled": true,
"lowScore": 0,
"mediumLowScore": 1,
"mediumScore": 3,
"mediumHighScore": 5,
"highScore": 7,
"scoreDecay": 3,
"punishScore": 20,
"strictInstaPunish": true,
"swearPunishCommand": "mute %player% 15m Do not attempt to bypass the Profanity Filter",
"strictPunishCommand": "mute %player% 1h Discriminatory speech is not tolerated on this server!",
"logSwears": true
},
"antiSpam": {
"antiSpamEnabled": true,
"defaultGain": 1,
"lowGain": 2,
"mediumGain": 4,
"highGain": 6,
"heatDecay": 1,
"blockHeat": 10,
"punishHeat": 25,
"clearChat": true,
"chatClearCommand": "cc",
"spamPunishCommand": "mute %player% 1m Please refrain from spamming!",
"logSpam": true
},
"antiUnicode": true
}
}