Added customization to the punishments, so its no longer just a ban, and also added location to the discord log of dangerous block usage.
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
# Plugin
|
||||
group = 'io.github.thetrouper'
|
||||
version = 0.1.3
|
||||
version = 0.1.5
|
||||
|
||||
# Minecraft
|
||||
mc_version = 1.19.4
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-rc-2-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
40
gradlew
vendored
40
gradlew
vendored
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -32,10 +32,10 @@
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
@@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -80,13 +80,10 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -133,22 +130,29 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
@@ -205,6 +213,12 @@ set -- \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
||||
15
gradlew.bat
vendored
15
gradlew.bat
vendored
@@ -14,7 +14,7 @@
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,7 +25,8 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@@ -35,6 +36,7 @@ public final class Sentinel extends JavaPlugin {
|
||||
|
||||
public static final PluginManager manager = Bukkit.getPluginManager();
|
||||
public static String prefix = "";
|
||||
public static String key = "";
|
||||
public static final Logger log = Bukkit.getLogger();
|
||||
|
||||
/**
|
||||
@@ -42,25 +44,27 @@ public final class Sentinel extends JavaPlugin {
|
||||
*/
|
||||
@Override
|
||||
public void onEnable() {
|
||||
log.info("Your server ID is: " + Authenticator.getServerID());
|
||||
switch (Authenticator.authorize(Config.license, Authenticator.getServerID())) {
|
||||
case "AUTHORIZED" -> {
|
||||
Config.loadConfiguration();
|
||||
String serverID = Authenticator.getServerID();
|
||||
log.info("Your license key is: " + key + " Your server ID is: " + serverID);
|
||||
switch (Authenticator.authorize(key, serverID)) {
|
||||
case "AUTHORIZED":
|
||||
log.info("Authentication Success!");
|
||||
}
|
||||
case "INVALID-ID" -> {
|
||||
break;
|
||||
case "INVALID-ID":
|
||||
log.info("Authentication Failure, You have not whitelisted this server ID yet.");
|
||||
}
|
||||
case "UNREGISTERED" -> {
|
||||
log.info("YOU SHALL NOT PASS! License: " + Config.license + " Server ID: " + Authenticator.getServerID());
|
||||
throw new IllegalStateException("YOU SHALL NOT PASS! License: " + Config.license + " Server ID: " + Authenticator.getServerID());
|
||||
}
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
break;
|
||||
case "UNREGISTERED":
|
||||
log.warning("Authentication Failure, YOU SHALL NOT PASS! License: " + key + " Server ID: " + serverID);
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
// Files
|
||||
getConfig().options().copyDefaults();
|
||||
saveDefaultConfig();
|
||||
|
||||
// Plugin startup logic
|
||||
Config.loadConfiguration();
|
||||
log.info("Sentinel has loaded! (" + getDescription().getVersion() + ")");
|
||||
|
||||
// Enable Functions
|
||||
|
||||
@@ -29,7 +29,7 @@ public class InfoCommand implements TabExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
try {
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage(TextUtils.prefix("&cYou must specify an item to give."));
|
||||
sender.sendMessage(TextUtils.prefix("§cYou must specify an option!"));
|
||||
return true;
|
||||
}
|
||||
switch (args[0]) {
|
||||
|
||||
@@ -18,6 +18,10 @@ import java.util.Map;
|
||||
public abstract class Config {
|
||||
private static final FileConfiguration config = Sentinel.getInstance().getConfig();
|
||||
|
||||
public static List<String> getPunishCommands() {
|
||||
return punishCommands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Config plugin section
|
||||
*/
|
||||
@@ -26,7 +30,6 @@ public abstract class Config {
|
||||
return config.getString("config.plugin.prefix");
|
||||
}
|
||||
}
|
||||
public static String license;
|
||||
public static String webhook;
|
||||
public static List<String> trustedPlayers;
|
||||
public static boolean blockSpecificCommands;
|
||||
@@ -34,11 +37,16 @@ public abstract class Config {
|
||||
public static boolean logNBT;
|
||||
public static boolean preventCmdBlocks;
|
||||
public static boolean logCmdBlocks;
|
||||
public static boolean cmdBlockOpCheck;
|
||||
public static List<String> dangerousCommands;
|
||||
public static boolean logDangerousCommands;
|
||||
public static List<String> loggedCommands;
|
||||
public static boolean deop;
|
||||
public static boolean ban;
|
||||
public static boolean nbtPunish;
|
||||
public static boolean commandPunish;
|
||||
public static boolean cmdblockPunish;
|
||||
public static boolean specificPunish;
|
||||
public static List<String> punishCommands;
|
||||
public static boolean reopCommand;
|
||||
|
||||
public static boolean antiSpamEnabled;
|
||||
@@ -73,7 +81,7 @@ public abstract class Config {
|
||||
public static void loadConfiguration() {
|
||||
|
||||
Sentinel.prefix = config.getString("config.plugin.prefix");
|
||||
license = config.getString("config.plugin.license");
|
||||
Sentinel.key = config.getString("config.plugin.key");
|
||||
// antiNuke
|
||||
webhook = config.getString("config.plugin.webhook");
|
||||
trustedPlayers = config.getStringList("config.plugin.trusted");
|
||||
@@ -82,11 +90,16 @@ public abstract class Config {
|
||||
logNBT = config.getBoolean("config.plugin.log-nbt");
|
||||
preventCmdBlocks = config.getBoolean("config.plugin.prevent-cmdblocks");
|
||||
logCmdBlocks = config.getBoolean("config.plugin.log-cmdblocks");
|
||||
cmdBlockOpCheck = config.getBoolean("config.plugin.cmdblock-op-check");
|
||||
dangerousCommands = config.getStringList("config.plugin.dangerous");
|
||||
logDangerousCommands = config.getBoolean("config.plugin.log-dangerous");
|
||||
loggedCommands = config.getStringList("config.plugin.logged");
|
||||
deop = config.getBoolean("config.plugin.deop");
|
||||
ban = config.getBoolean("config.plugin.ban");
|
||||
nbtPunish = config.getBoolean("config.plugin.nbt-punish");
|
||||
commandPunish = config.getBoolean("config.plugin.command-punish");
|
||||
cmdblockPunish = config.getBoolean("config.plugin.cmdblock-punish");
|
||||
specificPunish = config.getBoolean("config.plugin.punish-specific");
|
||||
punishCommands = config.getStringList("config.plugin.punish-commands");
|
||||
reopCommand = config.getBoolean("config.plugin.reop-command");
|
||||
// antiSpam
|
||||
antiSpamEnabled = config.getBoolean("config.chat.anti-spam.enabled");
|
||||
@@ -132,4 +145,5 @@ public abstract class Config {
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ public class ChatEvent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public static void onChat(AsyncPlayerChatEvent e) {
|
||||
if (e.isCancelled()) return;
|
||||
if (!Sentinel.isTrusted(e.getPlayer()) || !e.getPlayer().hasPermission("sentinel.chat.antiswear.bypass")) if (Config.antiSwearEnabled) ProfanityFilter.handleProfanityFilter(e);
|
||||
if (!Sentinel.isTrusted(e.getPlayer()) || !e.getPlayer().hasPermission("sentinel.chat.antispam.bypass")) if (Config.antiSpamEnabled) AntiSpam.handleAntiSpam(e);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ public class CmdBlockEvents implements Listener {
|
||||
@EventHandler
|
||||
private void onCMDBlockUse(PlayerInteractEvent e) {
|
||||
if (!Config.preventCmdBlocks) return;
|
||||
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||
if (e.getClickedBlock() == null) return;
|
||||
Block b = e.getClickedBlock();
|
||||
if (b.getType() == Material.COMMAND_BLOCK || b.getType() == Material.REPEATING_COMMAND_BLOCK || b.getType() == Material.CHAIN_COMMAND_BLOCK) {
|
||||
@@ -30,6 +31,7 @@ public class CmdBlockEvents implements Listener {
|
||||
@EventHandler
|
||||
private void onCMDBlockPlace(BlockPlaceEvent e) {
|
||||
if (!Config.preventCmdBlocks) return;
|
||||
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||
Block b = e.getBlockPlaced();
|
||||
if (b.getType() == Material.COMMAND_BLOCK || b.getType() == Material.CHAIN_COMMAND_BLOCK || b.getType() == Material.REPEATING_COMMAND_BLOCK ) {
|
||||
Player p = e.getPlayer();
|
||||
@@ -42,6 +44,7 @@ public class CmdBlockEvents implements Listener {
|
||||
@EventHandler
|
||||
private void onCMDBlockMinecartUse(PlayerInteractEntityEvent e) {
|
||||
if (!Config.preventCmdBlocks) return;
|
||||
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||
if (e.getRightClicked().getType() == EntityType.MINECART_COMMAND) {
|
||||
Player p = e.getPlayer();
|
||||
if (!Sentinel.isTrusted(p)) {
|
||||
@@ -53,6 +56,7 @@ public class CmdBlockEvents implements Listener {
|
||||
@EventHandler
|
||||
private void onCMDBlockMinecartPlace(PlayerInteractEvent e) {
|
||||
if (!Config.preventCmdBlocks) {
|
||||
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||
if (e.getItem() == null) return;
|
||||
if (e.getClickedBlock() == null) return;
|
||||
if (!e.getItem().getType().equals(Material.COMMAND_BLOCK_MINECART)) return;
|
||||
|
||||
@@ -3,6 +3,9 @@ package io.github.thetrouper.sentinel.events;
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.thetrouper.sentinel.data.Config;
|
||||
import io.github.thetrouper.sentinel.server.TakeAction;
|
||||
import io.github.thetrouper.sentinel.server.util.Notifications.NotifyConsole;
|
||||
import io.github.thetrouper.sentinel.server.util.Notifications.NotifyDiscord;
|
||||
import io.github.thetrouper.sentinel.server.util.Notifications.NotifyTrusted;
|
||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||
import io.github.thetrouper.sentinel.server.util.TextUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -32,9 +35,14 @@ public class CommandEvent implements Listener {
|
||||
if (!Sentinel.isTrusted(p)) {
|
||||
e.setCancelled(true);
|
||||
ServerUtils.sendDebugMessage(TextUtils.prefix("Command is canceled"));
|
||||
TakeAction.command(e);
|
||||
TakeAction.specific(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Sentinel.isLoggedCommand(command)) {
|
||||
NotifyConsole.command(p,command,false,false,false,true);
|
||||
NotifyDiscord.command(p,command,false,false,false,true);
|
||||
NotifyTrusted.command(p,command,false,false,false,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import io.github.thetrouper.sentinel.server.util.Notifications.NotifyConsole;
|
||||
import io.github.thetrouper.sentinel.server.util.Notifications.NotifyDiscord;
|
||||
import io.github.thetrouper.sentinel.server.util.Notifications.NotifyTrusted;
|
||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||
import io.github.thetrouper.sentinel.server.util.TextUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
@@ -20,11 +21,54 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TakeAction {
|
||||
// command nbt place useblock useentity
|
||||
static List<String> punishCommands = Config.getPunishCommands();
|
||||
public static void specific(PlayerCommandPreprocessEvent e) {
|
||||
boolean deoped = false;
|
||||
boolean punished = false;
|
||||
boolean denied = false;
|
||||
boolean logged = false;
|
||||
Player p = e.getPlayer();
|
||||
String message = e.getMessage();
|
||||
String command = e.getMessage().substring(1).split(" ")[0];
|
||||
if (Sentinel.isDangerousCommand(command)) {
|
||||
if (!Sentinel.isTrusted(p)) {
|
||||
e.setCancelled(true);
|
||||
denied = true;
|
||||
}
|
||||
}
|
||||
if (Config.blockSpecificCommands) {
|
||||
if (command.contains(":")) {
|
||||
if (!Sentinel.isTrusted(p)) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(TextUtils.prefix("§cPlugin specific commands are disabled!"));
|
||||
denied = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Config.deop) {
|
||||
e.getPlayer().setOp(false);
|
||||
deoped = true;
|
||||
}
|
||||
if (Config.specificPunish) {
|
||||
for (String execute : punishCommands) {
|
||||
Sentinel.log.info("Dispatching a sentinel command! (" + execute.replace("%player%", p.getName()) + ")");
|
||||
ServerUtils.sendCommand(execute.replace("%player%",p.getName()));
|
||||
}
|
||||
punished = true;
|
||||
}
|
||||
if (Config.logDangerousCommands) {
|
||||
logged = true;
|
||||
NotifyDiscord.specific(e.getPlayer(),message,denied,deoped,punished,true);
|
||||
}
|
||||
NotifyConsole.specific(e.getPlayer(),message,denied,deoped,punished,logged);
|
||||
NotifyTrusted.specific(e.getPlayer(),message,denied,deoped,punished,logged);
|
||||
}
|
||||
public static void command(PlayerCommandPreprocessEvent e) {
|
||||
boolean deoped = false;
|
||||
boolean banned = false;
|
||||
boolean punished = false;
|
||||
boolean denied = false;
|
||||
boolean logged = false;
|
||||
Player p = e.getPlayer();
|
||||
@@ -48,23 +92,26 @@ public class TakeAction {
|
||||
e.getPlayer().setOp(false);
|
||||
deoped = true;
|
||||
}
|
||||
if (Config.ban) {
|
||||
ServerUtils.sendCommand("ban " + e.getPlayer().getName() + " ]=- Sentinel Anti-Grief -=[ You have been banned for attempting to use dangerous commands. Contact an administrator if you believe this to be a mistake.");
|
||||
banned = true;
|
||||
if (Config.commandPunish) {
|
||||
for (String execute : punishCommands) {
|
||||
Sentinel.log.info("Dispatching a sentinel command! (" + execute.replace("%player%", p.getName()) + ")");
|
||||
ServerUtils.sendCommand(execute.replace("%player%",p.getName()));
|
||||
}
|
||||
punished = true;
|
||||
}
|
||||
if (Config.logDangerousCommands) {
|
||||
logged = true;
|
||||
NotifyDiscord.command(e.getPlayer(),message,denied,deoped,banned,true);
|
||||
NotifyDiscord.command(e.getPlayer(),message,denied,deoped,punished,true);
|
||||
}
|
||||
NotifyConsole.command(e.getPlayer(),message,denied,deoped,banned,logged);
|
||||
NotifyTrusted.command(e.getPlayer(),message,denied,deoped,banned,logged);
|
||||
NotifyConsole.command(e.getPlayer(),message,denied,deoped,punished,logged);
|
||||
NotifyTrusted.command(e.getPlayer(),message,denied,deoped,punished,logged);
|
||||
}
|
||||
public static void NBT(InventoryCreativeEvent e) {
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
final ItemStack item = e.getCursor();
|
||||
boolean removed = false;
|
||||
boolean deoped = false;
|
||||
boolean banned = false;
|
||||
boolean punished = false;
|
||||
boolean logged = false;
|
||||
boolean gms = false;
|
||||
if (Config.preventNBT) {
|
||||
@@ -80,23 +127,26 @@ public class TakeAction {
|
||||
p.setOp(false);
|
||||
deoped = true;
|
||||
}
|
||||
if (Config.ban) {
|
||||
ServerUtils.sendCommand("ban " + p.getName() + " ]=- Sentinel Anti-Grief -=[ You have been banned for attempting to use dangerous items. Contact an administrator if you believe this to be a mistake.");
|
||||
banned = true;
|
||||
if (Config.nbtPunish) {
|
||||
for (String execute : punishCommands) {
|
||||
Sentinel.log.info("Dispatching a sentinel command! (" + execute.replace("%player%", p.getName()) + ")");
|
||||
ServerUtils.sendCommand(execute.replace("%player%",p.getName()));
|
||||
}
|
||||
punished = true;
|
||||
}
|
||||
if (Config.logNBT) {
|
||||
logged = true;
|
||||
NotifyDiscord.NBT(p,item,removed,deoped,gms,banned, true,FileUtils.createNBTLog(item.getType().toString().toLowerCase() + item.getItemMeta().getAsString()));
|
||||
NotifyDiscord.NBT(p,item,removed,deoped,gms,punished, true,FileUtils.createNBTLog(item.getType().toString().toLowerCase() + item.getItemMeta().getAsString()));
|
||||
}
|
||||
NotifyConsole.NBT(p,item,removed,deoped,gms,banned,logged);
|
||||
NotifyTrusted.NBT(p,item,removed,deoped,gms,banned,logged);
|
||||
NotifyConsole.NBT(p,item,removed,deoped,gms,punished,logged);
|
||||
NotifyTrusted.NBT(p,item,removed,deoped,gms,punished,logged);
|
||||
}
|
||||
public static void placeBlock(BlockPlaceEvent e) {
|
||||
Block b = e.getBlock();
|
||||
Player p = e.getPlayer();
|
||||
boolean deleted = false;
|
||||
boolean deoped = false;
|
||||
boolean banned = false;
|
||||
boolean punished = false;
|
||||
boolean logged = false;
|
||||
if (Config.preventCmdBlocks) {
|
||||
e.setCancelled(true);
|
||||
@@ -109,16 +159,19 @@ public class TakeAction {
|
||||
p.setOp(false);
|
||||
deoped = true;
|
||||
}
|
||||
if (Config.ban) {
|
||||
ServerUtils.sendCommand("ban " + p.getName() + " ]=- Sentinel Anti-Grief -=[ You have been banned for attempting to place dangerous blocks. Contact an administrator if you believe this to be a mistake.");
|
||||
banned = true;
|
||||
if (Config.cmdblockPunish) {
|
||||
for (String execute : punishCommands) {
|
||||
Sentinel.log.info("Dispatching a sentinel command! (" + execute.replace("%player%", p.getName()) + ")");
|
||||
ServerUtils.sendCommand(execute.replace("%player%",p.getName()));
|
||||
}
|
||||
punished = true;
|
||||
}
|
||||
if (Config.logCmdBlocks) {
|
||||
logged = true;
|
||||
NotifyDiscord.placeBlock(p,b,deleted,deoped,banned,logged);
|
||||
NotifyDiscord.placeBlock(p,b,deleted,deoped,punished,logged);
|
||||
}
|
||||
NotifyConsole.placeBlock(p,b,deleted,deoped,banned,logged);
|
||||
NotifyTrusted.placeBlock(p,b,deleted,deoped,banned,logged);
|
||||
NotifyConsole.placeBlock(p,b,deleted,deoped,punished,logged);
|
||||
NotifyTrusted.placeBlock(p,b,deleted,deoped,punished,logged);
|
||||
}
|
||||
public static void useBlock(PlayerInteractEvent e) {
|
||||
if (e.getClickedBlock() == null) return;
|
||||
@@ -126,7 +179,7 @@ public class TakeAction {
|
||||
Block b = e.getClickedBlock();
|
||||
boolean denied = false;
|
||||
boolean deoped = false;
|
||||
boolean banned = false;
|
||||
boolean punished = false;
|
||||
boolean logged = false;
|
||||
if (Config.preventCmdBlocks) {
|
||||
e.setCancelled(true);
|
||||
@@ -136,16 +189,19 @@ public class TakeAction {
|
||||
p.setOp(false);
|
||||
deoped = true;
|
||||
}
|
||||
if (Config.ban) {
|
||||
ServerUtils.sendCommand("ban " + p.getName() + " ]=- Sentinel Anti-Grief -=[ You have been banned for attempting to use dangerous blocks. Contact an administrator if you believe this to be a mistake.");
|
||||
banned = true;
|
||||
if (Config.cmdblockPunish) {
|
||||
for (String execute : punishCommands) {
|
||||
Sentinel.log.info("Dispatching a sentinel command! (" + execute.replace("%player%", p.getName()) + ")");
|
||||
ServerUtils.sendCommand(execute.replace("%player%",p.getName()));
|
||||
}
|
||||
punished = true;
|
||||
}
|
||||
if (Config.logCmdBlocks) {
|
||||
logged = true;
|
||||
NotifyDiscord.usedBlock(p,b,denied,deoped,banned,logged);
|
||||
NotifyDiscord.usedBlock(p,b,denied,deoped,punished,logged);
|
||||
}
|
||||
NotifyConsole.usedBlock(p,b,denied,deoped,banned,logged);
|
||||
NotifyTrusted.usedBlock(p,b,denied,deoped,banned,logged);
|
||||
NotifyConsole.usedBlock(p,b,denied,deoped,punished,logged);
|
||||
NotifyTrusted.usedBlock(p,b,denied,deoped,punished,logged);
|
||||
}
|
||||
public static void useEntity(PlayerInteractEntityEvent e) {
|
||||
if (e.getRightClicked() == null) return;
|
||||
@@ -153,7 +209,7 @@ public class TakeAction {
|
||||
Entity ent = e.getRightClicked();
|
||||
boolean denied = false;
|
||||
boolean deoped = false;
|
||||
boolean banned = false;
|
||||
boolean punished = false;
|
||||
boolean logged = false;
|
||||
if (Config.preventCmdBlocks) {
|
||||
e.setCancelled(true);
|
||||
@@ -163,15 +219,18 @@ public class TakeAction {
|
||||
p.setOp(false);
|
||||
deoped = true;
|
||||
}
|
||||
if (Config.ban) {
|
||||
ServerUtils.sendCommand("ban " + p.getName() + " ]=- Sentinel Anti-Grief -=[ You have been banned for attempting to use dangerous entities. Contact an administrator if you believe this to be a mistake.");
|
||||
banned = true;
|
||||
if (Config.cmdblockPunish) {
|
||||
for (String execute : punishCommands) {
|
||||
Sentinel.log.info("Dispatching a sentinel command! (" + execute.replace("%player%", p.getName()) + ")");
|
||||
ServerUtils.sendCommand(execute.replace("%player%",p.getName()));
|
||||
}
|
||||
punished = true;
|
||||
}
|
||||
if (Config.logCmdBlocks) {
|
||||
logged = true;
|
||||
NotifyDiscord.usedEntity(p,ent,denied,deoped,banned,logged);
|
||||
NotifyDiscord.usedEntity(p,ent,denied,deoped,punished,logged);
|
||||
}
|
||||
NotifyConsole.usedEntity(p,ent,denied,deoped,banned,logged);
|
||||
NotifyTrusted.usedEntity(p,ent,denied,deoped,banned,logged);
|
||||
NotifyConsole.usedEntity(p,ent,denied,deoped,punished,logged);
|
||||
NotifyTrusted.usedEntity(p,ent,denied,deoped,punished,logged);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,12 +64,12 @@ public class AntiSpam {
|
||||
public static void alertSpam(Player p, String message1, String message2) {
|
||||
TextComponent text = new TextComponent();
|
||||
p.sendMessage(TextUtils.prefix("Do not spam in chat! Please wait before sending another message."));
|
||||
String hover = TextUtils.color("§8]==-- §d§lSentinel §8--==[" +
|
||||
"\n&bPrevious: &f" + message2 +
|
||||
"\n&bCurrent: &f" + message1 +
|
||||
"\n&bSimilarity &f" + GPTUtils.calculateSimilarity(message1,message2 + "%"));
|
||||
text.setText(TextUtils.prefix(TextUtils.color
|
||||
("&b&n" + p.getName() + "&7 might be spamming! &8(&c" + heatMap.get(p) + "&7/&4" + Config.punishHeat + "&8)")));
|
||||
String hover ="§8]==-- §d§lSentinel §8--==[" +
|
||||
"\n§bPrevious: §f" + message2 +
|
||||
"\n§bCurrent: §f" + message1 +
|
||||
"\n§bSimilarity §f" + GPTUtils.calculateSimilarity(message1,message2 + "%");
|
||||
text.setText(TextUtils.prefix(
|
||||
"§b§n" + p.getName() + "§7 might be spamming! §8(§c" + heatMap.get(p) + "§7/§4" + Config.punishHeat + "§8)"));
|
||||
text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(hover)));
|
||||
ServerUtils.forEachStaff(staff -> {
|
||||
staff.spigot().sendMessage(text);
|
||||
@@ -82,10 +82,10 @@ public class AntiSpam {
|
||||
chatCleared = true;
|
||||
}
|
||||
ServerUtils.sendCommand(Config.punishSpamCommand.replace("%player%", player.getName()));
|
||||
player.sendMessage(TextUtils.prefix(TextUtils.color("&cYou have been auto-punished for violating the anti-spam repetitively!")));
|
||||
player.sendMessage(TextUtils.prefix("§cYou have been auto-punished for violating the anti-spam repetitively!"));
|
||||
TextComponent text = new TextComponent();
|
||||
text.setText(TextUtils.prefix(TextUtils.color
|
||||
("&b&n" + player.getName() + "&7 has been auto-muted by the anti-spam! &8(&c" + heatMap.get(player) + "&7/&4" + Config.punishHeat + "&8)")));
|
||||
text.setText(TextUtils.prefix(
|
||||
"§b§n" + player.getName() + "§7 has been auto-muted by the anti-spam! §8(§c" + heatMap.get(player) + "§7/§4" + Config.punishHeat + "§8)"));
|
||||
ServerUtils.forEachStaff(staff -> {
|
||||
staff.spigot().sendMessage(text);
|
||||
});
|
||||
|
||||
@@ -12,7 +12,17 @@ import java.net.InetAddress;
|
||||
import java.net.URL;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
public class Authenticator {
|
||||
|
||||
@@ -31,33 +41,65 @@ public class Authenticator {
|
||||
}
|
||||
}
|
||||
|
||||
public static String authorize(String license, String serverID) {
|
||||
public static String authorize(String licenseKey, String serverID) {
|
||||
String authStatus = "";
|
||||
|
||||
try {
|
||||
URL url = new URL("https://sentinelauth.000webhostapp.com");
|
||||
URL url = new URL("https://sentinelauth.000webhostapp.com/index.html");
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (line.contains(license)) {
|
||||
String[] parts = line.split(":");
|
||||
if (parts.length > 1) {
|
||||
String[] allowedIDs = parts[1].split("\\s+");
|
||||
for (String id : allowedIDs) {
|
||||
if (id.equals(serverID)) {
|
||||
reader.close();
|
||||
return "AUTHORIZED";
|
||||
}
|
||||
List<String> lines = readLines(reader);
|
||||
|
||||
for (String line : lines) {
|
||||
if (line.contains("data-key")) {
|
||||
String key = extractValue(line, "data-key");
|
||||
String allowedIDs = extractValue(line, "data-allowed");
|
||||
String[] allowedArr = allowedIDs.split(":");
|
||||
|
||||
if (key.equals(licenseKey)) {
|
||||
if (Arrays.asList(allowedArr).contains(serverID)) {
|
||||
authStatus = "AUTHORIZED";
|
||||
} else {
|
||||
authStatus = "INVALID-ID";
|
||||
}
|
||||
break;
|
||||
}
|
||||
reader.close();
|
||||
return "INVALID-ID";
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
|
||||
if (authStatus.isEmpty()) {
|
||||
authStatus = "UNREGISTERED";
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "UNREGISTERED";
|
||||
|
||||
return authStatus;
|
||||
}
|
||||
|
||||
public static List<String> readLines(BufferedReader reader) {
|
||||
try {
|
||||
List<String> lines = new ArrayList<>();
|
||||
String line = reader.readLine();
|
||||
while (line != null) {
|
||||
lines.add(line);
|
||||
line = reader.readLine();
|
||||
}
|
||||
reader.close();
|
||||
return lines;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public static String extractValue(String line, String attribute) {
|
||||
int start = line.indexOf(attribute + "=\"") + attribute.length() + 2;
|
||||
int end = line.indexOf("\"", start);
|
||||
return line.substring(start, end);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String getServerID() {
|
||||
return encrypt(IP.getHostAddress());
|
||||
}
|
||||
|
||||
@@ -72,11 +72,11 @@ public class ProfanityFilter {
|
||||
}
|
||||
public static void punishSwear(Player player, String highlightedMSG, String origMessage) {
|
||||
ServerUtils.sendCommand(Config.swearPunishCommand.replace("%player%", player.getName()));
|
||||
player.sendMessage(TextUtils.prefix(TextUtils.color("&cYou have been auto-muted for violating the anti-swear repetitively!")));
|
||||
String hover = TextUtils.color("&bOriginal: &f" + origMessage + "\n&bSanitized: &f" + highlightedMSG + "\n&7&o(click to copy)");
|
||||
player.sendMessage(TextUtils.prefix(("§cYou have been auto-muted for violating the anti-swear repetitively!")));
|
||||
String hover = ("§bOriginal: §f" + origMessage + "\n§bSanitized: §f" + highlightedMSG + "\n§7§o(click to copy)");
|
||||
TextComponent text = new TextComponent();
|
||||
text.setText(TextUtils.prefix(TextUtils.color
|
||||
("&b&n" + player.getName() + "&7 has been auto-muted by the anti-swear! &8(&c" + scoreMap.get(player) + "&7/&4" + Config.punishScore + "&8)")));
|
||||
text.setText(TextUtils.prefix(
|
||||
("§b§n" + player.getName() + "§7 has been auto-muted by the anti-swear! §8(§c" + scoreMap.get(player) + "§7/§4" + Config.punishScore + "§8)")));
|
||||
text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(hover)));
|
||||
text.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, origMessage));
|
||||
|
||||
@@ -88,11 +88,11 @@ public class ProfanityFilter {
|
||||
public static void punishSlur(Player player, String highlightedMSG, String origMessage) {
|
||||
if (!Config.slurInstaPunish) return;
|
||||
ServerUtils.sendCommand(Config.slurPunishCommand.replace("%player%", player.getName()));
|
||||
player.sendMessage(TextUtils.prefix(TextUtils.color("&cYou have been insta-muted for saying a slur!")));
|
||||
String hover = TextUtils.color("&bOriginal: &f" + origMessage + "\n&bSanitized: &f" + highlightedMSG + "\n&7&o(click to copy)");
|
||||
player.sendMessage(TextUtils.prefix(("§cYou have been insta-muted for saying a slur!")));
|
||||
String hover = ("§bOriginal: §f" + origMessage + "\n§bSanitized: §f" + highlightedMSG + "\n§7§o(click to copy)");
|
||||
TextComponent text = new TextComponent();
|
||||
text.setText(TextUtils.prefix(TextUtils.color
|
||||
("&b&n" + player.getName() + "&7 has been insta-muted by the anti-swear! &8(&e" + scoreMap.get(player) + "&7/&4" + Config.punishScore + "&8)")));
|
||||
text.setText(TextUtils.prefix(
|
||||
("§b§n" + player.getName() + "§7 has been insta-muted by the anti-swear! §8(§e" + scoreMap.get(player) + "§7/§4" + Config.punishScore + "§8)")));
|
||||
text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(hover)));
|
||||
text.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, origMessage));
|
||||
|
||||
@@ -102,11 +102,11 @@ public class ProfanityFilter {
|
||||
if (Config.logSwear) WebhookSender.sendSlurLog(player,origMessage,scoreMap.get(player));
|
||||
}
|
||||
public static void blockSwear(Player player, String highlightedMSG, String origMessage, String severity) {
|
||||
player.sendMessage(TextUtils.prefix(TextUtils.color("&cPlease do not swear in chat! Attempting to bypass this filter will result in a mute!")));
|
||||
String hover = TextUtils.color("&bOriginal: &f" + origMessage + "\n&bSanitized: &f" + highlightedMSG + "\n&bSeverity" + severity + "\n&7&o(click to copy)");
|
||||
player.sendMessage(TextUtils.prefix(("§cPlease do not swear in chat! Attempting to bypass this filter will result in a mute!")));
|
||||
String hover = ("§bOriginal: §f" + origMessage + "\n§bSanitized: §f" + highlightedMSG + "\n§bSeverity" + severity + "\n§7§o(click to copy)");
|
||||
TextComponent text = new TextComponent();
|
||||
text.setText(TextUtils.prefix(TextUtils.color
|
||||
("&b&n" + player.getName() + "&7 has triggered the anti-swear! &8(&c" + scoreMap.get(player) + "&7/&4" + Config.punishScore + "&8)")));
|
||||
text.setText(TextUtils.prefix(
|
||||
("§b§n" + player.getName() + "§7 has triggered the anti-swear! §8(§c" + scoreMap.get(player) + "§7/§4" + Config.punishScore + "§8)")));
|
||||
text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(hover)));
|
||||
text.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, origMessage));
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public final class ArrayUtils {
|
||||
}
|
||||
|
||||
public static <T> String list2string(List<T> list) {
|
||||
return TextUtils.color("&7[&e" + String.join("&7, &e", ArrayUtils.toNewList(list, Object::toString)) + "&7]");
|
||||
return ("§7[§e" + String.join("§7, §e", ArrayUtils.toNewList(list, Object::toString)) + "§7]");
|
||||
}
|
||||
|
||||
public static <T> List<T> bind(Iterable<T> tList, T... ts) {
|
||||
|
||||
@@ -13,67 +13,79 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NotifyConsole {
|
||||
public static void command(Player p, String command, boolean denied, boolean deoped, boolean banned, boolean logged) {
|
||||
public static void specific(Player p, String command, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
||||
final String log = (
|
||||
"Sentinel caught a dangerous command! \n]==-- &d&lSentinel --==[" +
|
||||
"Sentinel caught a specific command! \n]==-- Sentinel --==[" +
|
||||
"\nPlayer: " + p.getName() +
|
||||
"\nCommand: " + command +
|
||||
"\nDenied: " + TextUtils.boolString(denied,"\u2714","\u2718") +
|
||||
"\nDeoped: " + TextUtils.boolString(deoped,"\u2714","\u2718") +
|
||||
"\nPunished: " + TextUtils.boolString(punished,"\u2714","\u2718") +
|
||||
"\nLogged: " + TextUtils.boolString(logged,"\u2714","\u2718")
|
||||
);
|
||||
Sentinel.log.info(log);
|
||||
}
|
||||
public static void command(Player p, String command, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
||||
final String log = (
|
||||
"Sentinel caught a dangerous command! \n]==-- Sentinel --==[" +
|
||||
"\nPlayer: " + p.getName() +
|
||||
"\nCommand: " + command +
|
||||
"\nDenied: " + TextUtils.boolString(denied,"✔","✘") +
|
||||
"\nDeoped: " + TextUtils.boolString(deoped,"✔","✘") +
|
||||
"\nBanned: " + TextUtils.boolString(banned,"✔","✘") +
|
||||
"\nLogged: " + TextUtils.boolString(logged,"✔","✘")
|
||||
"\nDenied: " + TextUtils.boolString(denied,"\u2714","\u2718") +
|
||||
"\nDeoped: " + TextUtils.boolString(deoped,"\u2714","\u2718") +
|
||||
"\nPunished: " + TextUtils.boolString(punished,"\u2714","\u2718") +
|
||||
"\nLogged: " + TextUtils.boolString(logged,"\u2714","\u2718")
|
||||
);
|
||||
Sentinel.log.info(log);
|
||||
}
|
||||
public static void NBT(Player p, ItemStack item, boolean removed, boolean deoped, boolean gms, boolean banned, boolean logged) {
|
||||
public static void NBT(Player p, ItemStack item, boolean removed, boolean deoped, boolean gms, boolean punished, boolean logged) {
|
||||
String log = (
|
||||
"Sentinel caught a dangerous NBT! \n]==-- &d&lSentinel --==[" +
|
||||
"Sentinel caught a dangerous NBT! \n]==-- Sentinel --==[" +
|
||||
"\nPlayer: " + p.getName() +
|
||||
"\nItemType: " + item.getType() +
|
||||
"\nRemoved: " + TextUtils.boolString(removed,"✔","✘") +
|
||||
"\nDeoped: " + TextUtils.boolString(deoped,"✔","✘") +
|
||||
"\nRevert GM: " + TextUtils.boolString(gms, "✔", "✘") +
|
||||
"\nBanned: " + TextUtils.boolString(banned,"✔","✘") +
|
||||
"\nLogged: " + TextUtils.boolString(logged,"✔","✘")
|
||||
"\nRemoved: " + TextUtils.boolString(removed,"\u2714","\u2718") +
|
||||
"\nDeoped: " + TextUtils.boolString(deoped,"\u2714","\u2718") +
|
||||
"\nRevert GM: " + TextUtils.boolString(gms, "\u2714","\u2718") +
|
||||
"\nPunished: " + TextUtils.boolString(punished,"\u2714","\u2718") +
|
||||
"\nLogged: " + TextUtils.boolString(logged,"\u2714","\u2718")
|
||||
);
|
||||
Sentinel.log.info(log);
|
||||
}
|
||||
public static void placeBlock(Player p, Block b, boolean deleted, boolean deoped, boolean banned, boolean logged) {
|
||||
public static void placeBlock(Player p, Block b, boolean deleted, boolean deoped, boolean punished, boolean logged) {
|
||||
String log = (
|
||||
"Sentinel has caught the placing of a dangerous block! \n]==-- &d&lSentinel --==[" +
|
||||
"Sentinel has caught the placing of a dangerous block! \n]==-- Sentinel --==[" +
|
||||
"\nPlayer: " + p.getName() +
|
||||
"\nBlockType: " + b.getType() +
|
||||
"\nLocation: " + b.getX() + " " + b.getY() + " " + b.getZ() +
|
||||
"\nDeleted: " + TextUtils.boolString(deleted,"✔","✘") +
|
||||
"\nDeoped: " + TextUtils.boolString(deoped,"✔","✘") +
|
||||
"\nBanned: " + TextUtils.boolString(banned,"✔","✘") +
|
||||
"\nLogged: " + TextUtils.boolString(logged,"✔","✘")
|
||||
"\nDeleted: " + TextUtils.boolString(deleted,"\u2714","\u2718") +
|
||||
"\nDeoped: " + TextUtils.boolString(deoped,"\u2714","\u2718") +
|
||||
"\nPunished: " + TextUtils.boolString(punished,"\u2714","\u2718") +
|
||||
"\nLogged: " + TextUtils.boolString(logged,"\u2714","\u2718")
|
||||
);
|
||||
Sentinel.log.info(log);
|
||||
}
|
||||
public static void usedBlock(Player p, Block b, boolean denied, boolean deoped, boolean banned, boolean logged) {
|
||||
public static void usedBlock(Player p, Block b, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
||||
String log = (
|
||||
"]==-- &d&lSentinel --==[" +
|
||||
"]==-- Sentinel --==[" +
|
||||
"\nPlayer: " + p.getName() +
|
||||
"\nBlockType: " + b.getType() +
|
||||
"\nLocation: " + b.getX() + " " + b.getY() + " " + b.getZ() +
|
||||
"\nDenied: " + TextUtils.boolString(denied,"✔","✘") +
|
||||
"\nDeoped: " + TextUtils.boolString(deoped,"✔","✘") +
|
||||
"\nBanned: " + TextUtils.boolString(banned,"✔","✘") +
|
||||
"\nLogged: " + TextUtils.boolString(logged,"✔","✘")
|
||||
"\nDenied: " + TextUtils.boolString(denied,"\u2714","\u2718") +
|
||||
"\nDeoped: " + TextUtils.boolString(deoped,"\u2714","\u2718") +
|
||||
"\nPunished: " + TextUtils.boolString(punished,"\u2714","\u2718") +
|
||||
"\nLogged: " + TextUtils.boolString(logged,"\u2714","\u2718")
|
||||
);
|
||||
Sentinel.log.info(log);
|
||||
}
|
||||
public static void usedEntity(Player p, Entity e, boolean denied, boolean deoped, boolean banned, boolean logged) {
|
||||
public static void usedEntity(Player p, Entity e, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
||||
String log = (
|
||||
"]==-- &d&lSentinel --==[" +
|
||||
"]==-- Sentinel --==[" +
|
||||
"\nPlayer: " + p.getName() +
|
||||
"\nEntityType: " + e.getType() +
|
||||
"\nLocation: " + e.getLocation().getX() + " " + e.getLocation().getY() + " " + e.getLocation().getZ() +
|
||||
"\nDenied: " + TextUtils.boolString(denied,"✔","✘") +
|
||||
"\nDeoped: " + TextUtils.boolString(deoped,"✔","✘") +
|
||||
"\nBanned: " + TextUtils.boolString(banned,"✔","✘") +
|
||||
"\nLogged: " + TextUtils.boolString(logged,"✔","✘")
|
||||
"\nDenied: " + TextUtils.boolString(denied,"\u2714","\u2718") +
|
||||
"\nDeoped: " + TextUtils.boolString(deoped,"\u2714","\u2718") +
|
||||
"\nPunished: " + TextUtils.boolString(punished,"\u2714","\u2718") +
|
||||
"\nLogged: " + TextUtils.boolString(logged,"\u2714","\u2718")
|
||||
);
|
||||
Sentinel.log.info(log);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,36 @@ import java.awt.*;
|
||||
import java.io.IOException;
|
||||
|
||||
public class NotifyDiscord {
|
||||
public static void command(Player player, String command, boolean denied, boolean deoped, boolean banned, boolean logged) {
|
||||
public static void specific(Player player, String command, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
||||
ServerUtils.sendDebugMessage("Creating Specific Webhook...");
|
||||
DiscordWebhook webhook = new DiscordWebhook(Config.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()
|
||||
.setAuthor("Anti-Nuke has been triggered","","")
|
||||
.setTitle("The use of a specific command has been detected!")
|
||||
.setDescription(
|
||||
Emojis.rightSort + " **Player:** " + player.getName() + " " + Emojis.member + "\\n" +
|
||||
Emojis.rightSort + " **Command:** " + command + " " + Emojis.nuke + "\\n"
|
||||
)
|
||||
.addField("Actions:",
|
||||
Emojis.rightSort + " **Denied:** " + TextUtils.boolString(denied,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **De-oped:** " + TextUtils.boolString(deoped,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **Punished:** " + TextUtils.boolString(punished,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + "**Logged:** " + TextUtils.boolString(logged,Emojis.success, Emojis.failure), false
|
||||
)
|
||||
.setThumbnail("https://crafatar.com/avatars/" + player.getUniqueId() + "?size=64&&overlay")
|
||||
.setColor(Color.RED);
|
||||
webhook.addEmbed(embed);
|
||||
try {
|
||||
ServerUtils.sendDebugMessage("Executing webhook...");
|
||||
webhook.execute();
|
||||
} catch (IOException e) {
|
||||
ServerUtils.sendDebugMessage(TextUtils.prefix("Epic webhook failure!!!"));
|
||||
Sentinel.log.info(e.toString());
|
||||
}
|
||||
}
|
||||
public static void command(Player player, String command, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
||||
ServerUtils.sendDebugMessage("Creating Command Webhook...");
|
||||
DiscordWebhook webhook = new DiscordWebhook(Config.webhook);
|
||||
webhook.setAvatarUrl("https://r2.e-z.host/d440b58a-ba90-4839-8df6-8bba298cf817/3lwit5nt.png");
|
||||
@@ -31,7 +60,7 @@ public class NotifyDiscord {
|
||||
.addField("Actions:",
|
||||
Emojis.rightSort + " **Denied:** " + TextUtils.boolString(denied,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **De-oped:** " + TextUtils.boolString(deoped,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **Banned:** " + TextUtils.boolString(banned,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **Punished:** " + TextUtils.boolString(punished,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + "**Logged:** " + TextUtils.boolString(logged,Emojis.success, Emojis.failure), false
|
||||
)
|
||||
.setThumbnail("https://crafatar.com/avatars/" + player.getUniqueId() + "?size=64&&overlay")
|
||||
@@ -45,7 +74,7 @@ public class NotifyDiscord {
|
||||
Sentinel.log.info(e.toString());
|
||||
}
|
||||
}
|
||||
public static void NBT(Player player, ItemStack item, boolean removed, boolean deoped, boolean gms, boolean banned, boolean logged, String logFileName) {
|
||||
public static void NBT(Player player, ItemStack item, boolean removed, boolean deoped, boolean gms, boolean punished, boolean logged, String logFileName) {
|
||||
ServerUtils.sendDebugMessage("Creating NBT Webhook...");
|
||||
|
||||
DiscordWebhook webhook = new DiscordWebhook(Config.webhook);
|
||||
@@ -63,7 +92,7 @@ public class NotifyDiscord {
|
||||
Emojis.rightSort + " **Removed:** " + TextUtils.boolString(removed,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **De-oped:** " + TextUtils.boolString(deoped,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **GM Reverted:** " + TextUtils.boolString(gms,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **Banned:** " + TextUtils.boolString(banned,Emojis.success, Emojis.failure) + "\\n"+
|
||||
Emojis.rightSort + " **Punished:** " + TextUtils.boolString(punished,Emojis.success, Emojis.failure) + "\\n"+
|
||||
Emojis.rightSort + " **Logged:** " + TextUtils.boolString(logged,Emojis.success, Emojis.failure), false
|
||||
)
|
||||
.setColor(Color.BLUE);
|
||||
@@ -76,7 +105,7 @@ public class NotifyDiscord {
|
||||
Sentinel.log.info(e.toString());
|
||||
}
|
||||
}
|
||||
public static void placeBlock(Player player, Block b, boolean deleted, boolean deoped, boolean banned, boolean logged) {
|
||||
public static void placeBlock(Player player, Block b, boolean deleted, boolean deoped, boolean punished, boolean logged) {
|
||||
ServerUtils.sendDebugMessage("Creating placeBlock Webhook...");
|
||||
DiscordWebhook webhook = new DiscordWebhook(Config.webhook);
|
||||
webhook.setAvatarUrl("https://r2.e-z.host/d440b58a-ba90-4839-8df6-8bba298cf817/3lwit5nt.png");
|
||||
@@ -86,12 +115,13 @@ public class NotifyDiscord {
|
||||
.setTitle("The placing of a dangerous block has been detected!")
|
||||
.setDescription(
|
||||
Emojis.rightSort + " **Player:** " + player.getName() + " " + Emojis.member + "\\n" +
|
||||
Emojis.rightSort + " **Block:** " + b.getType().toString().toLowerCase() + " " + Emojis.nuke + "\\n"
|
||||
Emojis.rightSort + " **Block:** " + b.getType().toString().toLowerCase() + " " + Emojis.nuke + "\\n" +
|
||||
Emojis.space + Emojis.rightDoubleArrow + " **Location:** X: " + b.getX() + " Y: " + b.getY() + " Z: " + b.getZ() + "\\n"
|
||||
)
|
||||
.addField("Actions:",
|
||||
Emojis.rightSort + " **Deleted:** " + TextUtils.boolString(deleted,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **De-oped:** " + TextUtils.boolString(deoped,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **Banned:** " + TextUtils.boolString(banned,Emojis.success, Emojis.failure) + "\\n"+
|
||||
Emojis.rightSort + " **Punished:** " + TextUtils.boolString(punished,Emojis.success, Emojis.failure) + "\\n"+
|
||||
Emojis.rightSort + " **Logged:** " + TextUtils.boolString(logged,Emojis.success, Emojis.failure), false
|
||||
)
|
||||
.setColor(Color.RED);
|
||||
@@ -104,7 +134,7 @@ public class NotifyDiscord {
|
||||
Sentinel.log.info(e.toString());
|
||||
}
|
||||
}
|
||||
public static void usedBlock(Player player, Block b, boolean denied, boolean deoped, boolean banned, boolean logged) {
|
||||
public static void usedBlock(Player player, Block b, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
||||
ServerUtils.sendDebugMessage("Creating useBlock Webhook...");
|
||||
DiscordWebhook webhook = new DiscordWebhook(Config.webhook);
|
||||
webhook.setAvatarUrl("https://r2.e-z.host/d440b58a-ba90-4839-8df6-8bba298cf817/3lwit5nt.png");
|
||||
@@ -114,12 +144,13 @@ public class NotifyDiscord {
|
||||
.setTitle("The use of a dangerous block has been detected!")
|
||||
.setDescription(
|
||||
Emojis.rightSort + " **Player:** " + player.getName() + " " + Emojis.member + "\\n" +
|
||||
Emojis.rightSort + " **Block:** " + b.getType() + " " + Emojis.nuke + "\\n"
|
||||
Emojis.rightSort + " **Block:** " + b.getType() + " " + Emojis.nuke + "\\n" +
|
||||
Emojis.space + Emojis.rightDoubleArrow + " **Location:** X: " + b.getX() + " Y: " + b.getY() + " Z: " + b.getZ() + "\\n"
|
||||
)
|
||||
.addField("Actions:",
|
||||
Emojis.rightSort + " **Denied:** " + TextUtils.boolString(denied,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **De-oped:** " + TextUtils.boolString(deoped,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **Banned:** " + TextUtils.boolString(banned,Emojis.success, Emojis.failure) + "\\n"+
|
||||
Emojis.rightSort + " **Punished:** " + TextUtils.boolString(punished,Emojis.success, Emojis.failure) + "\\n"+
|
||||
Emojis.rightSort + " **Logged:** " + TextUtils.boolString(logged,Emojis.success, Emojis.failure), false
|
||||
)
|
||||
.setColor(Color.RED);
|
||||
@@ -132,7 +163,7 @@ public class NotifyDiscord {
|
||||
Sentinel.log.info(e.toString());
|
||||
}
|
||||
}
|
||||
public static void usedEntity(Player player, Entity e, boolean denied, boolean deoped, boolean banned, boolean logged) {
|
||||
public static void usedEntity(Player player, Entity e, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
||||
ServerUtils.sendDebugMessage("Creating useEntity Webhook...");
|
||||
DiscordWebhook webhook = new DiscordWebhook(Config.webhook);
|
||||
webhook.setAvatarUrl("https://r2.e-z.host/d440b58a-ba90-4839-8df6-8bba298cf817/3lwit5nt.png");
|
||||
@@ -142,12 +173,13 @@ public class NotifyDiscord {
|
||||
.setTitle("The use of a dangerous entity has been detected!")
|
||||
.setDescription(
|
||||
Emojis.rightSort + " **Player:** " + player.getName() + " " + Emojis.member + "\\n" +
|
||||
Emojis.rightSort + " **Entity:** " + e.getType() + " " + Emojis.nuke + "\\n"
|
||||
Emojis.rightSort + " **Entity:** " + e.getType() + " " + Emojis.nuke + "\\n" +
|
||||
Emojis.space + Emojis.rightDoubleArrow + " **Location:** X: " + e.getLocation().getX() + " Y: " + e.getLocation().getY() + " Z: " + e.getLocation().getZ() + "\\n"
|
||||
)
|
||||
.addField("Actions:",
|
||||
Emojis.rightSort + " **Denied:** " + TextUtils.boolString(denied,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **De-oped:** " + TextUtils.boolString(deoped,Emojis.success, Emojis.failure) + "\\n" +
|
||||
Emojis.rightSort + " **Banned:** " + TextUtils.boolString(banned,Emojis.success, Emojis.failure) + "\\n"+
|
||||
Emojis.rightSort + " **Punished:** " + TextUtils.boolString(punished,Emojis.success, Emojis.failure) + "\\n"+
|
||||
Emojis.rightSort + " **Logged:** " + TextUtils.boolString(logged,Emojis.success, Emojis.failure), false
|
||||
)
|
||||
.setColor(Color.RED);
|
||||
|
||||
@@ -15,18 +15,35 @@ import org.bukkit.event.server.ServerEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NotifyTrusted {
|
||||
public static void command(Player p, String command, boolean denied, boolean deoped, boolean banned, boolean logged) {
|
||||
TextComponent notification = new TextComponent(TextUtils.prefix(TextUtils.color("&b&n" + p.getName() + "&7 Has just attempted a dangerous command!")));
|
||||
public static void specific(Player p, String command, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
||||
TextComponent notification = new TextComponent(TextUtils.prefix("§b§n" + p.getName() + "§7 Has just attempted a specific command!"));
|
||||
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(
|
||||
TextUtils.color(
|
||||
"&8]==-- &d&lSentinel &8--==[" +
|
||||
"\n&bPlayer: &f" + p.getName() +
|
||||
"\n&bCommand: &f" + command +
|
||||
"\n&bDenied: " + TextUtils.boolString(denied,"&a✔","&c✘") +
|
||||
"\n&bDeoped: " + TextUtils.boolString(deoped,"&a✔","&c✘") +
|
||||
"\n&bBanned: " + TextUtils.boolString(banned,"&a✔","&c✘") +
|
||||
"\n&bLogged: " + TextUtils.boolString(logged,"&a✔","&c✘")
|
||||
)
|
||||
"§8]==-- §d§lSentinel §8--==[" +
|
||||
"\n§bPlayer: §f" + p.getName() +
|
||||
"\n§bCommand: §f" + command +
|
||||
"\n§bDenied: " + TextUtils.boolString(denied,"§a\u2714","§c\u2718") +
|
||||
"\n§bDeoped: " + TextUtils.boolString(deoped,"§a\u2714","§c\u2718") +
|
||||
"\n§bPunished: " + TextUtils.boolString(punished,"§a\u2714","§c\u2718") +
|
||||
"\n§bLogged: " + TextUtils.boolString(logged,"§a\u2714","§c\u2718")
|
||||
|
||||
)));
|
||||
for (Player trustedPlayer : Bukkit.getOnlinePlayers()) {
|
||||
if (Sentinel.isTrusted(trustedPlayer)) {
|
||||
trustedPlayer.spigot().sendMessage(notification);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void command(Player p, String command, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
||||
TextComponent notification = new TextComponent(TextUtils.prefix("§b§n" + p.getName() + "§7 Has just attempted a dangerous command!"));
|
||||
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(
|
||||
"§8]==-- §d§lSentinel §8--==[" +
|
||||
"\n§bPlayer: §f" + p.getName() +
|
||||
"\n§bCommand: §f" + command +
|
||||
"\n§bDenied: " + TextUtils.boolString(denied,"§a\u2714","§c\u2718") +
|
||||
"\n§bDeoped: " + TextUtils.boolString(deoped,"§a\u2714","§c\u2718") +
|
||||
"\n§bPunished: " + TextUtils.boolString(punished,"§a\u2714","§c\u2718") +
|
||||
"\n§bLogged: " + TextUtils.boolString(logged,"§a\u2714","§c\u2718")
|
||||
|
||||
)));
|
||||
|
||||
for (Player trustedPlayer : Bukkit.getOnlinePlayers()) {
|
||||
@@ -35,21 +52,20 @@ public class NotifyTrusted {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void NBT(Player p, ItemStack item, boolean removed, boolean deoped, boolean gms, boolean banned, boolean logged) {
|
||||
TextComponent notification = new TextComponent(TextUtils.prefix(TextUtils.color("&b&n" + p.getName() + "&7 Has just attempted to use a dangerous NBT item!")));
|
||||
public static void NBT(Player p, ItemStack item, boolean removed, boolean deoped, boolean gms, boolean punished, boolean logged) {
|
||||
TextComponent notification = new TextComponent(TextUtils.prefix("§b§n" + p.getName() + "§7 Has just attempted to use a dangerous NBT item!"));
|
||||
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(
|
||||
TextUtils.color(
|
||||
"&8]==-- &d&lSentinel &8--==[" +
|
||||
"\n&bPlayer: &f" + p.getName() +
|
||||
"\n&bItemType: &f" + item.getType() +
|
||||
"\n&bRemoved: " + TextUtils.boolString(removed,"&a✔","&c✘") +
|
||||
"\n&bDeoped: " + TextUtils.boolString(deoped,"&a✔","&c✘") +
|
||||
"\n&bRevert GM: " + TextUtils.boolString(gms, "&a✔", "&c✘") +
|
||||
"\n&bBanned: " + TextUtils.boolString(banned,"&a✔","&c✘") +
|
||||
"\n&bLogged: " + TextUtils.boolString(logged,"&a✔","&c✘") +
|
||||
"\n&7(Click to copy NBT)"
|
||||
"§8]==-- §d§lSentinel §8--==[" +
|
||||
"\n§bPlayer: §f" + p.getName() +
|
||||
"\n§bItemType: §f" + item.getType() +
|
||||
"\n§bRemoved: " + TextUtils.boolString(removed,"§a\u2714","§c\u2718") +
|
||||
"\n§bDeoped: " + TextUtils.boolString(deoped,"§a\u2714","§c\u2718") +
|
||||
"\n§bRevert GM: " + TextUtils.boolString(gms, "§a\u2714","§c\u2718") +
|
||||
"\n§bPunished: " + TextUtils.boolString(punished,"§a\u2714","§c\u2718") +
|
||||
"\n§bLogged: " + TextUtils.boolString(logged,"§a\u2714","§c\u2718") +
|
||||
"\n§7(Click to copy NBT)"
|
||||
|
||||
))));
|
||||
)));
|
||||
notification.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, new String(item.getType().toString().toLowerCase() + item.getItemMeta().getAsString())));
|
||||
for (Player trustedPlayer : Bukkit.getOnlinePlayers()) {
|
||||
if (Sentinel.isTrusted(trustedPlayer)) {
|
||||
@@ -57,19 +73,19 @@ public class NotifyTrusted {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void placeBlock(Player p, Block b, boolean removed, boolean deoped, boolean banned, boolean logged) {
|
||||
TextComponent notification = new TextComponent(TextUtils.prefix(TextUtils.color("&b&n" + p.getName() + "&7 Has just attempted to place a dangerous block!")));
|
||||
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(TextUtils.color(
|
||||
"&8]==-- &d&lSentinel &8--==[" +
|
||||
"\n&bPlayer: &f" + p.getName() +
|
||||
"\n&bBlockType: &f" + b.getType() +
|
||||
"\n&bLocation: " + b.getX() + " " + b.getY() + " " + b.getZ() +
|
||||
"\n&bRemoved: " + TextUtils.boolString(removed,"&a✔","&c✘") +
|
||||
"\n&bDeoped: " + TextUtils.boolString(deoped,"&a✔","&c✘") +
|
||||
"\n&bBanned: " + TextUtils.boolString(banned,"&a✔","&c✘") +
|
||||
"\n&bLogged: " + TextUtils.boolString(logged,"&a✔","&c✘") +
|
||||
"\n&7(Click to Teleport)"
|
||||
))));
|
||||
public static void placeBlock(Player p, Block b, boolean removed, boolean deoped, boolean punished, boolean logged) {
|
||||
TextComponent notification = new TextComponent(TextUtils.prefix("§b§n" + p.getName() + "§7 Has just attempted to place a dangerous block!"));
|
||||
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(
|
||||
"§8]==-- §d§lSentinel §8--==[" +
|
||||
"\n§bPlayer: §f" + p.getName() +
|
||||
"\n§bBlockType: §f" + b.getType() +
|
||||
"\n§bLocation: " + b.getX() + " " + b.getY() + " " + b.getZ() +
|
||||
"\n§bRemoved: " + TextUtils.boolString(removed,"§a\u2714","§c\u2718") +
|
||||
"\n§bDeoped: " + TextUtils.boolString(deoped,"§a\u2714","§c\u2718") +
|
||||
"\n§bPunished: " + TextUtils.boolString(punished,"§a\u2714","§c\u2718") +
|
||||
"\n§bLogged: " + TextUtils.boolString(logged,"§a\u2714","§c\u2718") +
|
||||
"\n§7(Click to Teleport)"
|
||||
)));
|
||||
notification.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "tp " + p.getName()));
|
||||
for (Player trustedPlayer : Bukkit.getOnlinePlayers()) {
|
||||
if (Sentinel.isTrusted(trustedPlayer)) {
|
||||
@@ -77,19 +93,19 @@ public class NotifyTrusted {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void usedBlock(Player p, Block b, boolean denied, boolean deoped, boolean banned, boolean logged) {
|
||||
TextComponent notification = new TextComponent(TextUtils.prefix(TextUtils.color("&b&n" + p.getName() + "&7 Has just attempted to use a dangerous block!")));
|
||||
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(TextUtils.color(
|
||||
"&8]==-- &d&lSentinel &8--==[" +
|
||||
"\n&bPlayer: &f" + p.getName() +
|
||||
"\n&bBlockType: &f" + b.getType() +
|
||||
"\n&bLocation: " + b.getX() + " " + b.getY() + " " + b.getZ() +
|
||||
"\n&bDenied: " + TextUtils.boolString(denied,"&a✔","&c✘") +
|
||||
"\n&bDeoped: " + TextUtils.boolString(deoped,"&a✔","&c✘") +
|
||||
"\n&bBanned: " + TextUtils.boolString(banned,"&a✔","&c✘") +
|
||||
"\n&bLogged: " + TextUtils.boolString(logged,"&a✔","&c✘") +
|
||||
"\n&7(Click to Teleport)"
|
||||
))));
|
||||
public static void usedBlock(Player p, Block b, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
||||
TextComponent notification = new TextComponent(TextUtils.prefix("§b§n" + p.getName() + "§7 Has just attempted to use a dangerous block!"));
|
||||
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(
|
||||
"§8]==-- §d§lSentinel §8--==[" +
|
||||
"\n§bPlayer: §f" + p.getName() +
|
||||
"\n§bBlockType: §f" + b.getType() +
|
||||
"\n§bLocation: " + b.getX() + " " + b.getY() + " " + b.getZ() +
|
||||
"\n§bDenied: " + TextUtils.boolString(denied,"§a\u2714","§c\u2718") +
|
||||
"\n§bDeoped: " + TextUtils.boolString(deoped,"§a\u2714","§c\u2718") +
|
||||
"\n§bPunished: " + TextUtils.boolString(punished,"§a\u2714","§c\u2718") +
|
||||
"\n§bLogged: " + TextUtils.boolString(logged,"§a\u2714","§c\u2718") +
|
||||
"\n§7(Click to Teleport)"
|
||||
)));
|
||||
notification.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "tp " + p.getName()));
|
||||
for (Player trustedPlayer : Bukkit.getOnlinePlayers()) {
|
||||
if (Sentinel.isTrusted(trustedPlayer)) {
|
||||
@@ -97,19 +113,19 @@ public class NotifyTrusted {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void usedEntity(Player p, Entity e, boolean denied, boolean deoped, boolean banned, boolean logged) {
|
||||
TextComponent notification = new TextComponent(TextUtils.prefix(TextUtils.color("&b&n" + p.getName() + "&7 Has just attempted to use a dangerous entity!")));
|
||||
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(TextUtils.color(
|
||||
"&8]==-- &d&lSentinel &8--==[" +
|
||||
"\n&bPlayer: &f" + p.getName() +
|
||||
"\n&bEntityType: &f" + e.getType() +
|
||||
"\n&bLocation: " + e.getLocation().getX() + " " + e.getLocation().getY() + " " + e.getLocation().getZ() +
|
||||
"\n&bDenied: " + TextUtils.boolString(denied,"&a✔","&c✘") +
|
||||
"\n&bDeoped: " + TextUtils.boolString(deoped,"&a✔","&c✘") +
|
||||
"\n&bBanned: " + TextUtils.boolString(banned,"&a✔","&c✘") +
|
||||
"\n&bLogged: " + TextUtils.boolString(logged,"&a✔","&c✘") +
|
||||
"\n&7(Click to Teleport)"
|
||||
))));
|
||||
public static void usedEntity(Player p, Entity e, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
||||
TextComponent notification = new TextComponent(TextUtils.prefix("§b§n" + p.getName() + "§7 Has just attempted to use a dangerous entity!"));
|
||||
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(
|
||||
"§8]==-- §d§lSentinel §8--==[" +
|
||||
"\n§bPlayer: §f" + p.getName() +
|
||||
"\n§bEntityType: §f" + e.getType() +
|
||||
"\n§bLocation: " + e.getLocation().getX() + " " + e.getLocation().getY() + " " + e.getLocation().getZ() +
|
||||
"\n§bDenied: " + TextUtils.boolString(denied,"§a\u2714","§c\u2718") +
|
||||
"\n§bDeoped: " + TextUtils.boolString(deoped,"§a\u2714","§c\u2718") +
|
||||
"\n§bPunished: " + TextUtils.boolString(punished,"§a\u2714","§c\u2718") +
|
||||
"\n§bLogged: " + TextUtils.boolString(logged,"§a\u2714","§c\u2718") +
|
||||
"\n§7(Click to Teleport)"
|
||||
)));
|
||||
notification.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "tp " + p.getName()));
|
||||
for (Player trustedPlayer : Bukkit.getOnlinePlayers()) {
|
||||
if (Sentinel.isTrusted(trustedPlayer)) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Sentinel 0.0.2
|
||||
# Sentinel 0.1.5
|
||||
# ____ __ ___
|
||||
#/\ _`\ /\ \__ __ /\_ \
|
||||
#\ \,\L\_\ __ ___\ \ ,_\/\_\ ___ __\//\ \
|
||||
@@ -11,7 +11,7 @@
|
||||
# Be sure to check out their amazing discord bot!
|
||||
config :
|
||||
plugin:
|
||||
license: "beta" # if you are a beta tester, leave this value as "beta"
|
||||
key: "beta" # if you are a beta tester, leave this value as "beta"
|
||||
# --------------------------------
|
||||
# Anti-Nuke Setup (Do this first)
|
||||
# --------------------------------
|
||||
@@ -22,26 +22,34 @@ config :
|
||||
block-specific: true # Defaulted true | Weather or not to block ALL plugin specific commands from non-trusted members (EX: minecraft:execute) these will not be logged.
|
||||
prevent-nbt: true # Defaulted true | Should NBT items be blocked from the creative hotbar
|
||||
prevent-cmdblocks: true # Defaulted true | Should all command block actions be blocked
|
||||
cmdblock-op-check: true # Defaulted true | Will check if a player is op'd before preforming actions against command blocks (To prevent spam from non oped users attempting command blocks, which they cant by default)
|
||||
dangerous: # These commands can only be run by "trusted" users
|
||||
- "op"
|
||||
- "deop"
|
||||
- "stop"
|
||||
- "restart"
|
||||
- "execute" # Could run commands as a trusted player
|
||||
- "sudo" # same as above
|
||||
- "esudo" # WATCH OUT FOR ESSENTIALS ALIASES !!!
|
||||
- "fill" # Most client side nukers use it
|
||||
- "setblock" # could setblock a command block with anything
|
||||
- "data" # Could modify a command block to whatever they wanted
|
||||
- "whitelist" # Could add other players to the whitelist
|
||||
log-dangerous: true # Default true | Weather or not to log to discord when a dangerous command is executed
|
||||
log-cmdblocks: true # Defaulted true | Log attempts of command-block place-ery in discord
|
||||
log-nbt: true # Defaulted true | Should items and their NBT's be logged to discord
|
||||
log-specific: false # Default false | Weather or not to log to discord when a plugin specific command is executed
|
||||
logged: # Commands that will always be logged to discord when executed.
|
||||
- "gamemode"
|
||||
- "give"
|
||||
- "item"
|
||||
deop: true # Defaulted true | This will remove an untrusted player's operator permissions whenever they attempt dangerous actions
|
||||
ban: false # Default false | Weather or not to ban a player if they attempt something dangerous.
|
||||
nbt-punish: false # Defaulted false | This will ban a player when they attempt to use an NBT item
|
||||
cmdblock-punish: false # Defaulted false | This will ban a player when they attempt to use a command block
|
||||
command-punish: true # Defaulted true | This will ban a player when they attempt to use a dangerous command
|
||||
nbt-punish: false # Defaulted false | This will punish a player when they attempt to use an NBT item
|
||||
cmdblock-punish: false # Defaulted false | This will punish a player when they attempt to use a command block
|
||||
command-punish: false # Defaulted false | This will ban punish player when they attempt to use a dangerous command
|
||||
specific-punish: false # Defaulted false | This will punish a player when they run a specific command (Not recomended)
|
||||
punish-commands: # Commands to run when a dangerous action is to be punished. Use %player% for the punished player's name
|
||||
- "smite %player%"
|
||||
- "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."
|
||||
reop-command: false # Defaulted false | This enables the command allowing trusted players to op themselves if they get deoped.
|
||||
# -------------------------------
|
||||
# Chat Filter Setup & AntiSpam
|
||||
@@ -108,7 +116,7 @@ config :
|
||||
- grape
|
||||
- grass
|
||||
- harass
|
||||
- hot water
|
||||
- hotwater
|
||||
- identit
|
||||
- kassa
|
||||
- kassi
|
||||
|
||||
Reference in New Issue
Block a user