Updated a lot
This commit is contained in:
@@ -18,7 +18,8 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly "org.spigotmc:spigot-api:${project.mc_version}-R0.1-SNAPSHOT"
|
compileOnly "org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT"
|
||||||
|
implementation 'com.google.code.gson:gson:2.10.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
def targetJavaVersion = 16
|
def targetJavaVersion = 16
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ public final class Sentinel extends JavaPlugin {
|
|||||||
* @return true if the command is logged, false otherwise
|
* @return true if the command is logged, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isLoggedCommand(String command) {
|
public static boolean isLoggedCommand(String command) {
|
||||||
return Config.loggedCommands.contains(command);
|
return Config.logged.contains(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -135,7 +135,7 @@ public final class Sentinel extends JavaPlugin {
|
|||||||
* @return true if the command is dangerous, false otherwise
|
* @return true if the command is dangerous, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isDangerousCommand(String command) {
|
public static boolean isDangerousCommand(String command) {
|
||||||
return Config.dangerousCommands.contains(command);
|
return Config.dangerous.contains(command);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns an instance of this plugin
|
* Returns an instance of this plugin
|
||||||
|
|||||||
@@ -4,10 +4,26 @@
|
|||||||
|
|
||||||
package io.github.thetrouper.sentinel.commands;
|
package io.github.thetrouper.sentinel.commands;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import io.github.thetrouper.sentinel.Sentinel;
|
||||||
|
import io.github.thetrouper.sentinel.server.util.FileUtils;
|
||||||
import io.github.thetrouper.sentinel.server.util.TextUtils;
|
import io.github.thetrouper.sentinel.server.util.TextUtils;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.block.CommandBlock;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.command.*;
|
import org.bukkit.command.*;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example command
|
* Example command
|
||||||
*/
|
*/
|
||||||
@@ -16,6 +32,7 @@ public class SentinelCommand extends CustomCommand {
|
|||||||
|
|
||||||
public SentinelCommand() {
|
public SentinelCommand() {
|
||||||
super("sentinel");
|
super("sentinel");
|
||||||
|
this.setPrintStacktrace(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -26,13 +43,12 @@ public class SentinelCommand extends CustomCommand {
|
|||||||
debugmode = !debugmode;
|
debugmode = !debugmode;
|
||||||
p.sendMessage(TextUtils.prefix(TextUtils.boolString(debugmode,"§aEnabled","§cDisabled") + "§7 debug mode."));
|
p.sendMessage(TextUtils.prefix(TextUtils.boolString(debugmode,"§aEnabled","§cDisabled") + "§7 debug mode."));
|
||||||
}
|
}
|
||||||
case "whitelistcommandblock" -> {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerCompletions(CompletionBuilder builder) {
|
public void registerCompletions(CompletionBuilder builder) {
|
||||||
builder.addCompletion(1,"debugmode");
|
builder.addCompletion(1,"debugmode");
|
||||||
|
builder.addCompletion(1,"whitelistcommandblock");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ public class SocialSpyCommand extends CustomCommand {
|
|||||||
if (!spyMap.containsKey(senderID) || !spyMap.get(senderID)) {
|
if (!spyMap.containsKey(senderID) || !spyMap.get(senderID)) {
|
||||||
sender.sendMessage(TextUtils.prefix("SocialSpy is now enabled."));
|
sender.sendMessage(TextUtils.prefix("SocialSpy is now enabled."));
|
||||||
spyMap.put(senderID,true);
|
spyMap.put(senderID,true);
|
||||||
}
|
} else if (spyMap.get(senderID)) {
|
||||||
if (spyMap.get(senderID)) {
|
|
||||||
sender.sendMessage(TextUtils.prefix("SocialSpy is now disabled."));
|
sender.sendMessage(TextUtils.prefix("SocialSpy is now disabled."));
|
||||||
spyMap.put(senderID,false);
|
spyMap.put(senderID,false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,25 +32,30 @@ public abstract class Config {
|
|||||||
}
|
}
|
||||||
public static String webhook;
|
public static String webhook;
|
||||||
public static List<String> trustedPlayers;
|
public static List<String> trustedPlayers;
|
||||||
public static boolean blockSpecificCommands;
|
public static boolean blockSpecific;
|
||||||
public static boolean preventNBT;
|
public static boolean preventNBT;
|
||||||
public static boolean logNBT;
|
public static boolean preventCmdBlockPlace;
|
||||||
public static boolean preventCmdBlocks;
|
public static boolean preventCmdBlockUse;
|
||||||
public static boolean logCmdBlocks;
|
public static boolean preventCmdBlockChange;
|
||||||
|
public static boolean preventCmdCartPlace;
|
||||||
|
public static boolean preventCmdCartUse;
|
||||||
public static boolean cmdBlockOpCheck;
|
public static boolean cmdBlockOpCheck;
|
||||||
public static List<String> dangerousCommands;
|
public static List<String> dangerous;
|
||||||
public static boolean logDangerousCommands;
|
public static boolean logDangerous;
|
||||||
public static List<String> loggedCommands;
|
public static boolean logCmdBlocks;
|
||||||
|
public static boolean logNBT;
|
||||||
public static boolean logSpecific;
|
public static boolean logSpecific;
|
||||||
|
public static List<String> logged;
|
||||||
public static boolean deop;
|
public static boolean deop;
|
||||||
public static boolean nbtPunish;
|
public static boolean nbtPunish;
|
||||||
|
public static boolean cmdBlockPunish;
|
||||||
public static boolean commandPunish;
|
public static boolean commandPunish;
|
||||||
public static boolean cmdblockPunish;
|
|
||||||
public static boolean specificPunish;
|
public static boolean specificPunish;
|
||||||
public static List<String> punishCommands;
|
public static List<String> punishCommands;
|
||||||
public static boolean reopCommand;
|
public static boolean reopCommand;
|
||||||
|
|
||||||
public static boolean blockUnicode;
|
// Chat Filter Setup & AntiSpam
|
||||||
|
public static boolean antiUnicode;
|
||||||
public static boolean antiSpamEnabled;
|
public static boolean antiSpamEnabled;
|
||||||
public static int defaultGain;
|
public static int defaultGain;
|
||||||
public static int lowGain;
|
public static int lowGain;
|
||||||
@@ -59,9 +64,9 @@ public abstract class Config {
|
|||||||
public static int heatDecay;
|
public static int heatDecay;
|
||||||
public static int blockHeat;
|
public static int blockHeat;
|
||||||
public static int punishHeat;
|
public static int punishHeat;
|
||||||
public static String punishSpamCommand;
|
|
||||||
public static String clearChatCommand;
|
|
||||||
public static boolean clearChat;
|
public static boolean clearChat;
|
||||||
|
public static String chatClearCommand;
|
||||||
|
public static String spamPunishCommand;
|
||||||
public static boolean logSpam;
|
public static boolean logSpam;
|
||||||
public static boolean antiSwearEnabled;
|
public static boolean antiSwearEnabled;
|
||||||
public static int lowScore;
|
public static int lowScore;
|
||||||
@@ -69,45 +74,47 @@ public abstract class Config {
|
|||||||
public static int mediumScore;
|
public static int mediumScore;
|
||||||
public static int mediumHighScore;
|
public static int mediumHighScore;
|
||||||
public static int highScore;
|
public static int highScore;
|
||||||
|
public static int scoreDecay;
|
||||||
public static int punishScore;
|
public static int punishScore;
|
||||||
|
public static boolean strictInstaPunish;
|
||||||
public static String swearPunishCommand;
|
public static String swearPunishCommand;
|
||||||
public static boolean slurInstaPunish;
|
public static String strictPunishCommand;
|
||||||
public static String slurPunishCommand;
|
public static boolean logSwear;
|
||||||
public static Integer scoreDecay;
|
|
||||||
public static List<String> swearWhitelist;
|
public static List<String> swearWhitelist;
|
||||||
public static List<String> swearBlacklist;
|
public static List<String> swearBlacklist;
|
||||||
public static List<String> slurs;
|
public static List<String> slurs;
|
||||||
public static Map<String, String> leetPatterns;
|
public static Map<String, String> leetPatterns;
|
||||||
public static boolean logSwear;
|
|
||||||
|
|
||||||
public static void loadConfiguration() {
|
public static void loadConfiguration() {
|
||||||
|
|
||||||
Sentinel.prefix = config.getString("config.plugin.prefix");
|
Sentinel.prefix = config.getString("config.plugin.prefix");
|
||||||
|
|
||||||
Sentinel.key = config.getString("config.plugin.key");
|
Sentinel.key = config.getString("config.plugin.key");
|
||||||
// antiNuke
|
|
||||||
webhook = config.getString("config.plugin.webhook");
|
webhook = config.getString("config.plugin.webhook");
|
||||||
trustedPlayers = config.getStringList("config.plugin.trusted");
|
trustedPlayers = config.getStringList("config.plugin.trusted");
|
||||||
blockSpecificCommands = config.getBoolean("config.plugin.block-specific");
|
blockSpecific = config.getBoolean("config.plugin.block-specific");
|
||||||
preventNBT = config.getBoolean("config.plugin.prevent-nbt");
|
preventNBT = config.getBoolean("config.plugin.prevent-nbt");
|
||||||
logNBT = config.getBoolean("config.plugin.log-nbt");
|
preventCmdBlockPlace = config.getBoolean("config.plugin.prevent-cmdblock-place");
|
||||||
preventCmdBlocks = config.getBoolean("config.plugin.prevent-cmdblocks");
|
preventCmdBlockUse = config.getBoolean("config.plugin.prevent-cmdblock-use");
|
||||||
logCmdBlocks = config.getBoolean("config.plugin.log-cmdblocks");
|
preventCmdBlockChange = config.getBoolean("config.plugin.prevent-cmdblock-change");
|
||||||
|
preventCmdCartPlace = config.getBoolean("config.plugin.prevent-cmdcart-place");
|
||||||
|
preventCmdCartUse = config.getBoolean("config.plugin.prevent-cmdcart-use");
|
||||||
cmdBlockOpCheck = config.getBoolean("config.plugin.cmdblock-op-check");
|
cmdBlockOpCheck = config.getBoolean("config.plugin.cmdblock-op-check");
|
||||||
|
dangerous = config.getStringList("config.plugin.dangerous");
|
||||||
|
logDangerous = config.getBoolean("config.plugin.log-dangerous");
|
||||||
|
logCmdBlocks = config.getBoolean("config.plugin.log-cmdblocks");
|
||||||
|
logNBT = config.getBoolean("config.plugin.log-nbt");
|
||||||
logSpecific = config.getBoolean("config.plugin.log-specific");
|
logSpecific = config.getBoolean("config.plugin.log-specific");
|
||||||
dangerousCommands = config.getStringList("config.plugin.dangerous");
|
logged = config.getStringList("config.plugin.logged");
|
||||||
logDangerousCommands = config.getBoolean("config.plugin.log-dangerous");
|
|
||||||
loggedCommands = config.getStringList("config.plugin.logged");
|
|
||||||
deop = config.getBoolean("config.plugin.deop");
|
deop = config.getBoolean("config.plugin.deop");
|
||||||
nbtPunish = config.getBoolean("config.plugin.nbt-punish");
|
nbtPunish = config.getBoolean("config.plugin.nbt-punish");
|
||||||
|
cmdBlockPunish = config.getBoolean("config.plugin.cmdblock-punish");
|
||||||
commandPunish = config.getBoolean("config.plugin.command-punish");
|
commandPunish = config.getBoolean("config.plugin.command-punish");
|
||||||
cmdblockPunish = config.getBoolean("config.plugin.cmdblock-punish");
|
specificPunish = config.getBoolean("config.plugin.specific-punish");
|
||||||
specificPunish = config.getBoolean("config.plugin.punish-specific");
|
|
||||||
punishCommands = config.getStringList("config.plugin.punish-commands");
|
punishCommands = config.getStringList("config.plugin.punish-commands");
|
||||||
reopCommand = config.getBoolean("config.plugin.reop-command");
|
reopCommand = config.getBoolean("config.plugin.reop-command");
|
||||||
// Chat
|
|
||||||
blockUnicode = config.getBoolean("config.chat.anti-unicode");
|
// Chat Filter Setup & AntiSpam
|
||||||
// antiSpam
|
antiUnicode = config.getBoolean("config.chat.anti-unicode");
|
||||||
antiSpamEnabled = config.getBoolean("config.chat.anti-spam.enabled");
|
antiSpamEnabled = config.getBoolean("config.chat.anti-spam.enabled");
|
||||||
defaultGain = config.getInt("config.chat.anti-spam.default-gain");
|
defaultGain = config.getInt("config.chat.anti-spam.default-gain");
|
||||||
lowGain = config.getInt("config.chat.anti-spam.low-gain");
|
lowGain = config.getInt("config.chat.anti-spam.low-gain");
|
||||||
@@ -116,22 +123,22 @@ public abstract class Config {
|
|||||||
heatDecay = config.getInt("config.chat.anti-spam.heat-decay");
|
heatDecay = config.getInt("config.chat.anti-spam.heat-decay");
|
||||||
blockHeat = config.getInt("config.chat.anti-spam.block-heat");
|
blockHeat = config.getInt("config.chat.anti-spam.block-heat");
|
||||||
punishHeat = config.getInt("config.chat.anti-spam.punish-heat");
|
punishHeat = config.getInt("config.chat.anti-spam.punish-heat");
|
||||||
punishSpamCommand = config.getString("config.chat.anti-spam.punish-command");
|
|
||||||
clearChat = config.getBoolean("config.chat.anti-spam.clear-chat");
|
clearChat = config.getBoolean("config.chat.anti-spam.clear-chat");
|
||||||
clearChatCommand = config.getString("config.chat.anti-spam.clear-chat-command");
|
chatClearCommand = config.getString("config.chat.anti-spam.chat-clear-command");
|
||||||
logSpam = config.getBoolean("config.chat.anti-swear.log-swear");
|
spamPunishCommand = config.getString("config.chat.anti-spam.punish-command");
|
||||||
// antiSwear
|
logSpam = config.getBoolean("config.chat.anti-spam.log-spam");
|
||||||
antiSwearEnabled = config.getBoolean("config.chat.anti-swear.enabled");
|
antiSwearEnabled = config.getBoolean("config.chat.anti-swear.enabled");
|
||||||
lowScore = config.getInt("config.chat.anti-swear.low-score");
|
lowScore = config.getInt("config.chat.anti-swear.low-score");
|
||||||
mediumLowScore = config.getInt("config.chat.anti-swear.medium-low-score");
|
mediumLowScore = config.getInt("config.chat.anti-swear.medium-low-score");
|
||||||
mediumScore = config.getInt("config.chat.anti-swear.medium-score");
|
mediumScore = config.getInt("config.chat.anti-swear.medium-score");
|
||||||
mediumHighScore = config.getInt("config.chat.anti-swear.medium-high-score");
|
mediumHighScore = config.getInt("config.chat.anti-swear.medium-high-score");
|
||||||
highScore = config.getInt("config.chat.anti-swear.high-score");
|
highScore = config.getInt("config.chat.anti-swear.high-score");
|
||||||
punishScore = config.getInt("config.chat.anti-swear.punish-score");
|
|
||||||
swearPunishCommand = config.getString("config.chat.anti-swear.punish-command");
|
|
||||||
slurInstaPunish = config.getBoolean("config.chat.anti-swear.strict-insta-punish");
|
|
||||||
slurPunishCommand = config.getString("config.chat.anti-swear.strict-command");
|
|
||||||
scoreDecay = config.getInt("config.chat.anti-swear.score-decay");
|
scoreDecay = config.getInt("config.chat.anti-swear.score-decay");
|
||||||
|
punishScore = config.getInt("config.chat.anti-swear.punish-score");
|
||||||
|
strictInstaPunish = config.getBoolean("config.chat.anti-swear.strict-insta-punish");
|
||||||
|
swearPunishCommand = config.getString("config.chat.anti-swear.punish-command");
|
||||||
|
strictPunishCommand = config.getString("config.chat.anti-swear.strict-command");
|
||||||
|
logSwear = config.getBoolean("config.chat.anti-swear.log-swear");
|
||||||
swearWhitelist = config.getStringList("config.chat.anti-swear.false-positives");
|
swearWhitelist = config.getStringList("config.chat.anti-swear.false-positives");
|
||||||
swearBlacklist = config.getStringList("config.chat.anti-swear.blacklisted");
|
swearBlacklist = config.getStringList("config.chat.anti-swear.blacklisted");
|
||||||
slurs = config.getStringList("config.chat.anti-swear.strict");
|
slurs = config.getStringList("config.chat.anti-swear.strict");
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class WebhookSender {
|
|||||||
Emojis.rightSort + "Player: " + player.getName() + " " + Emojis.target + "\\n" +
|
Emojis.rightSort + "Player: " + player.getName() + " " + Emojis.target + "\\n" +
|
||||||
Emojis.space + Emojis.arrowRight + "Heat: `" + finalHeat + "/" + Config.punishHeat + "`\\n" +
|
Emojis.space + Emojis.arrowRight + "Heat: `" + finalHeat + "/" + Config.punishHeat + "`\\n" +
|
||||||
Emojis.space + Emojis.arrowRight + "UUID: `" + player.getUniqueId() + "`\\n" +
|
Emojis.space + Emojis.arrowRight + "UUID: `" + player.getUniqueId() + "`\\n" +
|
||||||
Emojis.rightSort + "Executed: " + Config.punishSpamCommand + " " + Emojis.mute + "\\n" +
|
Emojis.rightSort + "Executed: " + Config.spamPunishCommand + " " + Emojis.mute + "\\n" +
|
||||||
Emojis.space + Emojis.arrowRight + "Chat Cleared: " + successOrFail(chatCleared) + "\\n"
|
Emojis.space + Emojis.arrowRight + "Chat Cleared: " + successOrFail(chatCleared) + "\\n"
|
||||||
)
|
)
|
||||||
.addField("Previous Message", "||" + message1 + "|| " + Emojis.activity, false)
|
.addField("Previous Message", "||" + message1 + "|| " + Emojis.activity, false)
|
||||||
@@ -107,7 +107,7 @@ public class WebhookSender {
|
|||||||
Emojis.rightSort + "Player: " + player.getName() + " " + Emojis.target + "\\n" +
|
Emojis.rightSort + "Player: " + player.getName() + " " + Emojis.target + "\\n" +
|
||||||
Emojis.space + Emojis.arrowRight + "Score: `" + finalScore + "/" + Config.punishScore + "`\\n" +
|
Emojis.space + Emojis.arrowRight + "Score: `" + finalScore + "/" + Config.punishScore + "`\\n" +
|
||||||
Emojis.space + Emojis.arrowRight + "UUID: `" + player.getUniqueId() + "`\\n" +
|
Emojis.space + Emojis.arrowRight + "UUID: `" + player.getUniqueId() + "`\\n" +
|
||||||
Emojis.rightSort + "Executed: " + Config.slurPunishCommand + " " + Emojis.mute + "\\n"
|
Emojis.rightSort + "Executed: " + Config.strictPunishCommand + " " + Emojis.mute + "\\n"
|
||||||
)
|
)
|
||||||
.addField("Original Message", "||" + message + "|| " + Emojis.alarm, false)
|
.addField("Original Message", "||" + message + "|| " + Emojis.alarm, false)
|
||||||
.addField("Sanitized Message", ProfanityFilter.highlightProfanity(message,"||", "||") + " " + Emojis.noDM, false)
|
.addField("Sanitized Message", ProfanityFilter.highlightProfanity(message,"||", "||") + " " + Emojis.noDM, false)
|
||||||
|
|||||||
@@ -1,16 +1,28 @@
|
|||||||
package io.github.thetrouper.sentinel.events;
|
package io.github.thetrouper.sentinel.events;
|
||||||
|
|
||||||
|
import io.github.thetrouper.sentinel.Sentinel;
|
||||||
|
import io.github.thetrouper.sentinel.commands.SentinelCommand;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.CommandBlock;
|
||||||
import org.bukkit.command.BlockCommandSender;
|
import org.bukkit.command.BlockCommandSender;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.server.ServerCommandEvent;
|
import org.bukkit.event.server.ServerCommandEvent;
|
||||||
|
import org.bukkit.inventory.meta.BlockDataMeta;
|
||||||
|
|
||||||
public class CMDBlockExecute implements Listener {
|
public class CMDBlockExecute implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onCMDBlockTick(ServerCommandEvent e) {
|
private void onCMDBlockTick(ServerCommandEvent e) {
|
||||||
if (e.getSender() instanceof BlockCommandSender) {
|
if (e.getSender() instanceof BlockCommandSender) {
|
||||||
|
if (!SentinelCommand.isCommandBlockWhitelisted((CommandBlock) e.getSender())) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
CommandBlock b = (CommandBlock) e.getSender();
|
||||||
|
Sentinel.log.info("A non whitelisted command block just attempted to execute a command! \n Command: "
|
||||||
|
+ e.getCommand() + "\n" + "Location: " + b.getLocation().getX() + " " + b.getLocation().getX() + " " + b.getLocation().getZ());
|
||||||
|
b.setType(Material.COMMAND_BLOCK);
|
||||||
|
b.setCommand(e.getCommand());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ package io.github.thetrouper.sentinel.events;
|
|||||||
|
|
||||||
import io.github.thetrouper.sentinel.Sentinel;
|
import io.github.thetrouper.sentinel.Sentinel;
|
||||||
import io.github.thetrouper.sentinel.data.Config;
|
import io.github.thetrouper.sentinel.data.Config;
|
||||||
import io.github.thetrouper.sentinel.server.TakeAction;
|
import io.github.thetrouper.sentinel.server.Action;
|
||||||
|
import io.github.thetrouper.sentinel.server.ActionType;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -13,14 +14,24 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
|||||||
public class CMDBlockPlace implements Listener {
|
public class CMDBlockPlace implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onCMDBlockPlace(BlockPlaceEvent e) {
|
private void onCMDBlockPlace(BlockPlaceEvent e) {
|
||||||
if (!Config.preventCmdBlocks) return;
|
if (!Config.preventCmdBlockPlace) return;
|
||||||
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||||
Block b = e.getBlockPlaced();
|
Block b = e.getBlockPlaced();
|
||||||
if (b.getType() == Material.COMMAND_BLOCK || b.getType() == Material.CHAIN_COMMAND_BLOCK || b.getType() == Material.REPEATING_COMMAND_BLOCK ) {
|
if (b.getType() == Material.COMMAND_BLOCK || b.getType() == Material.CHAIN_COMMAND_BLOCK || b.getType() == Material.REPEATING_COMMAND_BLOCK ) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
if (!Sentinel.isTrusted(p)) {
|
if (!Sentinel.isTrusted(p)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
TakeAction.placeBlock(e);
|
Action a = new Action.Builder()
|
||||||
|
.setAction(ActionType.PLACE_COMMAND_BLOCK)
|
||||||
|
.setEvent(e)
|
||||||
|
.setBlock(b)
|
||||||
|
.setPlayer(p)
|
||||||
|
.setDenied(true)
|
||||||
|
.setPunished(Config.cmdBlockPunish)
|
||||||
|
.setnotifyDiscord(Config.logCmdBlocks)
|
||||||
|
.setNotifyTrusted(true)
|
||||||
|
.setNotifyConsole(true)
|
||||||
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,28 @@
|
|||||||
package io.github.thetrouper.sentinel.events;
|
package io.github.thetrouper.sentinel.events;
|
||||||
|
|
||||||
import io.github.thetrouper.sentinel.Sentinel;
|
import io.github.thetrouper.sentinel.Sentinel;
|
||||||
|
import io.github.thetrouper.sentinel.commands.SentinelCommand;
|
||||||
import io.github.thetrouper.sentinel.data.Config;
|
import io.github.thetrouper.sentinel.data.Config;
|
||||||
import io.github.thetrouper.sentinel.server.TakeAction;
|
import io.github.thetrouper.sentinel.server.Action;
|
||||||
|
import io.github.thetrouper.sentinel.server.ActionType;
|
||||||
|
import io.github.thetrouper.sentinel.server.util.TextUtils;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.block.CommandBlock;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class CMDBlockUse implements Listener {
|
public class CMDBlockUse implements Listener {
|
||||||
|
@EventHandler
|
||||||
private void onCMDBlockUse(PlayerInteractEvent e) {
|
private void onCMDBlockUse(PlayerInteractEvent e) {
|
||||||
if (!Config.preventCmdBlocks) return;
|
if (!Config.preventCmdBlockUse) return;
|
||||||
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||||
if (e.getClickedBlock() == null) return;
|
if (e.getClickedBlock() == null) return;
|
||||||
Block b = e.getClickedBlock();
|
Block b = e.getClickedBlock();
|
||||||
@@ -19,7 +30,47 @@ public class CMDBlockUse implements Listener {
|
|||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
if (!Sentinel.isTrusted(p)) {
|
if (!Sentinel.isTrusted(p)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
TakeAction.useBlock(e);
|
Action a = new Action.Builder()
|
||||||
|
.setAction(ActionType.USE_COMMAND_BLOCK)
|
||||||
|
.setEvent(e)
|
||||||
|
.setBlock(b)
|
||||||
|
.setPlayer(p)
|
||||||
|
.setDenied(true)
|
||||||
|
.setPunished(Config.cmdBlockPunish)
|
||||||
|
.setnotifyDiscord(Config.logCmdBlocks)
|
||||||
|
.setNotifyTrusted(true)
|
||||||
|
.setNotifyConsole(true)
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
private void onCMDBlockChange(EntityChangeBlockEvent e) {
|
||||||
|
if (!(e.getEntity() instanceof Player p)) return;
|
||||||
|
if (!Config.preventCmdBlockUse) return;
|
||||||
|
if (Config.cmdBlockOpCheck && !p.isOp()) return;
|
||||||
|
Block b = e.getBlock();
|
||||||
|
if (b.getType() == Material.COMMAND_BLOCK || b.getType() == Material.REPEATING_COMMAND_BLOCK || b.getType() == Material.CHAIN_COMMAND_BLOCK) {
|
||||||
|
BlockState state = b.getState();
|
||||||
|
CommandBlock cb = (CommandBlock) state;
|
||||||
|
if (!Sentinel.isTrusted(p)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
Action a = new Action.Builder()
|
||||||
|
.setAction(ActionType.UPDATE_COMMAND_BLOCK)
|
||||||
|
.setEvent(e)
|
||||||
|
.setBlock(b)
|
||||||
|
.setCommand(cb.getCommand())
|
||||||
|
.setPlayer(p)
|
||||||
|
.setDenied(true)
|
||||||
|
.setPunished(Config.cmdBlockPunish)
|
||||||
|
.setnotifyDiscord(Config.logCmdBlocks)
|
||||||
|
.setNotifyTrusted(true)
|
||||||
|
.setNotifyConsole(true)
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
if (Sentinel.isTrusted(p)) {
|
||||||
|
Sentinel.log.info(p.getName() + "Updated command block: " + cb.getCommand());
|
||||||
|
SentinelCommand.updateWhitelistedCommandBlock(p,b, cb.getCommand());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,20 +2,19 @@ package io.github.thetrouper.sentinel.events;
|
|||||||
|
|
||||||
import io.github.thetrouper.sentinel.Sentinel;
|
import io.github.thetrouper.sentinel.Sentinel;
|
||||||
import io.github.thetrouper.sentinel.data.Config;
|
import io.github.thetrouper.sentinel.data.Config;
|
||||||
import io.github.thetrouper.sentinel.server.TakeAction;
|
import io.github.thetrouper.sentinel.server.Action;
|
||||||
|
import io.github.thetrouper.sentinel.server.ActionType;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
public class CMDMinecartPlace implements Listener {
|
public class CMDMinecartPlace implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onCMDMinecartPlace(PlayerInteractEvent e) {
|
private void onCMDMinecartPlace(PlayerInteractEvent e) {
|
||||||
if (!Config.preventCmdBlocks) {
|
if (!Config.preventCmdCartPlace) {
|
||||||
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||||
if (e.getItem() == null) return;
|
if (e.getItem() == null) return;
|
||||||
if (e.getClickedBlock() == null) return;
|
if (e.getClickedBlock() == null) return;
|
||||||
@@ -25,7 +24,18 @@ public class CMDMinecartPlace implements Listener {
|
|||||||
if (!Sentinel.isTrusted(p)) {
|
if (!Sentinel.isTrusted(p)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
p.getInventory().remove(Material.COMMAND_BLOCK_MINECART);
|
p.getInventory().remove(Material.COMMAND_BLOCK_MINECART);
|
||||||
TakeAction.useBlock(e);
|
Action a = new Action.Builder()
|
||||||
|
.setAction(ActionType.PLACE_MINECART_COMMAND)
|
||||||
|
.setEvent(e)
|
||||||
|
.setPlayer(p)
|
||||||
|
.setBlock(e.getClickedBlock())
|
||||||
|
.setDenied(Config.preventCmdCartPlace)
|
||||||
|
.setPunished(Config.cmdBlockPunish)
|
||||||
|
.setDeoped(Config.deop)
|
||||||
|
.setNotifyConsole(true)
|
||||||
|
.setNotifyTrusted(true)
|
||||||
|
.setnotifyDiscord(Config.logCmdBlocks)
|
||||||
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ package io.github.thetrouper.sentinel.events;
|
|||||||
|
|
||||||
import io.github.thetrouper.sentinel.Sentinel;
|
import io.github.thetrouper.sentinel.Sentinel;
|
||||||
import io.github.thetrouper.sentinel.data.Config;
|
import io.github.thetrouper.sentinel.data.Config;
|
||||||
import io.github.thetrouper.sentinel.server.TakeAction;
|
import io.github.thetrouper.sentinel.server.Action;
|
||||||
|
import io.github.thetrouper.sentinel.server.ActionType;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@@ -12,13 +13,22 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
|
|||||||
public class CMDMinecartUse implements Listener {
|
public class CMDMinecartUse implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onCMDBlockMinecartUse(PlayerInteractEntityEvent e) {
|
private void onCMDBlockMinecartUse(PlayerInteractEntityEvent e) {
|
||||||
if (!Config.preventCmdBlocks) return;
|
if (!Config.preventCmdCartUse) return;
|
||||||
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
if (Config.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
|
||||||
if (e.getRightClicked().getType() == EntityType.MINECART_COMMAND) {
|
if (e.getRightClicked().getType() == EntityType.MINECART_COMMAND) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
if (!Sentinel.isTrusted(p)) {
|
if (!Sentinel.isTrusted(p)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
TakeAction.useEntity(e);
|
Action a = new Action.Builder()
|
||||||
|
.setAction(ActionType.USE_MINECART_COMMAND)
|
||||||
|
.setEvent(e)
|
||||||
|
.setPlayer(p)
|
||||||
|
.setDenied(true)
|
||||||
|
.setPunished(Config.cmdBlockPunish)
|
||||||
|
.setnotifyDiscord(Config.logCmdBlocks)
|
||||||
|
.setNotifyTrusted(true)
|
||||||
|
.setNotifyConsole(true)
|
||||||
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ public class ChatEvent implements Listener {
|
|||||||
if (e.isCancelled()) return;
|
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.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);
|
if (!Sentinel.isTrusted(e.getPlayer()) || !e.getPlayer().hasPermission("sentinel.chat.antispam.bypass")) if (Config.antiSpamEnabled) AntiSpam.handleAntiSpam(e);
|
||||||
if (!Sentinel.isTrusted(e.getPlayer()) || !e.getPlayer().hasPermission("sentinel.chat.antiunicode.bypass")) if (Config.blockUnicode) AntiUnicode.handleAntiUnicode(e);
|
if (!Sentinel.isTrusted(e.getPlayer()) || !e.getPlayer().hasPermission("sentinel.chat.antiunicode.bypass")) if (Config.antiUnicode) AntiUnicode.handleAntiUnicode(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ package io.github.thetrouper.sentinel.events;
|
|||||||
|
|
||||||
import io.github.thetrouper.sentinel.Sentinel;
|
import io.github.thetrouper.sentinel.Sentinel;
|
||||||
import io.github.thetrouper.sentinel.data.Config;
|
import io.github.thetrouper.sentinel.data.Config;
|
||||||
import io.github.thetrouper.sentinel.server.TakeAction;
|
import io.github.thetrouper.sentinel.server.Action;
|
||||||
import io.github.thetrouper.sentinel.server.util.Notifications.NotifyConsole;
|
import io.github.thetrouper.sentinel.server.ActionType;
|
||||||
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.ServerUtils;
|
||||||
import io.github.thetrouper.sentinel.server.util.TextUtils;
|
import io.github.thetrouper.sentinel.server.util.TextUtils;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -25,22 +23,55 @@ public class CommandEvent implements Listener {
|
|||||||
if (!Sentinel.isTrusted(p)) {
|
if (!Sentinel.isTrusted(p)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
ServerUtils.sendDebugMessage(TextUtils.prefix("Command is canceled"));
|
ServerUtils.sendDebugMessage(TextUtils.prefix("Command is canceled"));
|
||||||
TakeAction.command(e);
|
Action a = new Action.Builder()
|
||||||
|
.setAction(ActionType.DANGEROUS_COMMAND)
|
||||||
|
.setEvent(e)
|
||||||
|
.setPlayer(p)
|
||||||
|
.setCommand(command)
|
||||||
|
.setDenied(true)
|
||||||
|
.setDeoped(Config.deop)
|
||||||
|
.setPunished(Config.commandPunish)
|
||||||
|
.setnotifyDiscord(Config.logDangerous)
|
||||||
|
.setNotifyConsole(true)
|
||||||
|
.setNotifyTrusted(true)
|
||||||
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Config.blockSpecificCommands) {
|
if (Config.blockSpecific) {
|
||||||
ServerUtils.sendDebugMessage(TextUtils.prefix("Checking command for specific"));
|
ServerUtils.sendDebugMessage(TextUtils.prefix("Checking command for specific"));
|
||||||
if (command.contains(":")) {
|
if (command.contains(":")) {
|
||||||
ServerUtils.sendDebugMessage(TextUtils.prefix("Checking is specific"));
|
ServerUtils.sendDebugMessage(TextUtils.prefix("Checking is specific"));
|
||||||
if (!Sentinel.isTrusted(p)) {
|
if (!Sentinel.isTrusted(p)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
ServerUtils.sendDebugMessage(TextUtils.prefix("Command is canceled"));
|
ServerUtils.sendDebugMessage(TextUtils.prefix("Command is canceled"));
|
||||||
TakeAction.specific(e);
|
Action a = new Action.Builder()
|
||||||
|
.setAction(ActionType.SPECIFIC_COMMAND)
|
||||||
|
.setEvent(e)
|
||||||
|
.setPlayer(p)
|
||||||
|
.setCommand(command)
|
||||||
|
.setDenied(true)
|
||||||
|
.setDeoped(Config.deop)
|
||||||
|
.setPunished(Config.specificPunish)
|
||||||
|
.setnotifyDiscord(Config.logSpecific)
|
||||||
|
.setNotifyConsole(true)
|
||||||
|
.setNotifyTrusted(true)
|
||||||
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Sentinel.isLoggedCommand(command)) {
|
if (Sentinel.isLoggedCommand(command)) {
|
||||||
TakeAction.logged(e);
|
Action a = new Action.Builder()
|
||||||
|
.setAction(ActionType.LOGGED_COMMAND)
|
||||||
|
.setEvent(e)
|
||||||
|
.setPlayer(p)
|
||||||
|
.setCommand(command)
|
||||||
|
.setDenied(false)
|
||||||
|
.setDeoped(false)
|
||||||
|
.setPunished(false)
|
||||||
|
.setnotifyDiscord(true)
|
||||||
|
.setNotifyConsole(true)
|
||||||
|
.setNotifyTrusted(true)
|
||||||
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
package io.github.thetrouper.sentinel.events;
|
package io.github.thetrouper.sentinel.events;
|
||||||
|
|
||||||
import io.github.thetrouper.sentinel.Sentinel;
|
import io.github.thetrouper.sentinel.Sentinel;
|
||||||
import io.github.thetrouper.sentinel.server.TakeAction;
|
import io.github.thetrouper.sentinel.data.Config;
|
||||||
|
import io.github.thetrouper.sentinel.server.Action;
|
||||||
|
import io.github.thetrouper.sentinel.server.ActionType;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@@ -11,6 +14,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
public class NBTEvents implements Listener {
|
public class NBTEvents implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onNBTPull(InventoryCreativeEvent e) {
|
private void onNBTPull(InventoryCreativeEvent e) {
|
||||||
|
if (Config.preventNBT) {
|
||||||
if (!(e.getWhoClicked() instanceof Player p)) {
|
if (!(e.getWhoClicked() instanceof Player p)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -19,8 +23,22 @@ public class NBTEvents implements Listener {
|
|||||||
if (!Sentinel.isTrusted(p)) {
|
if (!Sentinel.isTrusted(p)) {
|
||||||
if (e.getCursor().getItemMeta() == null) return;
|
if (e.getCursor().getItemMeta() == null) return;
|
||||||
if (i.hasItemMeta() && i.getItemMeta() != null) {
|
if (i.hasItemMeta() && i.getItemMeta() != null) {
|
||||||
TakeAction.NBT(e);
|
Action a = new Action.Builder()
|
||||||
|
.setEvent(e)
|
||||||
|
.setAction(ActionType.NBT)
|
||||||
|
.setPlayer(Bukkit.getPlayer(e.getWhoClicked().getName()))
|
||||||
|
.setItem(e.getCursor())
|
||||||
|
.setDenied(Config.preventNBT)
|
||||||
|
.setDeoped(Config.deop)
|
||||||
|
.setPunished(Config.nbtPunish)
|
||||||
|
.setRevertGM(Config.preventNBT)
|
||||||
|
.setNotifyConsole(true)
|
||||||
|
.setNotifyTrusted(true)
|
||||||
|
.setnotifyDiscord(Config.logNBT)
|
||||||
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
277
src/main/java/io/github/thetrouper/sentinel/server/Action.java
Normal file
277
src/main/java/io/github/thetrouper/sentinel/server/Action.java
Normal file
@@ -0,0 +1,277 @@
|
|||||||
|
package io.github.thetrouper.sentinel.server;
|
||||||
|
|
||||||
|
|
||||||
|
import io.github.thetrouper.sentinel.Sentinel;
|
||||||
|
import io.github.thetrouper.sentinel.data.Config;
|
||||||
|
import io.github.thetrouper.sentinel.data.Emojis;
|
||||||
|
import io.github.thetrouper.sentinel.discord.DiscordWebhook;
|
||||||
|
import io.github.thetrouper.sentinel.server.util.FileUtils;
|
||||||
|
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
||||||
|
import io.github.thetrouper.sentinel.server.util.TextUtils;
|
||||||
|
import net.md_5.bungee.api.chat.HoverEvent;
|
||||||
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
import net.md_5.bungee.api.chat.hover.content.Text;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Action {
|
||||||
|
private Cancellable event;
|
||||||
|
private ActionType action;
|
||||||
|
private Player player;
|
||||||
|
private String command;
|
||||||
|
private String loggedCommand;
|
||||||
|
private ItemStack item;
|
||||||
|
private Block block;
|
||||||
|
private boolean denied;
|
||||||
|
private boolean deoped;
|
||||||
|
private boolean punished;
|
||||||
|
private boolean revertGM;
|
||||||
|
private boolean notifyDiscord;
|
||||||
|
private boolean notifyTrusted;
|
||||||
|
private boolean notifyConsole;
|
||||||
|
|
||||||
|
private Action(Cancellable event, ActionType action, Player player, String command, String loggedCommand, ItemStack item, Block block,boolean denied, boolean deoped, boolean punished, boolean revertedGM, boolean notifyDiscord, boolean notifyTrusted, boolean notifyConsole) {
|
||||||
|
this.event = event;
|
||||||
|
this.action = action;
|
||||||
|
this.player = player;
|
||||||
|
this.command = command;
|
||||||
|
this.loggedCommand = loggedCommand;
|
||||||
|
this.item = item;
|
||||||
|
this.block = block;
|
||||||
|
this.denied = denied;
|
||||||
|
this.deoped = deoped;
|
||||||
|
this.punished = punished;
|
||||||
|
this.revertGM = revertedGM;
|
||||||
|
this.notifyDiscord = notifyDiscord;
|
||||||
|
this.notifyTrusted = notifyTrusted;
|
||||||
|
this.notifyConsole = notifyConsole;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
Cancellable event;
|
||||||
|
ActionType action;
|
||||||
|
private Player player;
|
||||||
|
private String command;
|
||||||
|
private String loggedCommand;
|
||||||
|
private ItemStack item;
|
||||||
|
private Block block;
|
||||||
|
private boolean denied;
|
||||||
|
private boolean deoped;
|
||||||
|
private boolean punished;
|
||||||
|
private boolean revertGM;
|
||||||
|
private boolean notifyDiscord;
|
||||||
|
private boolean notifyTrusted;
|
||||||
|
private boolean notifyConsole;
|
||||||
|
public Builder setEvent(Cancellable event) {
|
||||||
|
this.event = event;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Builder setAction(ActionType action) {
|
||||||
|
this.action = action;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Builder setPlayer(Player player) {
|
||||||
|
this.player = player;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Builder setCommand(String command) {
|
||||||
|
this.command = command;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Builder setLoggedCommand(String loggedCommand) {
|
||||||
|
this.loggedCommand = loggedCommand;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Builder setItem(ItemStack item) {
|
||||||
|
this.item = item;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Builder setBlock(Block block){
|
||||||
|
this.block = block;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Builder setDenied(boolean denied) {
|
||||||
|
this.denied = denied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Builder setDeoped(boolean deoped) {
|
||||||
|
this.deoped = deoped;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Builder setPunished(boolean punished) {
|
||||||
|
this.punished = punished;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Builder setRevertGM(boolean revertGM) {
|
||||||
|
this.revertGM = revertGM;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Builder setnotifyDiscord(boolean notifyDiscord) {
|
||||||
|
this.notifyDiscord= notifyDiscord;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Builder setNotifyTrusted(boolean notifyTrusted) {
|
||||||
|
this.notifyTrusted = notifyTrusted;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Builder setNotifyConsole(boolean notifyConsole) {
|
||||||
|
this.notifyConsole = notifyConsole;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Action execute() {
|
||||||
|
String actionTop = "Generic Anti-Action has been triggered";
|
||||||
|
String actionTitle = "A generic action has been detected!";
|
||||||
|
String itemLog = "";
|
||||||
|
String commandLog = "";
|
||||||
|
actionTop = action.getMessageTop();
|
||||||
|
actionTitle = action.getMessageTitle();
|
||||||
|
final List<String> punishCommands = Config.getPunishCommands();
|
||||||
|
if (denied) event.setCancelled(true);
|
||||||
|
if (deoped) player.setOp(false);
|
||||||
|
if (punished) for (String command : punishCommands) {
|
||||||
|
ServerUtils.sendCommand(command);
|
||||||
|
}
|
||||||
|
if (revertGM) player.setGameMode(GameMode.SURVIVAL);
|
||||||
|
if (item != null) itemLog = FileUtils.createNBTLog(item.getItemMeta().getAsString());
|
||||||
|
if (loggedCommand != null) commandLog = FileUtils.createCommandLog(loggedCommand);
|
||||||
|
if (notifyConsole) {
|
||||||
|
String conNotif = "]=- Sentinel -=[";
|
||||||
|
conNotif += " " + actionTop;
|
||||||
|
conNotif += "\n" + actionTitle + "\n";
|
||||||
|
if (player != null) {
|
||||||
|
conNotif += "Player: " + player.getName() + "\n";
|
||||||
|
}
|
||||||
|
if (command != null) {
|
||||||
|
if (loggedCommand != null) {
|
||||||
|
if (loggedCommand.length() > 128) {
|
||||||
|
conNotif += "Command: Too long to show here!" + "\n";
|
||||||
|
conNotif += " | Saved to file: " + commandLog + "\n";
|
||||||
|
} else {
|
||||||
|
conNotif += "Command: " + command + "\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
conNotif += "Command: " + command + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item != null) {
|
||||||
|
conNotif += "Item: /Sentinel/LoggedNBT/" + itemLog + "\n";
|
||||||
|
}
|
||||||
|
if (block != null) {
|
||||||
|
Location loc = block.getLocation();
|
||||||
|
conNotif += "Block: " + block.getType().toString().toLowerCase().replace("_", " ") + "\n";
|
||||||
|
conNotif += "Location: " + loc.getX() + " " + loc.getY() + " " + loc.getZ() + "\n";
|
||||||
|
}
|
||||||
|
conNotif += "Denied: " + (denied ? "\u2714" : "\u2718") + "\n";
|
||||||
|
if (deoped) {
|
||||||
|
player.setOp(false);
|
||||||
|
}
|
||||||
|
conNotif += "Deoped: " + (deoped ? "\u2714" : "\u2718") + "\n";
|
||||||
|
|
||||||
|
conNotif += "Punished: " + (punished ? "\u2714" : "\u2718") + "\n";
|
||||||
|
if (revertGM) conNotif += "RevertGM: " + "\u2714" + "\n";
|
||||||
|
conNotif += "Logged: " + (notifyDiscord ? "\u2714" : "\u2718");
|
||||||
|
Sentinel.log.info(conNotif);
|
||||||
|
}
|
||||||
|
if (notifyTrusted) {
|
||||||
|
TextComponent notification = new TextComponent();
|
||||||
|
notification.setText(TextUtils.prefix(" " + actionTop));
|
||||||
|
String body = "]=- Sentinel -=[ ";
|
||||||
|
body += "\n" + actionTitle + "\n";
|
||||||
|
if (player != null) {
|
||||||
|
body += "Player: " + player.getName() + "\n";
|
||||||
|
}
|
||||||
|
if (command != null) {
|
||||||
|
if (loggedCommand != null) {
|
||||||
|
if (loggedCommand.length() > 64) {
|
||||||
|
body += "Command: Too long to show here!" + "\n";
|
||||||
|
body += " | Saved to file: " + commandLog + "\n";
|
||||||
|
} else {
|
||||||
|
body += "Command: " + command + "\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
body += "Command: " + command + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (item != null) {
|
||||||
|
body += "Item: /Sentinel/LoggedNBT/" + itemLog + "\n";
|
||||||
|
}
|
||||||
|
if (block != null) {
|
||||||
|
Location loc = block.getLocation();
|
||||||
|
body += "Block: " + block.getType().toString().toLowerCase().replace("_", " ") + "\n";
|
||||||
|
body += "Location: " + loc.getX() + " " + loc.getY() + " " + loc.getZ() + "\n";
|
||||||
|
}
|
||||||
|
body += "Denied: " + (denied ? "§a\u2714" : "§c\u2718") + "\n";
|
||||||
|
if (deoped) {
|
||||||
|
player.setOp(false);
|
||||||
|
}
|
||||||
|
body += "Deoped: " + (deoped ? "§a\u2714" : "§c\u2718") + "\n";
|
||||||
|
|
||||||
|
body += "Punished: " + (punished ? "§a\u2714" : "§c\u2718") + "\n";
|
||||||
|
if (revertGM) body += "RevertGM: " + "§a\u2714" + "\n";
|
||||||
|
body += "Logged: " + (notifyDiscord ? "§a\u2714" : "§c\u2718");
|
||||||
|
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(body)));
|
||||||
|
ServerUtils.forEachPlayer(trusted -> {
|
||||||
|
if (Sentinel.isTrusted(trusted)) {
|
||||||
|
trusted.spigot().sendMessage(notification);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (notifyDiscord) {
|
||||||
|
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");
|
||||||
|
String description = "";
|
||||||
|
if (player != null) description += Emojis.rightSort + " **Player:** " + player.getName() + " " + Emojis.member + "\\n";
|
||||||
|
if (command != null) {
|
||||||
|
if (loggedCommand != null) {
|
||||||
|
if (loggedCommand.length() > 128) {
|
||||||
|
description += Emojis.rightSort + " **Command:** Too long to show here!" + " " + Emojis.nuke + "\\n";
|
||||||
|
description += Emojis.space + Emojis.rightDoubleArrow + " | Saved to file: " + commandLog + "\n";
|
||||||
|
} else {
|
||||||
|
description += Emojis.rightSort + " **Command:** " + command + " " + Emojis.nuke + "\\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
description += Emojis.rightSort + " **Command:** " + command + " " + Emojis.nuke + "\\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (item != null) description += Emojis.rightSort + " **Item:** " + item.getType().toString().toLowerCase() + " " + Emojis.nuke + "\\n" +
|
||||||
|
Emojis.space + Emojis.rightDoubleArrow + "**NBT:** Uploaded to /Sentinel/LoggedNBT/" + itemLog;
|
||||||
|
if (block != null) {
|
||||||
|
description += Emojis.rightSort + " **Block:** " + block.getType().toString().toLowerCase() + " " + Emojis.nuke + "\\n" +
|
||||||
|
Emojis.space + Emojis.rightDoubleArrow + " **Location:** X: " + block.getX() + " Y: " + block.getY() + " Z: " + block.getZ() + "\\n";
|
||||||
|
}
|
||||||
|
String actions = "";
|
||||||
|
actions += Emojis.rightSort + " **Denied:** " + TextUtils.boolString(denied,Emojis.success, Emojis.failure) + "\\n";
|
||||||
|
actions += Emojis.rightSort + " **De-oped:** " + TextUtils.boolString(deoped,Emojis.success, Emojis.failure) + "\\n";
|
||||||
|
actions += Emojis.rightSort + " **Punished:** " + TextUtils.boolString(punished,Emojis.success, Emojis.failure) + "\\n";
|
||||||
|
if (revertGM) actions += Emojis.rightSort + " **GM Reverted:** " + Emojis.success + "\\n";
|
||||||
|
actions += Emojis.rightSort + " **Logged:** " + Emojis.success;
|
||||||
|
DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject()
|
||||||
|
.setAuthor(actionTop,"","")
|
||||||
|
.setTitle(actionTitle)
|
||||||
|
.setDescription(description)
|
||||||
|
.addField("Actions:",actions, false)
|
||||||
|
.setThumbnail("https://crafatar.com/avatars/" + player.getUniqueId() + "?size=64&&overlay")
|
||||||
|
.setColor(action.getEmbedColor());
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Action(event, action, player, command, loggedCommand, item, block, denied, deoped, punished, revertGM, notifyDiscord, notifyTrusted, notifyConsole);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package io.github.thetrouper.sentinel.server;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public enum ActionType {
|
||||||
|
SPECIFIC_COMMAND("Anti-Specific has been triggered","The use of a specific command has been detected!", Color.green),
|
||||||
|
LOGGED_COMMAND("General command log","A logged command has been executed.", Color.green),
|
||||||
|
DANGEROUS_COMMAND("Anti-Nuke has been triggered","The use of a dangerous command has been detected!", Color.red),
|
||||||
|
NBT("Anti-NBT has been triggered", "An NBT item has been caught!", Color.orange),
|
||||||
|
PLACE_COMMAND_BLOCK("Anti-Nuke has been triggered","The placing of a command block has been detected!", Color.orange),
|
||||||
|
USE_COMMAND_BLOCK("Anti-Nuke has been triggered","The use of a command block has been detected!", Color.red),
|
||||||
|
UPDATE_COMMAND_BLOCK("HoneyPot log","Caught a command block command!", Color.yellow),
|
||||||
|
PLACE_MINECART_COMMAND("Anti-Nuke has been triggered","The placing of a minecart command has been detected!", Color.red),
|
||||||
|
USE_MINECART_COMMAND("Anti-Nuke has been triggered", "The use of a command block has been detected!", Color.red),
|
||||||
|
UPDATE_MINECART_COMMAND("HoneyPot log","Caught a command block command!", Color.orange);
|
||||||
|
private final String messageTop;
|
||||||
|
private final String messageTitle;
|
||||||
|
private final Color embedColor;
|
||||||
|
|
||||||
|
ActionType(String messagetop, String messageTitle, Color embedColor) {
|
||||||
|
this.messageTop = messagetop;
|
||||||
|
this.messageTitle = messageTitle;
|
||||||
|
this.embedColor = embedColor;
|
||||||
|
}
|
||||||
|
public String getMessageTop() {
|
||||||
|
return messageTop;
|
||||||
|
}
|
||||||
|
public String getMessageTitle() {
|
||||||
|
return messageTitle;
|
||||||
|
}
|
||||||
|
public Color getEmbedColor() {
|
||||||
|
return embedColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,250 +0,0 @@
|
|||||||
package io.github.thetrouper.sentinel.server;
|
|
||||||
|
|
||||||
import io.github.thetrouper.sentinel.Sentinel;
|
|
||||||
import io.github.thetrouper.sentinel.data.Config;
|
|
||||||
import io.github.thetrouper.sentinel.server.util.FileUtils;
|
|
||||||
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;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryCreativeEvent;
|
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class TakeAction {
|
|
||||||
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.logSpecific) {
|
|
||||||
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 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);
|
|
||||||
denied = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Config.deop) {
|
|
||||||
e.getPlayer().setOp(false);
|
|
||||||
deoped = 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,punished,true);
|
|
||||||
}
|
|
||||||
NotifyConsole.command(e.getPlayer(),message,denied,deoped,punished,logged);
|
|
||||||
NotifyTrusted.command(e.getPlayer(),message,denied,deoped,punished,logged);
|
|
||||||
}
|
|
||||||
public static void logged(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.isLoggedCommand(command)) {
|
|
||||||
NotifyDiscord.logged(e.getPlayer(),message,denied,deoped,punished,true);
|
|
||||||
NotifyConsole.logged(e.getPlayer(),message,denied,deoped,punished,logged);
|
|
||||||
NotifyTrusted.logged(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 punished = false;
|
|
||||||
boolean logged = false;
|
|
||||||
boolean gms = false;
|
|
||||||
if (Config.preventNBT) {
|
|
||||||
e.setCancelled(true);
|
|
||||||
Bukkit.getScheduler().runTaskLater(Sentinel.getInstance(),() -> {
|
|
||||||
e.getCursor().setType(Material.AIR);
|
|
||||||
}, 1);
|
|
||||||
p.setGameMode(GameMode.SURVIVAL);
|
|
||||||
gms = true;
|
|
||||||
removed = true;
|
|
||||||
}
|
|
||||||
if (Config.deop) {
|
|
||||||
p.setOp(false);
|
|
||||||
deoped = 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,punished, true,FileUtils.createNBTLog(item.getType().toString().toLowerCase() + item.getItemMeta().getAsString()));
|
|
||||||
}
|
|
||||||
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 punished = false;
|
|
||||||
boolean logged = false;
|
|
||||||
if (Config.preventCmdBlocks) {
|
|
||||||
e.setCancelled(true);
|
|
||||||
p.getInventory().remove(Material.COMMAND_BLOCK);
|
|
||||||
p.getInventory().remove(Material.REPEATING_COMMAND_BLOCK);
|
|
||||||
p.getInventory().remove(Material.CHAIN_COMMAND_BLOCK);
|
|
||||||
deleted = true;
|
|
||||||
}
|
|
||||||
if (Config.deop) {
|
|
||||||
p.setOp(false);
|
|
||||||
deoped = 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,punished,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;
|
|
||||||
Player p = e.getPlayer();
|
|
||||||
Block b = e.getClickedBlock();
|
|
||||||
boolean denied = false;
|
|
||||||
boolean deoped = false;
|
|
||||||
boolean punished = false;
|
|
||||||
boolean logged = false;
|
|
||||||
if (Config.preventCmdBlocks) {
|
|
||||||
e.setCancelled(true);
|
|
||||||
denied = true;
|
|
||||||
}
|
|
||||||
if (Config.deop) {
|
|
||||||
p.setOp(false);
|
|
||||||
deoped = 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,punished,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;
|
|
||||||
Player p = e.getPlayer();
|
|
||||||
Entity ent = e.getRightClicked();
|
|
||||||
boolean denied = false;
|
|
||||||
boolean deoped = false;
|
|
||||||
boolean punished = false;
|
|
||||||
boolean logged = false;
|
|
||||||
if (Config.preventCmdBlocks) {
|
|
||||||
e.setCancelled(true);
|
|
||||||
denied = true;
|
|
||||||
}
|
|
||||||
if (Config.deop) {
|
|
||||||
p.setOp(false);
|
|
||||||
deoped = 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,punished,logged);
|
|
||||||
}
|
|
||||||
NotifyConsole.usedEntity(p,ent,denied,deoped,punished,logged);
|
|
||||||
NotifyTrusted.usedEntity(p,ent,denied,deoped,punished,logged);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -78,10 +78,10 @@ public class AntiSpam {
|
|||||||
public static void punishSpam(Player player, String message1, String message2) {
|
public static void punishSpam(Player player, String message1, String message2) {
|
||||||
boolean chatCleared = false;
|
boolean chatCleared = false;
|
||||||
if (Config.clearChat) {
|
if (Config.clearChat) {
|
||||||
ServerUtils.sendCommand(Config.clearChatCommand);
|
ServerUtils.sendCommand(Config.chatClearCommand);
|
||||||
chatCleared = true;
|
chatCleared = true;
|
||||||
}
|
}
|
||||||
ServerUtils.sendCommand(Config.punishSpamCommand.replace("%player%", player.getName()));
|
ServerUtils.sendCommand(Config.spamPunishCommand.replace("%player%", player.getName()));
|
||||||
player.sendMessage(TextUtils.prefix("§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();
|
TextComponent text = new TextComponent();
|
||||||
text.setText(TextUtils.prefix(
|
text.setText(TextUtils.prefix(
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ public class ProfanityFilter {
|
|||||||
if (Config.logSwear) WebhookSender.sendSwearLog(player,origMessage,scoreMap.get(player));
|
if (Config.logSwear) WebhookSender.sendSwearLog(player,origMessage,scoreMap.get(player));
|
||||||
}
|
}
|
||||||
public static void punishSlur(Player player, String highlightedMSG, String origMessage) {
|
public static void punishSlur(Player player, String highlightedMSG, String origMessage) {
|
||||||
if (!Config.slurInstaPunish) return;
|
if (!Config.strictInstaPunish) return;
|
||||||
ServerUtils.sendCommand(Config.slurPunishCommand.replace("%player%", player.getName()));
|
ServerUtils.sendCommand(Config.strictPunishCommand.replace("%player%", player.getName()));
|
||||||
player.sendMessage(TextUtils.prefix(("§cYou have been insta-muted for saying a slur!")));
|
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)");
|
String hover = ("§bOriginal: §f" + origMessage + "\n§bSanitized: §f" + highlightedMSG + "\n§7§o(click to copy)");
|
||||||
TextComponent text = new TextComponent();
|
TextComponent text = new TextComponent();
|
||||||
@@ -167,7 +167,8 @@ public class ProfanityFilter {
|
|||||||
public static String checkSeverity(String text) {
|
public static String checkSeverity(String text) {
|
||||||
// 1:
|
// 1:
|
||||||
String lowercasedText = text.toLowerCase();
|
String lowercasedText = text.toLowerCase();
|
||||||
|
// 1.5:
|
||||||
|
String nonEnglish =
|
||||||
// 2:
|
// 2:
|
||||||
String cleanedText = removeFalsePositives(lowercasedText);
|
String cleanedText = removeFalsePositives(lowercasedText);
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,33 @@
|
|||||||
package io.github.thetrouper.sentinel.server.util;
|
package io.github.thetrouper.sentinel.server.util;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import io.github.thetrouper.sentinel.Sentinel;
|
import io.github.thetrouper.sentinel.Sentinel;
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.*;
|
||||||
import java.io.File;
|
import java.time.*;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.*;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.UUID;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.UUID;
|
||||||
|
import org.bukkit.Location;
|
||||||
public class FileUtils {
|
public class FileUtils {
|
||||||
public static boolean folderExists(String folderName) {
|
public static boolean folderExists(String folderName) {
|
||||||
File folder = new File(Sentinel.getDF(), folderName);
|
File folder = new File(Sentinel.getDF(), folderName);
|
||||||
@@ -37,4 +56,22 @@ public class FileUtils {
|
|||||||
}
|
}
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String createCommandLog(String command) {
|
||||||
|
String fileName = "command_log-" + Randomizer.generateID();
|
||||||
|
File file = new File(Sentinel.getDF() + "/LoggedCommands/" + fileName + ".txt");
|
||||||
|
try {
|
||||||
|
if (!file.exists()) {
|
||||||
|
file.createNewFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferedWriter writer = new BufferedWriter(new FileWriter(file, true));
|
||||||
|
writer.append(command);
|
||||||
|
writer.close();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,104 +0,0 @@
|
|||||||
package io.github.thetrouper.sentinel.server.util.Notifications;
|
|
||||||
|
|
||||||
import io.github.thetrouper.sentinel.Sentinel;
|
|
||||||
import io.github.thetrouper.sentinel.server.util.TextUtils;
|
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import net.md_5.bungee.api.chat.hover.content.Text;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class NotifyConsole {
|
|
||||||
public static void specific(Player p, String command, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
|
||||||
final String log = (
|
|
||||||
"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,"\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 logged(Player p, String command, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
|
||||||
final String log = (
|
|
||||||
"A logged command has been executed. \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 NBT(Player p, ItemStack item, boolean removed, boolean deoped, boolean gms, boolean punished, boolean logged) {
|
|
||||||
String log = (
|
|
||||||
"Sentinel caught a dangerous NBT! \n]==-- Sentinel --==[" +
|
|
||||||
"\nPlayer: " + p.getName() +
|
|
||||||
"\nItemType: " + item.getType() +
|
|
||||||
"\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 punished, boolean logged) {
|
|
||||||
String log = (
|
|
||||||
"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,"\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 punished, boolean logged) {
|
|
||||||
String log = (
|
|
||||||
"]==-- Sentinel --==[" +
|
|
||||||
"\nPlayer: " + p.getName() +
|
|
||||||
"\nBlockType: " + b.getType() +
|
|
||||||
"\nLocation: " + b.getX() + " " + b.getY() + " " + b.getZ() +
|
|
||||||
"\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 punished, boolean logged) {
|
|
||||||
String log = (
|
|
||||||
"]==-- Sentinel --==[" +
|
|
||||||
"\nPlayer: " + p.getName() +
|
|
||||||
"\nEntityType: " + e.getType() +
|
|
||||||
"\nLocation: " + e.getLocation().getX() + " " + e.getLocation().getY() + " " + e.getLocation().getZ() +
|
|
||||||
"\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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,225 +0,0 @@
|
|||||||
package io.github.thetrouper.sentinel.server.util.Notifications;
|
|
||||||
|
|
||||||
import io.github.thetrouper.sentinel.Sentinel;
|
|
||||||
import io.github.thetrouper.sentinel.data.Config;
|
|
||||||
import io.github.thetrouper.sentinel.data.Emojis;
|
|
||||||
import io.github.thetrouper.sentinel.discord.DiscordWebhook;
|
|
||||||
import io.github.thetrouper.sentinel.server.util.FileUtils;
|
|
||||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
|
||||||
import io.github.thetrouper.sentinel.server.util.TextUtils;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class NotifyDiscord {
|
|
||||||
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");
|
|
||||||
webhook.setUsername("Sentinel Anti-Nuke | Logs");
|
|
||||||
DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject()
|
|
||||||
.setAuthor("Anti-Nuke has been triggered","","")
|
|
||||||
.setTitle("The use of a dangerous 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 logged(Player player, String command, boolean denied, boolean deoped, boolean punished, boolean logged) {
|
|
||||||
ServerUtils.sendDebugMessage("Creating logged 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("Sentinel Logged Commands","","")
|
|
||||||
.setTitle("General Command Log")
|
|
||||||
.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 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);
|
|
||||||
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 dangerous item has been detected!")
|
|
||||||
.setDescription(
|
|
||||||
Emojis.rightSort + " **Player:** " + player.getName() + " " + Emojis.member + "\\n" +
|
|
||||||
Emojis.rightSort + " **Item:** " + item.getType().toString().toLowerCase() + " " + Emojis.nuke + "\\n" +
|
|
||||||
Emojis.space + Emojis.rightDoubleArrow + "**NBT:** Uploaded to /Sentinel/LoggedNBT/" + logFileName
|
|
||||||
)
|
|
||||||
.addField("Actions:",
|
|
||||||
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 + " **Punished:** " + TextUtils.boolString(punished,Emojis.success, Emojis.failure) + "\\n"+
|
|
||||||
Emojis.rightSort + " **Logged:** " + TextUtils.boolString(logged,Emojis.success, Emojis.failure), false
|
|
||||||
)
|
|
||||||
.setColor(Color.BLUE);
|
|
||||||
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 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");
|
|
||||||
webhook.setUsername("Sentinel Anti-Nuke | Logs");
|
|
||||||
DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject()
|
|
||||||
.setAuthor("Anti-Nuke has been triggered","","")
|
|
||||||
.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.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 + " **Punished:** " + TextUtils.boolString(punished,Emojis.success, Emojis.failure) + "\\n"+
|
|
||||||
Emojis.rightSort + " **Logged:** " + TextUtils.boolString(logged,Emojis.success, Emojis.failure), false
|
|
||||||
)
|
|
||||||
.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 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");
|
|
||||||
webhook.setUsername("Sentinel Anti-Nuke | Logs");
|
|
||||||
DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject()
|
|
||||||
.setAuthor("Anti-Nuke has been triggered","","")
|
|
||||||
.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.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 + " **Punished:** " + TextUtils.boolString(punished,Emojis.success, Emojis.failure) + "\\n"+
|
|
||||||
Emojis.rightSort + " **Logged:** " + TextUtils.boolString(logged,Emojis.success, Emojis.failure), false
|
|
||||||
)
|
|
||||||
.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 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");
|
|
||||||
webhook.setUsername("Sentinel Anti-Nuke | Logs");
|
|
||||||
DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject()
|
|
||||||
.setAuthor("Anti-Nuke has been triggered","","")
|
|
||||||
.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.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 + " **Punished:** " + TextUtils.boolString(punished,Emojis.success, Emojis.failure) + "\\n"+
|
|
||||||
Emojis.rightSort + " **Logged:** " + TextUtils.boolString(logged,Emojis.success, Emojis.failure), false
|
|
||||||
)
|
|
||||||
.setColor(Color.RED);
|
|
||||||
webhook.addEmbed(embed);
|
|
||||||
try {
|
|
||||||
ServerUtils.sendDebugMessage("Executing webhook...");
|
|
||||||
webhook.execute();
|
|
||||||
} catch (IOException ex) {
|
|
||||||
ServerUtils.sendDebugMessage(TextUtils.prefix("Epic webhook failure!!!"));
|
|
||||||
Sentinel.log.info(ex.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
package io.github.thetrouper.sentinel.server.util.Notifications;
|
|
||||||
|
|
||||||
import io.github.thetrouper.sentinel.Sentinel;
|
|
||||||
import io.github.thetrouper.sentinel.server.util.ServerUtils;
|
|
||||||
import io.github.thetrouper.sentinel.server.util.TextUtils;
|
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import net.md_5.bungee.api.chat.hover.content.Text;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.server.ServerEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class NotifyTrusted {
|
|
||||||
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(
|
|
||||||
"§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()) {
|
|
||||||
if (Sentinel.isTrusted(trustedPlayer)) {
|
|
||||||
trustedPlayer.spigot().sendMessage(notification);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static void logged(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 executed a logged 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()) {
|
|
||||||
if (Sentinel.isTrusted(trustedPlayer)) {
|
|
||||||
trustedPlayer.spigot().sendMessage(notification);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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(
|
|
||||||
"§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)) {
|
|
||||||
trustedPlayer.spigot().sendMessage(notification);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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)) {
|
|
||||||
trustedPlayer.spigot().sendMessage(notification);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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)) {
|
|
||||||
trustedPlayer.spigot().sendMessage(notification);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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)) {
|
|
||||||
trustedPlayer.spigot().sendMessage(notification);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,11 +17,15 @@ config:
|
|||||||
# --------------------------------
|
# --------------------------------
|
||||||
prefix: "§d§lSentinel §8» §7" # Prefix of the plugin. Line below is the discord webhook for logs to be sent to
|
prefix: "§d§lSentinel §8» §7" # Prefix of the plugin. Line below is the discord webhook for logs to be sent to
|
||||||
webhook: "https://discord.com/api/webhooks/id/token"
|
webhook: "https://discord.com/api/webhooks/id/token"
|
||||||
trusted: # List the UUIDs of players who are trusted, will bypass the plugin and be immune to logs and are able to re-op themeselves
|
trusted: # List the UUIDs of players who are trusted, will bypass the plugin and be immune to logs and are able to re-op themeselves, as well as whitelist command blocks
|
||||||
- "049460f7-21cb-42f5-8059-d42752bf406f" # obvWolf
|
- "049460f7-21cb-42f5-8059-d42752bf406f" # obvWolf
|
||||||
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.
|
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-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
|
prevent-cmdblock-place: true # Defaulted true | Should Placing a command block get blocked
|
||||||
|
prevent-cmdblock-use: true # Defaulted true | Should using a command block get blocked
|
||||||
|
prevent-cmdblock-change: true # Defaulted true | Should changing a command block get blocked
|
||||||
|
prevent-cmdcart-place: true # Defaulted true | Should placing a command cart get blocked
|
||||||
|
prevent-cmdcart-use: true # Defaulted true | Should using a command cart get 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)
|
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
|
dangerous: # These commands can only be run by "trusted" users
|
||||||
- "op"
|
- "op"
|
||||||
|
|||||||
Reference in New Issue
Block a user