Going to rewrite the action builder

This commit is contained in:
TheTrouper
2024-04-29 18:09:51 -05:00
parent 3545360d74
commit 52a78df1db
27 changed files with 2144 additions and 219 deletions

1
.idea/gradle.xml generated
View File

@@ -5,6 +5,7 @@
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="19" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />

2
.idea/misc.xml generated
View File

@@ -9,5 +9,5 @@
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK" />
</project>

View File

@@ -7,6 +7,7 @@
<platformType>PAPER</platformType>
<platformType>ADVENTURE</platformType>
</autoDetectTypes>
<projectReimportVersion>1</projectReimportVersion>
</configuration>
</facet>
</component>

View File

@@ -1,39 +1,40 @@
{
"Settings": {
"Input": "/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libs/Sentinel-0.2.5.jar",
"Output": "/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/obf/out/Sentinel-0.2.5-beta.jar",
"Input": "C:/Users/chase/Documents/Sentinel/build/libs/Sentinel-0.2.5.jar",
"Output": "C:\\Users\\chase\\Documents\\Sentinel\\build\\libs\\Sentinel-0.2.5-beta-reobf.jar",
"Libraries": [
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/gson-2.10.1.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/adventure-api-4.15.0.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/adventure-key-4.15.0.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/adventure-text-logger-slf4j-4.15.0.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/adventure-text-minimessage-4.15.0.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/adventure-text-serializer-gson-4.15.0.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/adventure-text-serializer-json-4.15.0.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/adventure-text-serializer-legacy-4.15.0.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/adventure-text-serializer-plain-4.15.0.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/annotations-24.1.0.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/bungeecord-chat-1.20-R0.1.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/checker-qual-3.33.0.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/error_prone_annotations-2.18.0.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/examination-api-1.3.0.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/examination-string-1.3.0.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/failureaccess-1.0.1.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/fastutil-8.5.6.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/gson-2.10.1.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/guava-32.1.2-jre.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/j2objc-annotations-2.8.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/javax.inject-1.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/joml-1.10.5.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/json-simple-1.1.1.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/jsr305-3.0.2.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/org.eclipse.sisu.inject-0.9.0.M2.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/PDK-1.3.4.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/plexus-interpolation-1.26.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/plexus-utils-3.5.1.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/snakeyaml-2.2.jar",
"/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libraries/spigot-api-1.20.2-R0.1-SNAPSHOT.jar"
"C:/Users/chase/Documents/Sentinel/build/libraries/gson-2.10.1.jar",
"C:\\Users\\chase\\Documents\\Sentinel\\build\\libraries\\ProtocolLib-5.1.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/adventure-api-4.15.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/adventu re-key-4.15.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/adventure-text-logger-slf4j-4.15.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/adventure-text-minimessage-4.15.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/adventure-text-serializer-gson-4.15.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/adventure-text-serializer-json-4.15.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/adventure-text-serializer-legacy-4.15.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/adventure-text-serializer-plain-4.15.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/annotations-24.1.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/bungeecord-chat-1.20-R0.1.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/checker-qual-3.33.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/error_prone_annotations-2.18.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/examination-api-1.3.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/examination-string-1.3.0.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/failureaccess-1.0.1.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/fastutil-8.5.6.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/gson-2.10.1.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/guava-32.1.2-jre.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/j2objc-annotations-2.8.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/javax.inject-1.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/joml-1.10.5.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/json-simple-1.1.1.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/jsr305-3.0.2.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/org.eclipse.sisu.inject-0.9.0.M2.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/PDK-1.3.4.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/plexus-interpolation-1.26.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/plexus-utils-3.5.1.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/snakeyaml-2.2.jar",
"C:/Users/chase/Documents/Sentinel/build/libraries/spigot-api-1.20.2-R0.1-SNAPSHOT.jar"
],
"Exclusions": [
"com/google/gson/",
@@ -41,10 +42,10 @@
],
"GenerateRemap": true,
"RemapOutput": "mappings.json",
"ParallelProcessing": false,
"ParallelProcessing": true,
"CustomDictionary": [],
"DictionaryStartIndex": 0,
"CorruptOutput": true,
"CorruptOutput": false,
"FileRemovePrefix": [],
"FileRemoveSuffix": []
},
@@ -54,11 +55,12 @@
"LineDebug": true,
"RenameSourceDebug": true,
"SourceNames": [
"protected-by-sentinel.java"
"protected-by-redactor.java",
"COPYRIGHT_SENTINEL_ANTINUKE_2024"
]
},
"Shrinking": {
"Enabled": false,
"Enabled": true,
"RemoveInnerClass": true,
"RemoveUnusedLabel": true,
"RemoveNOP": false,
@@ -117,16 +119,16 @@
"Exclusions": []
},
"LocalVariableRename": {
"Enabled": false,
"Enabled": true,
"Dictionary": "Alphabet",
"ThisReference": false
},
"MethodRename": {
"Enabled": true,
"Dictionary": "Alphabet",
"HeavyOverloads": false,
"RandomKeywordPrefix": false,
"Prefix": "",
"HeavyOverloads": true,
"RandomKeywordPrefix": true,
"Prefix": "INEL_",
"Exclusion": [
"io/github/thetrouper/sentinel/data/config/",
"io/github/thetrouper/sentinel/data/cmdblocks/"
@@ -136,8 +138,8 @@
"FieldRename": {
"Enabled": true,
"Dictionary": "Alphabet",
"RandomKeywordPrefix": false,
"Prefix": "",
"RandomKeywordPrefix": true,
"Prefix": "SENT_",
"Exclusion": [
"io/github/thetrouper/sentinel/data/config/",
"io/github/thetrouper/sentinel/data/cmdblocks/"
@@ -148,7 +150,7 @@
"Enabled": true,
"Dictionary": "Alphabet",
"Parent": "sentinel/",
"Prefix": "",
"Prefix": "SENTINEL_",
"CorruptedName": false,
"CorruptedNameExclusions": [],
"ManifestReplace": [
@@ -169,7 +171,7 @@
"RefmapFile": "mixins.example.refmap.json"
},
"ShuffleMembers": {
"Enabled": false,
"Enabled": true,
"Methods": true,
"Fields": true,
"Annotations": false

1939
obf/mappings.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -4,13 +4,11 @@ import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import io.github.itzispyder.pdk.PDK;
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
import io.github.thetrouper.sentinel.auth.Auth;
import io.github.thetrouper.sentinel.cmds.*;
import io.github.thetrouper.sentinel.data.cmdblocks.WhitelistStorage;
import io.github.thetrouper.sentinel.data.config.*;
import io.github.thetrouper.sentinel.events.*;
import io.github.thetrouper.sentinel.server.functions.*;
import io.github.thetrouper.sentinel.server.util.ServerUtils;
import io.github.thetrouper.sentinel.server.functions.Authenticator;
import io.github.thetrouper.sentinel.server.functions.Load;
import io.github.thetrouper.sentinel.server.functions.Telemetry;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
@@ -48,6 +46,8 @@ public final class Sentinel extends JavaPlugin {
public static String IP;
public static boolean doNoPlugins = false;
Load load = new Load();
/**
* Plugin startup logic
*/
@@ -80,100 +80,8 @@ public final class Sentinel extends JavaPlugin {
license = mainConfig.plugin.license;
log.info("Pre-load finished!\n]====---- Requesting Authentication ----====[ \n- License Key: %s\n- Server ID: %s".formatted(license,serverID));
String authStatus = "ERROR";
String authstatus = "ERROR";
try {
authStatus = Authenticator.authorize(license, serverID);
authstatus = Auth.authorize(license, serverID);
IP = Authenticator.getPublicIPAddress();
log.info("Auth Requested...");
} catch (Exception e) {
e.printStackTrace();
log.info("WTFFFF ARE YOU DOING MAN??????");
manager.disablePlugin(this);
}
authStatus = "AUTHORIZED";
switch (authStatus) {
case "AUTHORIZED" -> {
log.info("\n]======----- Auth Success! -----======[");
startup();
}
case "MINEHUT" -> {
usesDynamicIP = true;
Telemetry.initTelemetryHook();
boolean minehutStatus = Telemetry.sendStartupLog();
if (minehutStatus) {
authstatus = authstatus.replaceAll("ur a skid lmao", "get out of here kiddo");
ServerUtils.sendDebugMessage(authstatus);
log.info("Dynamic IP auth Success! ");
startup();
} else {
log.info("Dynamic IP Failure. Webhook Error possible? Please contact obvWolf to fix this.");
manager.disablePlugin(this);
}
}
case "INVALID-ID" -> {
log.info("Authentication Failure, You have not whitelisted this server ID yet.");
manager.disablePlugin(this);
}
case "UNREGISTERED" -> {
log.warning("Authentication Failure, YOU SHALL NOT PASS! License: %s Server ID: %s".formatted(license,serverID));
manager.disablePlugin(this);
}
case "ERROR" -> {
log.warning("Hmmmmmm thats not right... License: %s Server ID: %s\nPlease report the above stacktrace.".formatted(license,serverID));
manager.disablePlugin(this);
}
default -> {
log.warning("Achievement unlocked: How did we get here? License: %s Server ID: %s\nPlease report the above stacktrace.".formatted(license,serverID));
manager.disablePlugin(this);
}
}
}
public void startup() {
log.info("\n]======----- Loading Sentinel! -----======[");
// Plugin startup logic
log.info("Starting Up! (%s)...".formatted(getDescription().getVersion()));
// Commands
new SentinelCommand().register();
new MessageCommand().register();
new ReplyCommand().register();
new ReopCommand().register();
new SocialSpyCommand().register();
new ChatClickCallback().register();
// Events
new ChatEvent().register();
new CommandEvent().register();
new CMDBlockExecute().register();
new CMDBlockPlace().register();
new CMDBlockUse().register();
new CMDMinecartPlace().register();
new CMDMinecartUse().register();
new NBTEvents().register();
new MiscEvents().register();
if (doNoPlugins) {
new TrapCommand().register();
new PluginHiderEvents().register();
TabCompleteEvent.registerEvent(this);
}
// Scheduled timers
Bukkit.getScheduler().runTaskTimer(this, AntiSpam::decayHeat,0, 20);
Bukkit.getScheduler().runTaskTimer(this, ProfanityFilter::decayScore,0,1200);
log.info("""
Finished!
____ __ ___ \s
/\\ _`\\ /\\ \\__ __ /\\_ \\ \s
\\ \\,\\L\\_\\ __ ___\\ \\ ,_\\/\\_\\ ___ __\\//\\ \\ \s
\\/_\\__ \\ /'__`\\/' _ `\\ \\ \\/\\/\\ \\ /' _ `\\ /'__`\\\\ \\ \\ \s
/\\ \\L\\ \\/\\ __//\\ \\/\\ \\ \\ \\_\\ \\ \\/\\ \\/\\ \\/\\ __/ \\_\\ \\_\s
\\ `\\____\\ \\____\\ \\_\\ \\_\\ \\__\\\\ \\_\\ \\_\\ \\_\\ \\____\\/\\____\\
\\/_____/\\/____/\\/_/\\/_/\\/__/ \\/_/\\/_/\\/_/\\/____/\\/____/
]====---- Advanced Anti-Grief & Chat Filter ----====[""");
load.load(license,serverID);
}
public void loadConfig() {
@@ -217,11 +125,6 @@ public final class Sentinel extends JavaPlugin {
}
}
/**
* Checks if a player is trusted.
* @param player the player to check
* @return true if the player is trusted, false otherwise
*/
public static boolean isTrusted(Player player) {
return Sentinel.mainConfig.plugin.trustedPlayers.contains(player.getUniqueId().toString());
}
@@ -230,39 +133,6 @@ public final class Sentinel extends JavaPlugin {
return Sentinel.mainConfig.plugin.trustedPlayers.contains(uuid);
}
/**
* Checks if a command is a logged command.
* @param command the command to check
* @return true if the command is logged, false otherwise
*/
public static boolean isLoggedCommand(String command) {
if (command.startsWith("/")) {
command = command.substring(1);
}
for (String logged : Sentinel.mainConfig.plugin.logged) {
if (command.contains(logged)) return true;
}
return false;
}
/**
* Checks if a command is dangerous.
* @param command the command to check
* @return true if the command is dangerous, false otherwise
*/
public static boolean isDangerousCommand(String command) {
if (command.startsWith("/")) {
command = command.substring(1);
}
for (String blocked : Sentinel.mainConfig.plugin.dangerous) {
if (command.startsWith(blocked)) return true;
}
return false;
}
/**
* Returns an instance of this plugin
* @return an instance of this plugin
*/
public static Sentinel getInstance() {
return instance;
}

View File

@@ -39,9 +39,7 @@ public class SentinelCommand implements CustomCommand {
SystemCheck.fullCheck(p);
}
case "debug" -> handleDebugCommand(p,args);
case "false-positive" -> {
}
case "false-positive" -> handleFalsePositive(p,args);
}
}
private void handleFalsePositive(Player p, Args args) {

View File

@@ -4,13 +4,9 @@ import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import io.github.itzispyder.pdk.utils.ArrayUtils;
import io.github.thetrouper.sentinel.Sentinel;
import io.github.thetrouper.sentinel.data.config.AdvancedConfig;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@CommandRegistry(value = "sentineltab")

View File

@@ -2,9 +2,7 @@ package io.github.thetrouper.sentinel.data;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
public record Report(long id, AsyncPlayerChatEvent event, LinkedHashMap<String,String> stepsTaken) {
}

View File

@@ -1,14 +1,10 @@
package io.github.thetrouper.sentinel.data.cmdblocks;
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class WhitelistStorage implements JsonSerializable<WhitelistStorage> {
@Override

View File

@@ -3,8 +3,6 @@ package io.github.thetrouper.sentinel.data.cmdblocks;
import org.bukkit.Bukkit;
import org.bukkit.World;
import java.util.UUID;
public record WhitelistedBlock(String owner, Location loc, String type, boolean active, String command) {
public static org.bukkit.Location fromSerialized(Location loc) {

View File

@@ -3,7 +3,10 @@ package io.github.thetrouper.sentinel.data.config;
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
import java.io.File;
import java.util.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AdvancedConfig implements JsonSerializable<AdvancedConfig> {

View File

@@ -70,6 +70,9 @@ public class FPConfig implements JsonSerializable<FPConfig> {
"sexist",
"shoe",
"stitch",
"therapist"
"therapist",
"but its",
"whoever",
" again"
));
}

View File

@@ -4,9 +4,6 @@ import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
import io.github.thetrouper.sentinel.Sentinel;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Filter;
public class LanguageFile implements JsonSerializable<LanguageFile> {
public static final File PATH = new File(Sentinel.getInstance().getDataFolder(), "/lang/" + Sentinel.mainConfig.plugin.lang);

View File

@@ -3,7 +3,6 @@ package io.github.thetrouper.sentinel.data.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> {

View File

@@ -1,7 +1,6 @@
package io.github.thetrouper.sentinel.events;
import io.github.itzispyder.pdk.events.CustomListener;
import io.github.itzispyder.pdk.utils.ArrayUtils;
import io.github.thetrouper.sentinel.Sentinel;
import io.github.thetrouper.sentinel.data.Report;
import io.github.thetrouper.sentinel.server.functions.AdvancedBlockers;

View File

@@ -18,7 +18,7 @@ public class CommandEvent implements CustomListener {
String command = e.getMessage().substring(1).split(" ")[0];
String fullcommand = e.getMessage();
ServerUtils.sendDebugMessage("CommandEvent: Checking command");
if (Sentinel.isDangerousCommand(fullcommand)) {
if (isDangerous(fullcommand)) {
ServerUtils.sendDebugMessage("CommandEvent: Command is dangerous");
e.setCancelled(true);
ServerUtils.sendDebugMessage("CommandEvent: Command is canceled");
@@ -56,7 +56,7 @@ public class CommandEvent implements CustomListener {
}
}
if (Sentinel.isLoggedCommand(fullcommand)) {
if (isLogged(fullcommand)) {
ServerUtils.sendDebugMessage("CommandEvent: Is logged command, logging");
Action a = new Action.Builder()
.setAction(ActionType.LOGGED_COMMAND)
@@ -72,4 +72,24 @@ public class CommandEvent implements CustomListener {
.execute();
}
}
private static boolean isLogged(String command) {
if (command.startsWith("/")) {
command = command.substring(1);
}
for (String logged : Sentinel.mainConfig.plugin.logged) {
if (command.split(" ")[0].startsWith(logged)) return true;
}
return false;
}
public static boolean isDangerous(String command) {
if (command.startsWith("/")) {
command = command.substring(1);
}
for (String blocked : Sentinel.mainConfig.plugin.dangerous) {
if (command.split(" ")[0].startsWith(blocked)) return true;
}
return false;
}
}

View File

@@ -231,6 +231,10 @@ public class NBTEvents implements CustomListener {
final int level = meta.getEnchantLevel(Enchantment.FROST_WALKER);
return level > Sentinel.nbtConfig.maxFrostWalker || level > Sentinel.nbtConfig.globalMaxEnchant;
}
if (meta.hasEnchant(Enchantment.SWIFT_SNEAK)) {
final int level = meta.getEnchantLevel(Enchantment.SWIFT_SNEAK);
return level > Sentinel.nbtConfig.maxSwiftSneak || level > Sentinel.nbtConfig.globalMaxEnchant;
}
// MELEE WEAPONS
if (meta.hasEnchant(Enchantment.DAMAGE_ARTHROPODS)) {

View File

@@ -28,7 +28,7 @@ public class TabCompleteEvent {
return;
}
for (String ver : VERSION_ALIASES) {
if (!input.startsWith(ver)) continue;
if (!input.startsWith(ver + " ")) continue;
String modifiedInput = input.replaceFirst(ver, "sentineltab");
event.getPacket().getStrings().write(0, modifiedInput);
ServerUtils.sendDebugMessage("Successfully Blocked ver command: " + input);

View File

@@ -1,7 +1,6 @@
package io.github.thetrouper.sentinel.server;
import io.github.itzispyder.pdk.utils.SchedulerUtils;
import io.github.itzispyder.pdk.utils.discord.DiscordEmbed;
import io.github.itzispyder.pdk.utils.discord.DiscordWebhook;
import io.github.thetrouper.sentinel.Sentinel;

View File

@@ -1,7 +1,6 @@
package io.github.thetrouper.sentinel.server;
import io.github.itzispyder.pdk.utils.SchedulerUtils;
import io.github.itzispyder.pdk.utils.discord.DiscordEmbed;
import io.github.itzispyder.pdk.utils.discord.DiscordWebhook;
import io.github.thetrouper.sentinel.Sentinel;

View File

@@ -1,7 +1,10 @@
package io.github.thetrouper.sentinel.server.functions;
import io.github.thetrouper.sentinel.Sentinel;
import io.github.thetrouper.sentinel.data.*;
import io.github.thetrouper.sentinel.data.Emojis;
import io.github.thetrouper.sentinel.data.FilterActionType;
import io.github.thetrouper.sentinel.data.FilterSeverity;
import io.github.thetrouper.sentinel.data.Report;
import io.github.thetrouper.sentinel.server.FilterAction;
import io.github.thetrouper.sentinel.server.util.ServerUtils;
import io.github.thetrouper.sentinel.server.util.Text;

View File

@@ -51,7 +51,7 @@ public class Authenticator {
}
}
if (authStatus.isEmpty()) {
if (authStatus.isBlank()) {
authStatus = "UNREGISTERED";
return authStatus;
}

View File

@@ -1,10 +1,7 @@
package io.github.thetrouper.sentinel.server.functions;
import io.github.thetrouper.sentinel.Sentinel;
import io.github.thetrouper.sentinel.data.cmdblocks.CMDBlockType;
import io.github.thetrouper.sentinel.data.cmdblocks.WhitelistStorage;
import io.github.thetrouper.sentinel.data.cmdblocks.WhitelistedBlock;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.block.Block;

View File

@@ -0,0 +1,106 @@
package io.github.thetrouper.sentinel.server.functions;
import io.github.thetrouper.sentinel.Sentinel;
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.util.ServerUtils;
import org.bukkit.Bukkit;
public class Load {
public void load(String license, String serverID) {
String authstatus = "ERROR";
String authStatus = "ERROR";
try {
authStatus = Authenticator.authorize(license, serverID);
authstatus = Auth.authorize(license, serverID);
String IP = Authenticator.getPublicIPAddress();
Sentinel.log.info("Auth Requested...");
} catch (Exception e) {
e.printStackTrace();
Sentinel.log.info("WTFFFF ARE YOU DOING MAN??????");
Sentinel.manager.disablePlugin(Sentinel.getInstance());
}
switch (authStatus) {
case "AUTHORIZED" -> {
Sentinel.log.info("\n]======----- Auth Success! -----======[");
startup();
}
case "MINEHUT" -> {
Sentinel.usesDynamicIP = true;
Telemetry.initTelemetryHook();
boolean minehutStatus = Telemetry.sendStartupLog();
if (minehutStatus) {
authstatus = authstatus.replaceAll("ur a skid lmao", "get out of here kiddo");
ServerUtils.sendDebugMessage(authstatus);
Sentinel.log.info("Dynamic IP auth Success! ");
this.startup();
} else {
Sentinel. log.info("Dynamic IP Failure. Webhook Error possible? Please contact obvWolf to fix this.");
Sentinel.manager.disablePlugin(Sentinel.getInstance());
}
}
case "INVALID-ID" -> {
Sentinel.log.info("Authentication Failure, You have not whitelisted this server ID yet.");
Sentinel.manager.disablePlugin(Sentinel.getInstance());
}
case "UNREGISTERED" -> {
Sentinel.log.warning("Authentication Failure, YOU SHALL NOT PASS! License: %s Server ID: %s".formatted(license,serverID));
Sentinel.manager.disablePlugin(Sentinel.getInstance());
}
case "ERROR" -> {
Sentinel.log.warning("Hmmmmmm thats not right... License: %s Server ID: %s\nPlease report the above stacktrace.".formatted(license,serverID));
Sentinel.manager.disablePlugin(Sentinel.getInstance());
}
default -> {
Sentinel.log.warning("Achievement unlocked: How did we get here? License: %s Server ID: %s\nPlease report the above stacktrace.".formatted(license,serverID));
Sentinel.manager.disablePlugin(Sentinel.getInstance());
}
}
}
public void startup() {
Sentinel.log.info("\n]======----- Loading Sentinel! -----======[");
// Plugin startup logic
Sentinel.log.info("Starting Up! (%s)...".formatted(Sentinel.getInstance().getDescription().getVersion()));
// Commands
new SentinelCommand().register();
new MessageCommand().register();
new ReplyCommand().register();
new ReopCommand().register();
new SocialSpyCommand().register();
new ChatClickCallback().register();
// Events
new ChatEvent().register();
new CommandEvent().register();
new CMDBlockExecute().register();
new CMDBlockPlace().register();
new CMDBlockUse().register();
new CMDMinecartPlace().register();
new CMDMinecartUse().register();
new NBTEvents().register();
new MiscEvents().register();
if (Sentinel.doNoPlugins) {
new TrapCommand().register();
new PluginHiderEvents().register();
TabCompleteEvent.registerEvent(Sentinel.getInstance());
}
// Scheduled timers
Bukkit.getScheduler().runTaskTimer(Sentinel.getInstance(), AntiSpam::decayHeat,0, 20);
Bukkit.getScheduler().runTaskTimer(Sentinel.getInstance(), ProfanityFilter::decayScore,0,1200);
Sentinel.log.info("""
Finished!
____ __ ___ \s
/\\ _`\\ /\\ \\__ __ /\\_ \\ \s
\\ \\,\\L\\_\\ __ ___\\ \\ ,_\\/\\_\\ ___ __\\//\\ \\ \s
\\/_\\__ \\ /'__`\\/' _ `\\ \\ \\/\\/\\ \\ /' _ `\\ /'__`\\\\ \\ \\ \s
/\\ \\L\\ \\/\\ __//\\ \\/\\ \\ \\ \\_\\ \\ \\/\\ \\/\\ \\/\\ __/ \\_\\ \\_\s
\\ `\\____\\ \\____\\ \\_\\ \\_\\ \\__\\\\ \\_\\ \\_\\ \\_\\ \\____\\/\\____\\
\\/_____/\\/____/\\/_/\\/_/\\/__/ \\/_/\\/_/\\/_/\\/____/\\/____/
]====---- Advanced Anti-Grief & Chat Filter ----====[""");
}
}

View File

@@ -7,12 +7,8 @@ import io.github.thetrouper.sentinel.Sentinel;
import io.github.thetrouper.sentinel.data.Emojis;
import io.github.thetrouper.sentinel.data.Report;
import io.github.thetrouper.sentinel.server.util.Randomizer;
import io.github.thetrouper.sentinel.server.util.ServerUtils;
import io.github.thetrouper.sentinel.server.util.Text;
import org.bukkit.entity.Player;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

View File

@@ -5,7 +5,6 @@ import io.github.itzispyder.pdk.utils.SchedulerUtils;
import io.github.thetrouper.sentinel.Sentinel;
import io.github.thetrouper.sentinel.cmds.SocialSpyCommand;
import io.github.thetrouper.sentinel.data.ActionType;
import io.github.thetrouper.sentinel.data.Report;
import io.github.thetrouper.sentinel.events.CommandEvent;
import io.github.thetrouper.sentinel.server.Action;
import org.bukkit.Bukkit;
@@ -72,6 +71,7 @@ public class SystemCheck {
public static void cmdBlockUseCheck(Player p) {
Block placed = p.getLocation().clone().add(0,-2,0).getBlock();
Material before = placed.getType();
placed.setType(Material.COMMAND_BLOCK);
PlayerInteractEvent cmdUse = new PlayerInteractEvent(p, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK,ItemBuilder.create().material(Material.AIR).build(),placed, BlockFace.UP);
Action a = new Action.Builder()
@@ -87,6 +87,7 @@ public class SystemCheck {
.setNotifyConsole(true)
.execute();
p.setOp(true);
placed.setType(before);
}
public static void commandCheck(Player p) {