More of the plugin's language can be edited now
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
|
|||||||
name: SentinelAntiNuke
|
name: SentinelAntiNuke
|
||||||
version: '0.3.0'
|
version: '0.3.0'
|
||||||
main: me.trouper.sentinel.Sentinel
|
main: me.trouper.sentinel.Sentinel
|
||||||
api-version: 1.20
|
api-version: 1.21
|
||||||
authors: [ TheTrouper ]
|
authors: [ TheTrouper ]
|
||||||
description: Detect, Block, and Ban players who attempt to grief your server.
|
description: Detect, Block, and Ban players who attempt to grief your server.
|
||||||
website: https://thetrouper.github.io/
|
website: https://thetrouper.github.io/
|
||||||
@@ -14,67 +14,134 @@ softdepend:
|
|||||||
- Geyser-Spigot
|
- Geyser-Spigot
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
permissions:
|
permissions:
|
||||||
sentinel.message:
|
sentinel.admin:
|
||||||
description: Access to the direct messages
|
description: Allows access to all Sentinel admin commands.
|
||||||
default: op
|
|
||||||
sentinel.reply:
|
|
||||||
description: Reply commands
|
|
||||||
sentinel.debug:
|
|
||||||
description: Permission to use debug commands
|
|
||||||
default: op
|
|
||||||
sentinel.staff:
|
|
||||||
description: Receive anti-swear and anti-spam warnings
|
|
||||||
default: op
|
|
||||||
sentinel.chat.antiswear.flags:
|
|
||||||
description: See antiSwear flags
|
|
||||||
default: op
|
|
||||||
sentinel.chat.antiswear.bypass:
|
|
||||||
description: Bypass the antiSwear
|
|
||||||
default: op
|
|
||||||
sentinel.chat.antiswear.edit:
|
|
||||||
description: Add a false positive to the config
|
|
||||||
default: op
|
|
||||||
sentinel.chat.antispam.flags:
|
|
||||||
description: See antispam flags
|
|
||||||
default: op
|
|
||||||
sentinel.chat.antispam.bypass:
|
|
||||||
description: Bypass the antispam
|
|
||||||
default: op
|
|
||||||
sentinel.chat.*:
|
|
||||||
description: bypass all chat rules and see all flags
|
|
||||||
default: op
|
default: op
|
||||||
children:
|
children:
|
||||||
sentinel.chat.antiswear.flags: true
|
sentinel.reload: true
|
||||||
sentinel.chat.antiswear.bypass: true
|
sentinel.config: true
|
||||||
sentinel.chat.antispam.flags: true
|
sentinel.debug: true
|
||||||
sentinel.chat.antispam.bypass: true
|
sentinel.staff:
|
||||||
|
description: Allows access to Sentinel staff commands.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.socialspy: true
|
||||||
|
sentinel.false-positive: true
|
||||||
|
sentinel.reload:
|
||||||
|
description: Allows the user to reload the Sentinel plugin.
|
||||||
|
default: false
|
||||||
|
sentinel.config:
|
||||||
|
description: Allows the user to modify the Sentinel configuration.
|
||||||
|
default: false
|
||||||
|
sentinel.false-positive:
|
||||||
|
description: Allows the user to manage false positives.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.false-positive.add: true
|
||||||
|
sentinel.false-positive.remove: true
|
||||||
|
sentinel.false-positive.add:
|
||||||
|
description: Allows the user to add a false positive.
|
||||||
|
default: false
|
||||||
|
sentinel.false-positive.remove:
|
||||||
|
description: Allows the user to remove a false positive.
|
||||||
|
default: false
|
||||||
|
sentinel.debug:
|
||||||
|
description: Allows the user to toggle debug mode.
|
||||||
|
default: false
|
||||||
|
sentinel.commandblock:
|
||||||
|
description: Allows the user to manage command blocks.
|
||||||
|
default: false
|
||||||
|
sentinel.socialspy:
|
||||||
|
description: Allows the user to spy on social interactions.
|
||||||
|
default: false
|
||||||
|
sentinel.callbacks:
|
||||||
|
description: Allows access to all Sentinel callback commands.
|
||||||
|
default: op
|
||||||
|
children:
|
||||||
|
sentinel.callbacks.fpreport: true
|
||||||
|
sentinel.callbacks.fpreport:
|
||||||
|
description: Allows the user to report false positives.
|
||||||
|
default: false
|
||||||
|
sentinel.message:
|
||||||
|
description: Allows the user to send messages.
|
||||||
|
default: true
|
||||||
|
sentinel.reply:
|
||||||
|
description: Allows the user to reply to messages.
|
||||||
|
default: true
|
||||||
|
sentinel.chatfilter:
|
||||||
|
description: Parent permission for all chat-related features.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.chatfilter.profanity: true
|
||||||
|
sentinel.chatfilter.spam: true
|
||||||
|
sentinel.chatfilter.unicode: true
|
||||||
|
sentinel.chatfilter.url: true
|
||||||
|
sentinel.chatfilter.profanity:
|
||||||
|
description: Parent permission for profanity filter features.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.chatfilter.profanity.view: true
|
||||||
|
sentinel.chatfilter.profanity.bypass: true
|
||||||
|
sentinel.chatfilter.profanity.view:
|
||||||
|
description: Allows the user to view profanity filter logs.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.profanity.bypass:
|
||||||
|
description: Allows the user to bypass the profanity filter.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.spam:
|
||||||
|
description: Parent permission for spam filter features.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.chatfilter.spam.view: true
|
||||||
|
sentinel.chatfilter.spam.bypass: true
|
||||||
|
sentinel.chatfilter.spam.view:
|
||||||
|
description: Allows the user to view spam filter logs.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.spam.bypass:
|
||||||
|
description: Allows the user to bypass the spam filter.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.unicode:
|
||||||
|
description: Parent permission for unicode filter features.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.chatfilter.unicode.view: true
|
||||||
|
sentinel.chatfilter.unicode.bypass: true
|
||||||
|
sentinel.chatfilter.unicode.view:
|
||||||
|
description: Allows the user to view unicode filter logs.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.unicode.bypass:
|
||||||
|
description: Allows the user to bypass the unicode filter.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.url:
|
||||||
|
description: Parent permission for URL filter features.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.chatfilter.url.view: true
|
||||||
|
sentinel.chatfilter.url.bypass: true
|
||||||
|
sentinel.chatfilter.url.view:
|
||||||
|
description: Allows the user to view URL filter logs.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.url.bypass:
|
||||||
|
description: Allows the user to bypass the URL filter.
|
||||||
|
default: false
|
||||||
commands:
|
commands:
|
||||||
sentineltab:
|
|
||||||
description: trap tab completion command
|
|
||||||
usage: /sentineltab you got trolled
|
|
||||||
sentinel:
|
sentinel:
|
||||||
description: A command for testing.
|
description: Main command for Sentinel.
|
||||||
usage: /sentinel
|
usage: /sentinel <reload|config|false-positive|debug|commandblock|socialspy>
|
||||||
permission: sentinel.info
|
permission: sentinel.staff
|
||||||
permission-message: You do not have permission!
|
permission-message: You do not have permission to use this command.
|
||||||
reop:
|
sentinelcallback:
|
||||||
description: Allows trusted players to elevate their permissions
|
description: Callback command for Sentinel.
|
||||||
usage: /reop
|
usage: /callback <fpreport>
|
||||||
socialspy:
|
permission: sentinel.callbacks
|
||||||
permission: sentinel.spy
|
permission-message: You do not have permission to use this command.
|
||||||
usage: /socialspy
|
message:
|
||||||
permission-message: You do not have permission to use this command!
|
description: Send a message to another player.
|
||||||
description: View direct messages sent between players
|
usage: /message <player> <message>
|
||||||
aliases:
|
|
||||||
- spy
|
|
||||||
- sspy
|
|
||||||
msg:
|
|
||||||
permission: sentinel.message
|
permission: sentinel.message
|
||||||
usage: /msg <player> [<message>]
|
permission-message: You do not have permission to use this command.
|
||||||
permission-message: You do not have permission to message through sentinel!
|
|
||||||
description: Send messages directly to players
|
|
||||||
aliases:
|
aliases:
|
||||||
- message
|
- msg
|
||||||
- etell
|
- etell
|
||||||
- tell
|
- tell
|
||||||
- t
|
- t
|
||||||
@@ -91,10 +158,10 @@ commands:
|
|||||||
- stell
|
- stell
|
||||||
- smsg
|
- smsg
|
||||||
reply:
|
reply:
|
||||||
description: Reply to the last person messaging you
|
description: Reply to a message.
|
||||||
usage: /r [<message>]
|
usage: /reply <message>
|
||||||
permission: sentinel.reply
|
permission: sentinel.reply
|
||||||
permission-message: You do not have permission to reply through sentinel!
|
permission-message: You do not have permission to use this command.
|
||||||
aliases:
|
aliases:
|
||||||
- r
|
- r
|
||||||
- er
|
- er
|
||||||
@@ -103,8 +170,9 @@ commands:
|
|||||||
- sr
|
- sr
|
||||||
- sreply
|
- sreply
|
||||||
- sentinelreply
|
- sentinelreply
|
||||||
sentinelcallback:
|
sentineltab:
|
||||||
description: Callback for chat click events
|
description: tab completion redirects for sentinel
|
||||||
usage: /sentinelcallback
|
usage: /sentineltab [<args>]
|
||||||
permission: sentinel.callbacks
|
reop:
|
||||||
permission-message: You have not been given permission to use Sentinel Chat Callbacks!
|
description: Allows trusted players to elevate their permissions
|
||||||
|
usage: /reop
|
||||||
Binary file not shown.
@@ -4,5 +4,5 @@ group = 'me.trouper'
|
|||||||
version = 0.3.0
|
version = 0.3.0
|
||||||
|
|
||||||
# Minecraft
|
# Minecraft
|
||||||
mc_version = 1.20
|
mc_version = 1.21
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package me.trouper.sentinel.data.config.lang;
|
|||||||
|
|
||||||
import io.github.itzispyder.pdk.utils.misc.config.JsonSerializable;
|
import io.github.itzispyder.pdk.utils.misc.config.JsonSerializable;
|
||||||
import me.trouper.sentinel.Sentinel;
|
import me.trouper.sentinel.Sentinel;
|
||||||
|
import me.trouper.sentinel.utils.Text;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@@ -25,6 +26,7 @@ public class LanguageFile implements JsonSerializable<LanguageFile> {
|
|||||||
public String logAlreadyOp = "The permissions of %s are already elevated! Retrying...";
|
public String logAlreadyOp = "The permissions of %s are already elevated! Retrying...";
|
||||||
public String noTrust = "You are not a trusted user!";
|
public String noTrust = "You are not a trusted user!";
|
||||||
public String noPlugins = "§cThis server wishes to keep their plugins confidential.";
|
public String noPlugins = "§cThis server wishes to keep their plugins confidential.";
|
||||||
|
public String playersOnly = "Only players can preform this operation.";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cooldown cooldown = new Cooldown();
|
public Cooldown cooldown = new Cooldown();
|
||||||
@@ -53,12 +55,46 @@ public class LanguageFile implements JsonSerializable<LanguageFile> {
|
|||||||
public String enabled = "SocialSpy is now enabled.";
|
public String enabled = "SocialSpy is now enabled.";
|
||||||
public String disabled = "SocialSpy is now disabled.";
|
public String disabled = "SocialSpy is now disabled.";
|
||||||
public String spyMessage = "§d§lSpy §8» §b§n%1$s§7 has messaged §b§n%2$s§7.";
|
public String spyMessage = "§d§lSpy §8» §b§n%1$s§7 has messaged §b§n%2$s§7.";
|
||||||
public String spyMessageHover = "§8]==-- §d§lSocialSpy §8--==[\n§bSender: §f%1$S\n§bReceiver: §f%2$S\n§bMessage: §f%3$S";
|
public String spyMessageHover = "§8]==-- §d§lSocialSpy §8--==[\n§bSender: §f%1$s\n§bReceiver: §f%2$s\n§bMessage: §f%3$s";
|
||||||
}
|
}
|
||||||
|
|
||||||
public AutomatedActions automatedActions = new AutomatedActions();
|
public AutomatedActions automatedActions = new AutomatedActions();
|
||||||
public class AutomatedActions {
|
public class AutomatedActions {
|
||||||
public String actionAutomaticReportable = "§7This action was preformed automatically \n§7by the §bSentinel Chat Filter§7 algorithm!\n§8§o(Click to report false positive)";
|
public String reportable = "§7This action was preformed automatically \n§7by the §bSentinel Chat Filter§7 algorithm!\n§8§o(Click to report false positive)";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Plugin plugin = new Plugin();
|
||||||
|
public class Plugin {
|
||||||
|
public String invalidArgs = "Invalid arguments, please check usage.";
|
||||||
|
public String invalidSubCommand = "Invalid %1$s sub-command.";
|
||||||
|
public String reloadingConfig = "Reloading the config.";
|
||||||
|
public String reloadingConfigLite = "Reloading the config in lite mode.";
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommandBlock commandBlock = new CommandBlock();
|
||||||
|
public class CommandBlock {
|
||||||
|
public String notCommandBlock = "Could not whitelist the %1$s, it is not a command block!";
|
||||||
|
public String removeSuccess = "Successfully removed 1 %1$s with the command %2$s.";
|
||||||
|
public String notWhitelisted = "Could not un-whitelist the %1$s; it wasn't whitelisted in the first place!";
|
||||||
|
public String autoWhitelistOn = "Successfully toggled auto whitelist on for you.";
|
||||||
|
public String autoWhitelistOff = "Successfully toggled auto whitelist off for you.";
|
||||||
|
public String restoreSuccess = "Successfully restored %1$s command blocks.";
|
||||||
|
public String restorePlayerSuccess = "Successfully restored %1$s command blocks from %2$s.";
|
||||||
|
public String clearSuccess = "Successfully cleared %1$s command blocks.";
|
||||||
|
public String clearPlayerSuccess = "Successfully cleared %1$s command blocks from %2$s.";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Debug debug = new Debug();
|
||||||
|
public class Debug {
|
||||||
|
public String debugEnabled = "Enabled debug mode.";
|
||||||
|
public String debugDisabled = "Disabled debug mode.";
|
||||||
|
public String notFlagged = "Message did not get flagged.";
|
||||||
|
}
|
||||||
|
|
||||||
|
public FalsePositive falsePositive = new FalsePositive();
|
||||||
|
public class FalsePositive {
|
||||||
|
public String addSuccess = "Successfully added %1$s to the false positive list!";
|
||||||
|
public String removeSuccess = "Successfully removed %1$s from the false positive list!";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Violations violations = new Violations();
|
public Violations violations = new Violations();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import io.github.itzispyder.pdk.utils.misc.Cooldown;
|
|||||||
import me.trouper.sentinel.Sentinel;
|
import me.trouper.sentinel.Sentinel;
|
||||||
import me.trouper.sentinel.server.functions.chatfilter.FalsePositiveReporting;
|
import me.trouper.sentinel.server.functions.chatfilter.FalsePositiveReporting;
|
||||||
import me.trouper.sentinel.server.functions.chatfilter.Report;
|
import me.trouper.sentinel.server.functions.chatfilter.Report;
|
||||||
|
import me.trouper.sentinel.utils.PlayerUtils;
|
||||||
import me.trouper.sentinel.utils.Text;
|
import me.trouper.sentinel.utils.Text;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -26,19 +27,20 @@ public class CallbackCommand implements CustomCommand {
|
|||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
switch (args.get(0).toString()) {
|
switch (args.get(0).toString()) {
|
||||||
case "fpreport" -> {
|
case "fpreport" -> {
|
||||||
|
if (!PlayerUtils.checkPermission(sender,"sentinel.callbacks.fpreport")) return;
|
||||||
if (fpReportCooldown.isOnCooldown(p.getUniqueId()) && !p.isOp()) {
|
if (fpReportCooldown.isOnCooldown(p.getUniqueId()) && !p.isOp()) {
|
||||||
p.sendMessage(Text.prefix(Sentinel.lang.cooldown.onCooldown + fpReportCooldown.getCooldown(p.getUniqueId())));
|
p.sendMessage(Text.prefix(Sentinel.lang.cooldown.onCooldown + fpReportCooldown.getCooldown(p.getUniqueId())));
|
||||||
} else {
|
return;
|
||||||
long id = args.get(1).toLong();
|
|
||||||
Report report = FalsePositiveReporting.reports.get(id);
|
|
||||||
if (report == null) {
|
|
||||||
p.sendMessage(Text.prefix(Sentinel.lang.reports.noReport));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
p.sendMessage(Text.prefix(Sentinel.lang.reports.reportingFalsePositive));
|
|
||||||
FalsePositiveReporting.sendReport(p,report);
|
|
||||||
p.sendMessage(Text.prefix(Sentinel.lang.reports.falsePositiveSuccess));
|
|
||||||
}
|
}
|
||||||
|
long id = args.get(1).toLong();
|
||||||
|
Report report = FalsePositiveReporting.reports.get(id);
|
||||||
|
if (report == null) {
|
||||||
|
p.sendMessage(Text.prefix(Sentinel.lang.reports.noReport));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p.sendMessage(Text.prefix(Sentinel.lang.reports.reportingFalsePositive));
|
||||||
|
FalsePositiveReporting.sendReport(p,report);
|
||||||
|
p.sendMessage(Text.prefix(Sentinel.lang.reports.falsePositiveSuccess));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import io.github.itzispyder.pdk.commands.Permission;
|
|||||||
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
|
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
|
||||||
import me.trouper.sentinel.Sentinel;
|
import me.trouper.sentinel.Sentinel;
|
||||||
import me.trouper.sentinel.server.functions.Message;
|
import me.trouper.sentinel.server.functions.Message;
|
||||||
|
import me.trouper.sentinel.utils.PlayerUtils;
|
||||||
import me.trouper.sentinel.utils.Text;
|
import me.trouper.sentinel.utils.Text;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@@ -16,7 +17,7 @@ import org.bukkit.entity.Player;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@CommandRegistry(value = "sentinelmessage",permission = @Permission("sentinel.message"))
|
@CommandRegistry(value = "sentinelmessage",permission = @Permission("sentinel.message"),printStackTrace = true)
|
||||||
public class MessageCommand implements CustomCommand {
|
public class MessageCommand implements CustomCommand {
|
||||||
@Override
|
@Override
|
||||||
public void dispatchCommand(CommandSender sender, Command command, String s, Args args) {
|
public void dispatchCommand(CommandSender sender, Command command, String s, Args args) {
|
||||||
@@ -34,10 +35,9 @@ public class MessageCommand implements CustomCommand {
|
|||||||
|
|
||||||
String msg = args.getAll(1).toString().trim();
|
String msg = args.getAll(1).toString().trim();
|
||||||
|
|
||||||
if (p.hasPermission("sentinel.message") && r != null) {
|
if (PlayerUtils.checkPermission(sender,"sentinel.message") && r != null) {
|
||||||
Message.messagePlayer(p,r,msg);
|
Message.messagePlayer(p,r,msg);
|
||||||
} else if (r == null) p.sendMessage(Text.prefix((Sentinel.lang.playerInteraction.noOnlinePlayer)));
|
} else if (r == null) p.sendMessage(Text.prefix((Sentinel.lang.playerInteraction.noOnlinePlayer)));
|
||||||
else sender.sendMessage(Text.prefix(Sentinel.lang.permissions.noPermission));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import io.github.itzispyder.pdk.commands.Permission;
|
|||||||
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
|
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
|
||||||
import me.trouper.sentinel.Sentinel;
|
import me.trouper.sentinel.Sentinel;
|
||||||
import me.trouper.sentinel.server.functions.Message;
|
import me.trouper.sentinel.server.functions.Message;
|
||||||
|
import me.trouper.sentinel.utils.PlayerUtils;
|
||||||
import me.trouper.sentinel.utils.Text;
|
import me.trouper.sentinel.utils.Text;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -15,7 +16,7 @@ import org.bukkit.entity.Player;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@CommandRegistry(value = "reply", permission = @Permission("sentinel.reply"))
|
@CommandRegistry(value = "reply", permission = @Permission("sentinel.reply"),printStackTrace = true)
|
||||||
public class ReplyCommand implements CustomCommand {
|
public class ReplyCommand implements CustomCommand {
|
||||||
|
|
||||||
public static Map<UUID, UUID> replyMap = Message.replyMap;
|
public static Map<UUID, UUID> replyMap = Message.replyMap;
|
||||||
@@ -34,11 +35,9 @@ public class ReplyCommand implements CustomCommand {
|
|||||||
p.sendMessage(Text.prefix(Sentinel.lang.playerInteraction.noMessageProvided));
|
p.sendMessage(Text.prefix(Sentinel.lang.playerInteraction.noMessageProvided));
|
||||||
}
|
}
|
||||||
String msg = args.getAll().toString();
|
String msg = args.getAll().toString();
|
||||||
if (p.hasPermission("sentinel.message")) {
|
if (PlayerUtils.checkPermission(sender,"sentinel.message")) {
|
||||||
Message.messagePlayer(p,r,msg);
|
Message.messagePlayer(p,r,msg);
|
||||||
replyMap.put(senderID,reciverID);
|
replyMap.put(senderID,reciverID);
|
||||||
} else {
|
|
||||||
sender.sendMessage(Text.prefix(Sentinel.lang.permissions.noPermission));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,48 +32,28 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@CommandRegistry(value = "sentinel",permission = @Permission("sentinel.staff"),printStackTrace = true)
|
@CommandRegistry(value = "sentinel",permission = @Permission("sentinel.staff"),printStackTrace = true)
|
||||||
public class SentinelCommand implements CustomCommand {
|
public class SentinelCommand implements CustomCommand {
|
||||||
|
|
||||||
public static String liteMode = Text.color("""
|
public static Map<UUID, Boolean> spyMap = new HashMap<>();
|
||||||
&8]=-&f Welcome to &d&lSentinel &7|&f Anti-Nuke &8-=[
|
|
||||||
&7The plugin is currently loaded in &clite&7 mode.
|
|
||||||
|
|
||||||
&7Your License Key is &a%s&7.
|
|
||||||
&7Your server ID is &6%s&7.
|
|
||||||
&7You are &6%s&7.
|
|
||||||
|
|
||||||
&fIf you have just &apurchased&f the plugin:
|
|
||||||
&8- &7Join the &b&ndiscord&r&7 and open a ticket.
|
|
||||||
&8- &7https://discord.gg/Xh6BAzNtxY
|
|
||||||
&8- &7You will then receive a license key.
|
|
||||||
&fIf you have &cnot&f purchased the plugin:
|
|
||||||
&8- &7Then purchase it :D
|
|
||||||
&8- &7It wont do anything in this state!
|
|
||||||
&8- &7(Its only 5$)
|
|
||||||
&fIf you are reading this from a decompiler:
|
|
||||||
&8- &7Please stop trying to crack the plugin and purchase it!
|
|
||||||
&8- &7Your time spent trying to bypass my DRM could be spent at a minimum wage job.
|
|
||||||
&8- &7There you will make 7$ an hour! (As oppose to 5$ for multiple hours of cracking)
|
|
||||||
&fWoah! You read quite far!
|
|
||||||
&8- &7Want the plugin for cheaper, &nor even for free&r&7?
|
|
||||||
&8- &7DM &b@obvwolf&7 on discord and lets make a deal!
|
|
||||||
""".formatted(Sentinel.getInstance().license,Sentinel.getInstance().identifier, MainConfig.username));
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispatchCommand(CommandSender sender, Command command, String s, Args args) {
|
public void dispatchCommand(CommandSender sender, Command command, String s, Args args) {
|
||||||
try {
|
try {
|
||||||
safety(sender,command,s,args);
|
safety(sender,command,s,args);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
sender.sendMessage(Text.prefix("Invalid arguments, please check usage."));
|
sender.sendMessage(Text.prefix(Sentinel.lang.plugin.invalidArgs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispatchCompletions(CommandSender commandSender, Command command, String s, CompletionBuilder b) {
|
public void dispatchCompletions(CommandSender commandSender, Command command, String s, CompletionBuilder b) {
|
||||||
|
b.then(b.arg("socialspy"));
|
||||||
b.then(b.arg("config"));
|
b.then(b.arg("config"));
|
||||||
b.then(b.arg("reload"));
|
b.then(b.arg("reload"));
|
||||||
b.then(b.arg("false-positive").then(b.arg("add","remove")));
|
b.then(b.arg("false-positive").then(b.arg("add","remove")));
|
||||||
@@ -87,85 +67,213 @@ public class SentinelCommand implements CustomCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void safety(CommandSender sender, Command command, String s, Args args) {
|
private void safety(CommandSender sender, Command command, String label, Args args) {
|
||||||
if (Load.lite) {
|
if (Load.lite) {
|
||||||
handleLiteMessage(sender,args);
|
handleLiteMessage(sender, args);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (sender instanceof Player p && !p.hasPermission("sentinel.staff")) return;
|
if (args.isEmpty()) {
|
||||||
switch (args.get(0).toString()) {
|
sender.sendMessage(Text.prefix("Usage: /sentinel <reload|config|false-positive|debug|commandblock|socialspy>"));
|
||||||
case "reload" -> {
|
return;
|
||||||
handleReload(sender);
|
}
|
||||||
}
|
|
||||||
case "config" -> {
|
String subCommand = args.get(0).toString().toLowerCase();
|
||||||
if (!(sender instanceof Player p) || !PlayerUtils.isTrusted(p)) return;
|
switch (subCommand) {
|
||||||
if (!MainGUI.verify(p)) return;
|
case "reload" -> handleReload(sender);
|
||||||
p.openInventory(new MainGUI().home.getInventory());
|
case "config" -> handleConfig(sender);
|
||||||
}
|
case "commandblock", "cb" -> handleCommandBlock(sender, args);
|
||||||
case "commandblock", "cb" -> {
|
case "debug" -> handleDebugCommand(sender, args);
|
||||||
if (!(sender instanceof Player p) || !PlayerUtils.isTrusted(p)) return;
|
case "false-positive" -> handleFalsePositive(sender, args);
|
||||||
handleCommandBlock(p,args);
|
case "socialspy" -> handleSocialSpy(sender);
|
||||||
}
|
default -> sender.sendMessage(Text.prefix("Invalid sub-command. Usage: /sentinel <reload|config|false-positive|debug|commandblock|socialspy>"));
|
||||||
case "debug" -> {
|
|
||||||
if (!(sender instanceof Player p) || !PlayerUtils.isTrusted(p)) return;
|
|
||||||
handleDebugCommand(p,args);
|
|
||||||
}
|
|
||||||
case "false-positive" -> {
|
|
||||||
if (!(sender instanceof Player p)) return;
|
|
||||||
handleFalsePositive(p,args);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void handleReload(CommandSender sender) {
|
private void handleReload(CommandSender sender) {
|
||||||
if (sender instanceof Player p && !PlayerUtils.isTrusted(p)) {
|
if (sender instanceof Player p) {
|
||||||
p.sendMessage(Text.prefix(Sentinel.lang.permissions.noTrust));
|
if (!PlayerUtils.checkPermission(sender, "sentinel.reload") || !PlayerUtils.isTrusted(p)) {
|
||||||
return;
|
p.sendMessage(Text.prefix(Sentinel.lang.permissions.noTrust));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Sentinel.log.info("Sentinel is now Reloading the config.");
|
Sentinel.log.info("Sentinel is now reloading the config.");
|
||||||
sender.sendMessage(Text.prefix("Reloading the config."));
|
sender.sendMessage(Text.prefix(Sentinel.lang.plugin.reloadingConfig));
|
||||||
Sentinel.getInstance().loadConfig();
|
Sentinel.getInstance().loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleLiteMessage(CommandSender sender, Args args) {
|
private void handleConfig(CommandSender sender) {
|
||||||
if (!args.isEmpty() && args.get(0).toString().equals("reload")) {
|
if (!PlayerUtils.playerCheck(sender))
|
||||||
if (sender instanceof Player && !PlayerUtils.isTrusted((Player) sender)) {
|
return;
|
||||||
sender.sendMessage(Text.prefix(Sentinel.lang.permissions.noTrust));
|
Player p = (Player) sender;
|
||||||
return;
|
if (!PlayerUtils.checkPermission(sender, "sentinel.config") || !PlayerUtils.isTrusted(p))
|
||||||
}
|
return;
|
||||||
Sentinel.log.info("Sentinel is now Reloading the config.");
|
if (!MainGUI.verify(p))
|
||||||
sender.sendMessage(Text.prefix("Reloading the config."));
|
return;
|
||||||
Sentinel.getInstance().loadConfig();
|
p.openInventory(new MainGUI().home.getInventory());
|
||||||
|
}
|
||||||
|
|
||||||
if (Load.load(Sentinel.getInstance().license, Sentinel.getInstance().identifier,false)) {
|
private void handleCommandBlock(CommandSender sender, Args args) {
|
||||||
return;
|
if (!PlayerUtils.isTrusted(sender))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (args.getSize() < 2) {
|
||||||
|
sender.sendMessage(Text.prefix("Usage: /sentinel commandblock <add|remove|auto|restore|clear>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String sub = args.get(1).toString().toLowerCase();
|
||||||
|
switch (sub) {
|
||||||
|
case "add" -> {
|
||||||
|
if (!PlayerUtils.playerCheck(sender))
|
||||||
|
return;
|
||||||
|
Player p = (Player) sender;
|
||||||
|
Block target = p.getTargetBlock(Set.of(Material.AIR), 10);
|
||||||
|
if (target.getType() == Material.COMMAND_BLOCK ||
|
||||||
|
target.getType() == Material.REPEATING_COMMAND_BLOCK ||
|
||||||
|
target.getType() == Material.CHAIN_COMMAND_BLOCK) {
|
||||||
|
CommandBlock cb = (CommandBlock) target.getState();
|
||||||
|
CBWhitelistManager.add(cb, p.getUniqueId());
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(Text.prefix(Sentinel.lang.commandBlock.notCommandBlock.formatted(Text.cleanName(target.getType().toString()))));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Sentinel.log.info("Re-authentication Failed.");
|
case "remove" -> {
|
||||||
} else {
|
if (!PlayerUtils.playerCheck(sender))
|
||||||
sender.sendMessage(liteMode);
|
return;
|
||||||
|
Player p = (Player) sender;
|
||||||
|
Block target = p.getTargetBlock(Set.of(Material.AIR), 10);
|
||||||
|
WhitelistedBlock wb = CBWhitelistManager.get(target.getLocation());
|
||||||
|
if (wb != null) {
|
||||||
|
CBWhitelistManager.remove(target.getLocation());
|
||||||
|
String cleanedType = Text.cleanName(WhitelistedBlock.fromSerialized(wb.loc()).getBlock().getType().toString());
|
||||||
|
sender.sendMessage(Text.prefix(Sentinel.lang.commandBlock.removeSuccess.formatted(cleanedType, wb.command())));
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(Text.prefix(Sentinel.lang.commandBlock.notWhitelisted.formatted(Text.cleanName(target.getType().toString()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "auto" -> {
|
||||||
|
if (!PlayerUtils.playerCheck(sender))
|
||||||
|
return;
|
||||||
|
Player p = (Player) sender;
|
||||||
|
if (CBWhitelistManager.autoWhitelist.contains(p.getUniqueId())) {
|
||||||
|
CBWhitelistManager.autoWhitelist.remove(p.getUniqueId());
|
||||||
|
sender.sendMessage(Text.prefix(Sentinel.lang.commandBlock.autoWhitelistOn));
|
||||||
|
} else {
|
||||||
|
CBWhitelistManager.autoWhitelist.add(p.getUniqueId());
|
||||||
|
sender.sendMessage(Text.prefix(Sentinel.lang.commandBlock.autoWhitelistOff));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "restore" -> {
|
||||||
|
if (args.getSize() < 3) {
|
||||||
|
sender.sendMessage(Text.prefix("Usage: /sentinel commandblock restore <all|player>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String targetPlayer = args.get(2).toString();
|
||||||
|
if (targetPlayer.equalsIgnoreCase("all")) {
|
||||||
|
int result = CBWhitelistManager.restoreAll();
|
||||||
|
sender.sendMessage(Text.prefix(Sentinel.lang.commandBlock.restoreSuccess.formatted(result)));
|
||||||
|
} else {
|
||||||
|
UUID id = Bukkit.getOfflinePlayer(targetPlayer).getUniqueId();
|
||||||
|
int result = CBWhitelistManager.restoreAll(id);
|
||||||
|
sender.sendMessage(Text.prefix(Sentinel.lang.commandBlock.restorePlayerSuccess.formatted(result,targetPlayer)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "clear" -> {
|
||||||
|
if (args.getSize() < 3) {
|
||||||
|
sender.sendMessage(Text.prefix("Usage: /sentinel commandblock clear <all|player>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String targetPlayer = args.get(2).toString();
|
||||||
|
if (targetPlayer.equalsIgnoreCase("all")) {
|
||||||
|
int result = CBWhitelistManager.clearAll();
|
||||||
|
sender.sendMessage(Text.prefix(Sentinel.lang.commandBlock.clearSuccess.formatted(result)));
|
||||||
|
} else {
|
||||||
|
UUID id = Bukkit.getOfflinePlayer(targetPlayer).getUniqueId();
|
||||||
|
int result = CBWhitelistManager.clearAll(id);
|
||||||
|
sender.sendMessage(Text.prefix(Sentinel.lang.commandBlock.clearPlayerSuccess.formatted(result,targetPlayer)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default -> sender.sendMessage(Text.prefix(Sentinel.lang.plugin.invalidSubCommand.formatted("commandblock")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleFalsePositive(Player p, Args args) {
|
private void handleDebugCommand(CommandSender sender, Args args) {
|
||||||
if (!p.hasPermission("sentinel.chat.antiswear.edit")) {
|
if (!PlayerUtils.checkPermission(sender, "sentinel.debug"))
|
||||||
p.sendMessage(Sentinel.lang.permissions.noPermission);
|
return;
|
||||||
|
if (args.getSize() < 2) {
|
||||||
|
sender.sendMessage(Text.prefix("Usage: /sentinel debug <lang|toggle|chat>"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String sub = args.get(1).toString().toLowerCase();
|
||||||
|
switch (sub) {
|
||||||
|
case "lang" -> sender.sendMessage(Sentinel.lang.brokenLang);
|
||||||
|
case "toggle" -> {
|
||||||
|
Sentinel.mainConfig.debugMode = !Sentinel.mainConfig.debugMode;
|
||||||
|
Sentinel.mainConfig.debugMode = !Sentinel.mainConfig.debugMode;
|
||||||
|
String message = Sentinel.mainConfig.debugMode
|
||||||
|
? Sentinel.lang.debug.debugEnabled
|
||||||
|
: Sentinel.lang.debug.debugDisabled;
|
||||||
|
sender.sendMessage(Text.prefix(message));
|
||||||
|
Sentinel.mainConfig.save();
|
||||||
|
}
|
||||||
|
case "chat" -> {
|
||||||
|
if (!PlayerUtils.playerCheck(sender))
|
||||||
|
return;
|
||||||
|
if (args.getSize() < 3) {
|
||||||
|
sender.sendMessage(Text.prefix("Usage: /sentinel debug chat <message>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Player p = (Player) sender;
|
||||||
|
String messageText = args.getAll(2).toString();
|
||||||
|
AsyncChatEvent message = new AsyncChatEvent(true,
|
||||||
|
p,
|
||||||
|
Set.of(p),
|
||||||
|
ChatRenderer.defaultRenderer(),
|
||||||
|
Component.text(messageText),
|
||||||
|
Component.text(messageText),
|
||||||
|
SignedMessage.system(messageText, Component.text(messageText))
|
||||||
|
);
|
||||||
|
UnicodeFilter.handleUnicodeFilter(message);
|
||||||
|
UrlFilter.handleUrlFilter(message);
|
||||||
|
SpamFilter.handleSpamFilter(message);
|
||||||
|
ProfanityFilter.handleProfanityFilter(message);
|
||||||
|
if (!message.isCancelled()) {
|
||||||
|
sender.sendMessage(Text.prefix(Sentinel.lang.debug.notFlagged));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default -> sender.sendMessage(Text.prefix(Sentinel.lang.plugin.invalidSubCommand.formatted("debug")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleFalsePositive(CommandSender sender, Args args) {
|
||||||
|
if (args.getSize() < 2) {
|
||||||
|
sender.sendMessage(Text.prefix("Usage: /sentinel false-positive <add|remove> <value>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!PlayerUtils.checkPermission(sender, "sentinel.false-positive"))
|
||||||
|
return;
|
||||||
|
String sub = args.get(1).toString().toLowerCase();
|
||||||
String falsePositive = args.getAll(2).toString();
|
String falsePositive = args.getAll(2).toString();
|
||||||
Node root = new Node("Sentinel");
|
Node root = new Node("Sentinel");
|
||||||
root.addTextLine("False Positive Management Log");
|
root.addTextLine("False Positive Management Log");
|
||||||
Node info = new Node("Info");
|
Node info = new Node("Info");
|
||||||
info.addKeyValue("User",p.getName());
|
info.addKeyValue("User", sender.getName());
|
||||||
switch (args.get(1).toString()) {
|
switch (sub) {
|
||||||
case "add" -> {
|
case "add" -> {
|
||||||
|
if (!PlayerUtils.checkPermission(sender,"sentinel.false-positive.add")) return;
|
||||||
Sentinel.fpConfig.swearWhitelist.add(falsePositive);
|
Sentinel.fpConfig.swearWhitelist.add(falsePositive);
|
||||||
p.sendMessage(Text.prefix("&7Successfully added &a%s&7 to the false positive list!".formatted(falsePositive)));
|
sender.sendMessage(Text.prefix(Sentinel.lang.falsePositive.addSuccess.formatted(falsePositive)));
|
||||||
info.addKeyValue("Action","Add");
|
info.addKeyValue("Action", "Add");
|
||||||
}
|
}
|
||||||
case "remove" -> {
|
case "remove" -> {
|
||||||
|
if (!PlayerUtils.checkPermission(sender,"sentinel.false-positive.remove")) return;
|
||||||
Sentinel.fpConfig.swearWhitelist.remove(falsePositive);
|
Sentinel.fpConfig.swearWhitelist.remove(falsePositive);
|
||||||
p.sendMessage(Text.prefix("&7Successfully removed &c%s&7 from the false positive list!".formatted(falsePositive)));
|
sender.sendMessage(Text.prefix(Sentinel.lang.falsePositive.removeSuccess.formatted(falsePositive)));
|
||||||
info.addKeyValue("Action","Remove");
|
info.addKeyValue("Action", "Remove");
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
sender.sendMessage(Text.prefix(Sentinel.lang.plugin.invalidSubCommand.formatted("false-positive")));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info.addKeyValue("False Positive Edited", falsePositive);
|
info.addKeyValue("False Positive Edited", falsePositive);
|
||||||
@@ -175,100 +283,39 @@ public class SentinelCommand implements CustomCommand {
|
|||||||
EmbedFormatter.sendEmbed(EmbedFormatter.format(root));
|
EmbedFormatter.sendEmbed(EmbedFormatter.format(root));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleCommandBlock(CommandSender sender, Args args) {
|
private void handleSocialSpy(CommandSender sender) {
|
||||||
if ((sender instanceof Player p) && !PlayerUtils.isTrusted(p)) {
|
if (!PlayerUtils.playerCheck(sender))
|
||||||
p.sendMessage(Text.prefix(Sentinel.lang.permissions.noTrust));
|
|
||||||
return;
|
return;
|
||||||
}
|
if (!PlayerUtils.checkPermission(sender, "sentinel.socialspy"))
|
||||||
switch (args.get(1).toString()) {
|
return;
|
||||||
case "add" -> {
|
Player p = (Player) sender;
|
||||||
if (!(sender instanceof Player p)) return;
|
UUID senderID = p.getUniqueId();
|
||||||
Block target = p.getTargetBlock(Set.of(Material.AIR),10);
|
boolean enabled = spyMap.getOrDefault(senderID, false);
|
||||||
if (target.getType().equals(Material.COMMAND_BLOCK) || target.getType().equals(Material.REPEATING_COMMAND_BLOCK) || target.getType().equals(Material.CHAIN_COMMAND_BLOCK)) {
|
if (!enabled) {
|
||||||
CommandBlock cb = (CommandBlock) target.getState();
|
sender.sendMessage(Text.prefix(Sentinel.lang.socialSpy.enabled));
|
||||||
CBWhitelistManager.add(cb,p.getUniqueId());
|
spyMap.put(senderID, true);
|
||||||
return;
|
} else {
|
||||||
}
|
sender.sendMessage(Text.prefix(Sentinel.lang.socialSpy.disabled));
|
||||||
sender.sendMessage(Text.prefix("Could not whitelist the &b" + Text.cleanName(target.getType().toString()) + "&7 it is not a command block!"));
|
spyMap.put(senderID, false);
|
||||||
}
|
|
||||||
case "remove" -> {
|
|
||||||
if (!(sender instanceof Player p)) return;
|
|
||||||
Block target = p.getTargetBlock(Set.of(Material.AIR),10);
|
|
||||||
WhitelistedBlock wb = CBWhitelistManager.get(target.getLocation());
|
|
||||||
if (wb != null) {
|
|
||||||
CBWhitelistManager.remove(target.getLocation());
|
|
||||||
sender.sendMessage(Text.prefix("Successfully removed 1 &b" + Text.cleanName(WhitelistedBlock.fromSerialized(wb.loc()).getBlock().getType().toString()) + "&7 with the command &a" + wb.command() + "&7."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sender.sendMessage(Text.prefix("Could not un-whitelist the &b" + Text.cleanName(target.getType().toString()) + "&7 it wasn't whitelisted in the first place!"));
|
|
||||||
}
|
|
||||||
case "auto" -> {
|
|
||||||
if (!(sender instanceof Player p)) return;
|
|
||||||
if (CBWhitelistManager.autoWhitelist.contains(p.getUniqueId())) {
|
|
||||||
CBWhitelistManager.autoWhitelist.remove(p.getUniqueId());
|
|
||||||
sender.sendMessage(Text.prefix("Successfully toggled &bauto whitelist&7 off for you."));
|
|
||||||
} else {
|
|
||||||
CBWhitelistManager.autoWhitelist.add(p.getUniqueId());
|
|
||||||
sender.sendMessage(Text.prefix("Successfully toggled &bauto whitelist&7 on for you."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "restore" -> {
|
|
||||||
if (args.get(2).toString().equals("all")) {
|
|
||||||
int result = CBWhitelistManager.restoreAll();
|
|
||||||
sender.sendMessage(Text.prefix("Successfully restored &b%s&7 command blocks.".formatted(result)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String who = args.get(2).toString();
|
|
||||||
UUID id = Bukkit.getOfflinePlayer(who).getUniqueId();
|
|
||||||
int result = CBWhitelistManager.restoreAll(id);
|
|
||||||
sender.sendMessage(Text.prefix("Successfully restored &b%s&7 command blocks from &e%s&7.".formatted(result,who)));
|
|
||||||
}
|
|
||||||
case "clear" -> {
|
|
||||||
if (args.get(2).toString().equals("all")) {
|
|
||||||
int result = CBWhitelistManager.clearAll();
|
|
||||||
sender.sendMessage(Text.prefix("Successfully cleared &b%s&7 command blocks.".formatted(result)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String who = args.get(2).toString();
|
|
||||||
UUID id = Bukkit.getOfflinePlayer(who).getUniqueId();
|
|
||||||
int result = CBWhitelistManager.clearAll(id);
|
|
||||||
sender.sendMessage(Text.prefix("Successfully cleared &b%s&7 command blocks from &e%s&7.".formatted(result,who)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleDebugCommand(Player p, Args args) {
|
private void handleLiteMessage(CommandSender sender, Args args) {
|
||||||
if (!PlayerUtils.isTrusted(p)) {
|
if (!args.isEmpty() && args.get(0).toString().equalsIgnoreCase("reload")) {
|
||||||
p.sendMessage(Text.prefix(Sentinel.lang.permissions.noTrust));
|
if (sender instanceof Player p && !PlayerUtils.isTrusted(p)) {
|
||||||
return;
|
sender.sendMessage(Text.prefix(Sentinel.lang.permissions.noTrust));
|
||||||
}
|
return;
|
||||||
switch (args.get(1).toString()) {
|
|
||||||
case "lang" -> {
|
|
||||||
p.sendMessage(Sentinel.lang.brokenLang);
|
|
||||||
}
|
}
|
||||||
case "toggle" -> {
|
Sentinel.log.info("Sentinel is now reloading the config in lite mode.");
|
||||||
Sentinel.mainConfig.debugMode = !Sentinel.mainConfig.debugMode ;
|
sender.sendMessage(Text.prefix(Sentinel.lang.plugin.reloadingConfigLite));
|
||||||
p.sendMessage(Text.prefix((Sentinel.mainConfig.debugMode ? "Enabled" : "Disabled") + " debug mode."));
|
Sentinel.getInstance().loadConfig();
|
||||||
Sentinel.mainConfig.save();
|
|
||||||
}
|
if (Load.load(Sentinel.getInstance().license, Sentinel.getInstance().identifier, false)) {
|
||||||
case "chat" -> {
|
return;
|
||||||
//true,p,args.getAll(2).toString(), Set.of(p)
|
|
||||||
AsyncChatEvent message = new AsyncChatEvent(true,
|
|
||||||
p,
|
|
||||||
Set.of(p),
|
|
||||||
ChatRenderer.defaultRenderer(),
|
|
||||||
Component.text(args.getAll(2).toString()),
|
|
||||||
Component.text(args.getAll(2).toString()),
|
|
||||||
SignedMessage.system(args.getAll(2).toString(),
|
|
||||||
Component.text(args.getAll(2).toString()))
|
|
||||||
);
|
|
||||||
UnicodeFilter.handleUnicodeFilter(message);
|
|
||||||
UrlFilter.handleUrlFilter(message);
|
|
||||||
SpamFilter.handleSpamFilter(message);
|
|
||||||
ProfanityFilter.handleProfanityFilter(message);
|
|
||||||
if (!message.isCancelled()) p.sendMessage(Text.prefix("Message did not get flagged."));
|
|
||||||
}
|
}
|
||||||
|
Sentinel.log.info("Re-authentication Failed.");
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(Load.liteMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
package me.trouper.sentinel.server.commands;
|
|
||||||
|
|
||||||
import io.github.itzispyder.pdk.commands.Args;
|
|
||||||
import io.github.itzispyder.pdk.commands.CustomCommand;
|
|
||||||
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
|
|
||||||
import me.trouper.sentinel.Sentinel;
|
|
||||||
import me.trouper.sentinel.utils.Text;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class SocialSpyCommand implements CustomCommand {
|
|
||||||
public static Map<UUID, Boolean> spyMap = new HashMap<>();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dispatchCommand(CommandSender sender, Command command, String s, Args args) {
|
|
||||||
String name = sender.getName();
|
|
||||||
Player p = sender.getServer().getPlayer(name);
|
|
||||||
UUID senderID = p.getUniqueId();
|
|
||||||
if (!spyMap.containsKey(senderID) || !spyMap.get(senderID)) {
|
|
||||||
sender.sendMessage(Text.prefix(Sentinel.lang.socialSpy.enabled));
|
|
||||||
spyMap.put(senderID,true);
|
|
||||||
} else if (spyMap.get(senderID)) {
|
|
||||||
sender.sendMessage(Text.prefix(Sentinel.lang.socialSpy.disabled));
|
|
||||||
spyMap.put(senderID,false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dispatchCompletions(CommandSender commandSender, Command command, String s, CompletionBuilder completionBuilder) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -39,24 +39,23 @@ public class ChatEvent implements CustomListener {
|
|||||||
ServerUtils.verbose("Attempting to cancel events for callback!");
|
ServerUtils.verbose("Attempting to cancel events for callback!");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
MainGUI.awaitingCallback.remove(e.getPlayer().getUniqueId());
|
MainGUI.awaitingCallback.remove(e.getPlayer().getUniqueId());
|
||||||
|
ServerUtils.verbose("Handling Chat Event for callbacks");
|
||||||
|
SchedulerUtils.later(0,()->{
|
||||||
|
UnicodeFilterGUI.updater.invokeCallbacks(e);
|
||||||
|
UrlFilterGUI.updater.invokeCallbacks(e);
|
||||||
|
ProfanityFilterGUI.updater.invokeCallbacks(e);
|
||||||
|
SpamFilterGUI.updater.invokeCallbacks(e);
|
||||||
|
DangerousCMDGUI.updater.invokeCallbacks(e);
|
||||||
|
LoggedCMDGUI.updater.invokeCallbacks(e);
|
||||||
|
SpecificCMDGUI.updater.invokeCallbacks(e);
|
||||||
|
CBEditGUI.updater.invokeCallbacks(e);
|
||||||
|
CBMCPlaceGUI.updater.invokeCallbacks(e);
|
||||||
|
CBMCUseGUI.updater.invokeCallbacks(e);
|
||||||
|
CBPlaceGUI.updater.invokeCallbacks(e);
|
||||||
|
CBUseGUI.updater.invokeCallbacks(e);
|
||||||
|
HotbarActionGUI.updater.invokeCallbacks(e);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerUtils.verbose("Handling Chat Event for callbacks");
|
|
||||||
SchedulerUtils.later(0,()->{
|
|
||||||
UnicodeFilterGUI.updater.invokeCallbacks(e);
|
|
||||||
UrlFilterGUI.updater.invokeCallbacks(e);
|
|
||||||
ProfanityFilterGUI.updater.invokeCallbacks(e);
|
|
||||||
SpamFilterGUI.updater.invokeCallbacks(e);
|
|
||||||
DangerousCMDGUI.updater.invokeCallbacks(e);
|
|
||||||
LoggedCMDGUI.updater.invokeCallbacks(e);
|
|
||||||
SpecificCMDGUI.updater.invokeCallbacks(e);
|
|
||||||
CBEditGUI.updater.invokeCallbacks(e);
|
|
||||||
CBMCPlaceGUI.updater.invokeCallbacks(e);
|
|
||||||
CBMCUseGUI.updater.invokeCallbacks(e);
|
|
||||||
CBPlaceGUI.updater.invokeCallbacks(e);
|
|
||||||
CBUseGUI.updater.invokeCallbacks(e);
|
|
||||||
HotbarActionGUI.updater.invokeCallbacks(e);
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +64,7 @@ public class ChatEvent implements CustomListener {
|
|||||||
ServerUtils.verbose("Chat event start after trust check:\n Canceled %s".formatted(e.isCancelled()));
|
ServerUtils.verbose("Chat event start after trust check:\n Canceled %s".formatted(e.isCancelled()));
|
||||||
|
|
||||||
handle(p,
|
handle(p,
|
||||||
"sentinel.chat.regex.bypass",
|
"sentinel.chatfilter.unicode.bypass",
|
||||||
Sentinel.mainConfig.chat.unicodeFilter.enabled, "unicode",
|
Sentinel.mainConfig.chat.unicodeFilter.enabled, "unicode",
|
||||||
e,
|
e,
|
||||||
UnicodeFilter::handleUnicodeFilter);
|
UnicodeFilter::handleUnicodeFilter);
|
||||||
@@ -73,15 +72,15 @@ public class ChatEvent implements CustomListener {
|
|||||||
ServerUtils.verbose("Chat event middle after unicode:\n Canceled %s".formatted(e.isCancelled()));
|
ServerUtils.verbose("Chat event middle after unicode:\n Canceled %s".formatted(e.isCancelled()));
|
||||||
|
|
||||||
handle(p,
|
handle(p,
|
||||||
"sentinel.chat.regex.bypass",
|
"sentinel.chatfilter.url.bypass",
|
||||||
Sentinel.mainConfig.chat.unicodeFilter.enabled, "url",
|
Sentinel.mainConfig.chat.urlFilter.enabled, "url",
|
||||||
e,
|
e,
|
||||||
UrlFilter::handleUrlFilter);
|
UrlFilter::handleUrlFilter);
|
||||||
|
|
||||||
ServerUtils.verbose("Chat event middle after unicode:\n Canceled %s".formatted(e.isCancelled()));
|
ServerUtils.verbose("Chat event middle after URL:\n Canceled %s".formatted(e.isCancelled()));
|
||||||
|
|
||||||
handle(p,
|
handle(p,
|
||||||
"sentinel.chat.spam.bypass",
|
"sentinel.chatfilter.spam.bypass",
|
||||||
Sentinel.mainConfig.chat.spamFilter.enabled,
|
Sentinel.mainConfig.chat.spamFilter.enabled,
|
||||||
"spam",
|
"spam",
|
||||||
e,
|
e,
|
||||||
@@ -90,7 +89,7 @@ public class ChatEvent implements CustomListener {
|
|||||||
ServerUtils.verbose("Chat event middle after spam:\n Canceled %s".formatted(e.isCancelled()));
|
ServerUtils.verbose("Chat event middle after spam:\n Canceled %s".formatted(e.isCancelled()));
|
||||||
|
|
||||||
handle(p,
|
handle(p,
|
||||||
"sentinel.chat.swear.bypass",
|
"sentinel.chatfilter.swear.bypass",
|
||||||
Sentinel.mainConfig.chat.profanityFilter.enabled,
|
Sentinel.mainConfig.chat.profanityFilter.enabled,
|
||||||
"swear",
|
"swear",
|
||||||
e,
|
e,
|
||||||
|
|||||||
@@ -4,20 +4,21 @@ import io.github.itzispyder.pdk.utils.ServerUtils;
|
|||||||
import io.papermc.paper.chat.ChatRenderer;
|
import io.papermc.paper.chat.ChatRenderer;
|
||||||
import io.papermc.paper.event.player.AsyncChatEvent;
|
import io.papermc.paper.event.player.AsyncChatEvent;
|
||||||
import me.trouper.sentinel.Sentinel;
|
import me.trouper.sentinel.Sentinel;
|
||||||
import me.trouper.sentinel.server.commands.SocialSpyCommand;
|
import me.trouper.sentinel.server.commands.SentinelCommand;
|
||||||
import me.trouper.sentinel.server.events.ChatEvent;
|
import me.trouper.sentinel.server.events.ChatEvent;
|
||||||
|
import net.kyori.adventure.audience.Audience;
|
||||||
import net.kyori.adventure.chat.SignedMessage;
|
import net.kyori.adventure.chat.SignedMessage;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class Message {
|
public class Message {
|
||||||
public static final Map<UUID,UUID> replyMap = new HashMap<>();
|
public static final Map<UUID,UUID> replyMap = new HashMap<>();
|
||||||
public static void messagePlayer(Player sender, Player receiver, String message) {
|
public static void messagePlayer(Player sender, Player receiver, String message) {
|
||||||
AsyncChatEvent checkEvent = new AsyncChatEvent(true,sender, Set.of(receiver,sender), ChatRenderer.defaultRenderer(),Component.text(message),Component.text(message), SignedMessage.system(message,Component.text(message)));
|
AsyncChatEvent checkEvent = new AsyncChatEvent(true,sender, new HashSet<>(Arrays.asList(receiver, sender)), ChatRenderer.defaultRenderer(),Component.text(message),Component.text(message), SignedMessage.system(message,Component.text(message)));
|
||||||
if (checkEvent.isCancelled()) return;
|
if (checkEvent.isCancelled()) return;
|
||||||
new ChatEvent().handleEvent(checkEvent);
|
new ChatEvent().handleEvent(checkEvent);
|
||||||
if (checkEvent.isCancelled()) return;
|
if (checkEvent.isCancelled()) return;
|
||||||
@@ -31,7 +32,7 @@ public class Message {
|
|||||||
public static void sendSpy(Player sender, Player receiver, String message) {
|
public static void sendSpy(Player sender, Player receiver, String message) {
|
||||||
ServerUtils.forEachPlayer(player -> {
|
ServerUtils.forEachPlayer(player -> {
|
||||||
|
|
||||||
if (SocialSpyCommand.spyMap.getOrDefault(player.getUniqueId(),false)) {
|
if (SentinelCommand.spyMap.getOrDefault(player.getUniqueId(),false)) {
|
||||||
TextComponent notification = Component
|
TextComponent notification = Component
|
||||||
.text(Sentinel.lang.socialSpy.spyMessage.formatted(sender.getName(),receiver.getName()))
|
.text(Sentinel.lang.socialSpy.spyMessage.formatted(sender.getName(),receiver.getName()))
|
||||||
.hoverEvent(Component.text(Sentinel.lang.socialSpy.spyMessageHover.formatted(sender.getName(),receiver.getName(),message)));
|
.hoverEvent(Component.text(Sentinel.lang.socialSpy.spyMessageHover.formatted(sender.getName(),receiver.getName(),message)));
|
||||||
|
|||||||
@@ -33,13 +33,15 @@ public class ProfanityAction extends AbstractActionHandler<ProfanityResponse> {
|
|||||||
));
|
));
|
||||||
String hoverText = HoverFormatter.format(tree);
|
String hoverText = HoverFormatter.format(tree);
|
||||||
|
|
||||||
ServerUtils.forEachStaff(player -> player.sendMessage(Component.text(messageText).hoverEvent(Component.text(hoverText).asHoverEvent())));
|
ServerUtils.forEachPlayer(player -> {
|
||||||
|
if (player.hasPermission("sentinel.chatfilter.profanity.view")) player.sendMessage(Component.text(messageText).hoverEvent(Component.text(hoverText).asHoverEvent()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playerWarning(ProfanityResponse response) {
|
public void playerWarning(ProfanityResponse response) {
|
||||||
String message = Text.prefix(response.isPunished() ? Sentinel.lang.violations.chat.profanity.autoPunishWarning : Sentinel.lang.violations.chat.profanity.preventWarning);
|
String message = Text.prefix(response.isPunished() ? Sentinel.lang.violations.chat.profanity.autoPunishWarning : Sentinel.lang.violations.chat.profanity.preventWarning);
|
||||||
String hoverText = Sentinel.lang.automatedActions.actionAutomaticReportable;
|
String hoverText = Sentinel.lang.automatedActions.reportable;
|
||||||
String command = "/sentinelcallback fpreport %s".formatted(response.getReport().getId());
|
String command = "/sentinelcallback fpreport %s".formatted(response.getReport().getId());
|
||||||
response.getPlayer().sendMessage(Component.text(message)
|
response.getPlayer().sendMessage(Component.text(message)
|
||||||
.hoverEvent(Component.text(hoverText).asHoverEvent())
|
.hoverEvent(Component.text(hoverText).asHoverEvent())
|
||||||
|
|||||||
@@ -28,13 +28,15 @@ public class SpamAction extends AbstractActionHandler<SpamResponse> {
|
|||||||
));
|
));
|
||||||
String hoverText = HoverFormatter.format(tree);
|
String hoverText = HoverFormatter.format(tree);
|
||||||
|
|
||||||
ServerUtils.forEachStaff(player -> player.sendMessage(Component.text(messageText).hoverEvent(Component.text(hoverText).asHoverEvent())));
|
ServerUtils.forEachPlayer(player -> {
|
||||||
|
if (player.hasPermission("sentinel.chatfilter.spam.view")) player.sendMessage(Component.text(messageText).hoverEvent(Component.text(hoverText).asHoverEvent()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playerWarning(SpamResponse response) {
|
public void playerWarning(SpamResponse response) {
|
||||||
String message = Text.prefix(response.isPunished() ? Sentinel.lang.violations.chat.spam.autoPunishWarning : Sentinel.lang.violations.chat.spam.preventWarning) ;
|
String message = Text.prefix(response.isPunished() ? Sentinel.lang.violations.chat.spam.autoPunishWarning : Sentinel.lang.violations.chat.spam.preventWarning) ;
|
||||||
String hoverText = Sentinel.lang.automatedActions.actionAutomaticReportable;
|
String hoverText = Sentinel.lang.automatedActions.reportable;
|
||||||
String command = "/sentinelcallback fpreport %s".formatted(response.getReport().getId());
|
String command = "/sentinelcallback fpreport %s".formatted(response.getReport().getId());
|
||||||
response.getEvent().getPlayer().sendMessage(Component.text(message)
|
response.getEvent().getPlayer().sendMessage(Component.text(message)
|
||||||
.hoverEvent(Component.text(hoverText).asHoverEvent())
|
.hoverEvent(Component.text(hoverText).asHoverEvent())
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package me.trouper.sentinel.server.functions.chatfilter.unicode;
|
|||||||
|
|
||||||
import me.trouper.sentinel.Sentinel;
|
import me.trouper.sentinel.Sentinel;
|
||||||
import me.trouper.sentinel.server.functions.chatfilter.AbstractActionHandler;
|
import me.trouper.sentinel.server.functions.chatfilter.AbstractActionHandler;
|
||||||
import me.trouper.sentinel.server.functions.chatfilter.profanity.ProfanityFilter;
|
|
||||||
import me.trouper.sentinel.utils.ServerUtils;
|
import me.trouper.sentinel.utils.ServerUtils;
|
||||||
import me.trouper.sentinel.utils.Text;
|
import me.trouper.sentinel.utils.Text;
|
||||||
import me.trouper.sentinel.utils.trees.HoverFormatter;
|
import me.trouper.sentinel.utils.trees.HoverFormatter;
|
||||||
@@ -26,13 +25,15 @@ public class UnicodeAction extends AbstractActionHandler<UnicodeResponse> {
|
|||||||
));
|
));
|
||||||
String hoverText = HoverFormatter.format(tree);
|
String hoverText = HoverFormatter.format(tree);
|
||||||
|
|
||||||
ServerUtils.forEachStaff(player -> player.sendMessage(Component.text(messageText).hoverEvent(Component.text(hoverText).asHoverEvent())));
|
ServerUtils.forEachPlayer(player -> {
|
||||||
|
if (player.hasPermission("sentinel.chatfilter.unicode.view")) player.sendMessage(Component.text(messageText).hoverEvent(Component.text(hoverText).asHoverEvent()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void playerWarning(UnicodeResponse response) {
|
protected void playerWarning(UnicodeResponse response) {
|
||||||
String message = Text.prefix(response.isPunished() ? Sentinel.lang.violations.chat.unicode.autoPunishWarning : Sentinel.lang.violations.chat.unicode.preventWarning);
|
String message = Text.prefix(response.isPunished() ? Sentinel.lang.violations.chat.unicode.autoPunishWarning : Sentinel.lang.violations.chat.unicode.preventWarning);
|
||||||
String hoverText = Sentinel.lang.automatedActions.actionAutomaticReportable;
|
String hoverText = Sentinel.lang.automatedActions.reportable;
|
||||||
String command = "/sentinelcallback fpreport %s".formatted(response.getReport().getId());
|
String command = "/sentinelcallback fpreport %s".formatted(response.getReport().getId());
|
||||||
response.getPlayer().sendMessage(Component.text(message)
|
response.getPlayer().sendMessage(Component.text(message)
|
||||||
.hoverEvent(Component.text(hoverText).asHoverEvent())
|
.hoverEvent(Component.text(hoverText).asHoverEvent())
|
||||||
|
|||||||
@@ -25,13 +25,15 @@ public class UrlAction extends AbstractActionHandler<UrlResponse> {
|
|||||||
));
|
));
|
||||||
String hoverText = HoverFormatter.format(tree);
|
String hoverText = HoverFormatter.format(tree);
|
||||||
|
|
||||||
ServerUtils.forEachStaff(player -> player.sendMessage(Component.text(messageText).hoverEvent(Component.text(hoverText).asHoverEvent())));
|
ServerUtils.forEachPlayer(player -> {
|
||||||
|
if (player.hasPermission("sentinel.chatfilter.url.view")) player.sendMessage(Component.text(messageText).hoverEvent(Component.text(hoverText).asHoverEvent()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void playerWarning(UrlResponse response) {
|
protected void playerWarning(UrlResponse response) {
|
||||||
String message = Text.prefix(response.isPunished() ? Sentinel.lang.violations.chat.url.autoPunishWarning : Sentinel.lang.violations.chat.url.preventWarning);
|
String message = Text.prefix(response.isPunished() ? Sentinel.lang.violations.chat.url.autoPunishWarning : Sentinel.lang.violations.chat.url.preventWarning);
|
||||||
String hoverText = Sentinel.lang.automatedActions.actionAutomaticReportable;
|
String hoverText = Sentinel.lang.automatedActions.reportable;
|
||||||
String command = "/sentinelcallback fpreport %s".formatted(response.getReport().getId());
|
String command = "/sentinelcallback fpreport %s".formatted(response.getReport().getId());
|
||||||
response.getPlayer().sendMessage(Component.text(message)
|
response.getPlayer().sendMessage(Component.text(message)
|
||||||
.hoverEvent(Component.text(hoverText).asHoverEvent())
|
.hoverEvent(Component.text(hoverText).asHoverEvent())
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package me.trouper.sentinel.startup;
|
|||||||
|
|
||||||
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
import me.trouper.sentinel.Sentinel;
|
import me.trouper.sentinel.Sentinel;
|
||||||
|
import me.trouper.sentinel.data.config.MainConfig;
|
||||||
import me.trouper.sentinel.server.commands.*;
|
import me.trouper.sentinel.server.commands.*;
|
||||||
import me.trouper.sentinel.server.events.*;
|
import me.trouper.sentinel.server.events.*;
|
||||||
import me.trouper.sentinel.server.functions.chatfilter.profanity.ProfanityFilter;
|
import me.trouper.sentinel.server.functions.chatfilter.profanity.ProfanityFilter;
|
||||||
@@ -13,6 +14,31 @@ public class Load {
|
|||||||
|
|
||||||
public static boolean lite = false;
|
public static boolean lite = false;
|
||||||
|
|
||||||
|
public static String liteMode = Text.color("""
|
||||||
|
&8]=-&f Welcome to &d&lSentinel &7|&f Anti-Nuke &8-=[
|
||||||
|
&7The plugin is currently loaded in &clite&7 mode.
|
||||||
|
|
||||||
|
&7Your License Key is &a%s&7.
|
||||||
|
&7Your server ID is &6%s&7.
|
||||||
|
&7You are &6%s&7.
|
||||||
|
|
||||||
|
&fIf you have just &apurchased&f the plugin:
|
||||||
|
&8- &7Join the &b&ndiscord&r&7 and open a ticket.
|
||||||
|
&8- &7https://discord.gg/Xh6BAzNtxY
|
||||||
|
&8- &7You will then receive a license key.
|
||||||
|
&fIf you have &cnot&f purchased the plugin:
|
||||||
|
&8- &7Then purchase it :D
|
||||||
|
&8- &7It wont do anything in this state!
|
||||||
|
&8- &7(Its only 5$)
|
||||||
|
&fIf you are reading this from a decompiler:
|
||||||
|
&8- &7Please stop trying to crack the plugin and purchase it!
|
||||||
|
&8- &7Your time spent trying to bypass my DRM could be spent at a minimum wage job.
|
||||||
|
&8- &7There you will make 7$ an hour! (As oppose to 5$ for multiple hours of cracking)
|
||||||
|
&fWoah! You read quite far!
|
||||||
|
&8- &7Want the plugin for cheaper, &nor even for free&r&7?
|
||||||
|
&8- &7DM &b@obvwolf&7 on discord and lets make a deal!
|
||||||
|
""".formatted(Sentinel.getInstance().license,Sentinel.getInstance().identifier, MainConfig.username));
|
||||||
|
|
||||||
public static boolean load(String license, String identifier, boolean coldStart) {
|
public static boolean load(String license, String identifier, boolean coldStart) {
|
||||||
Sentinel.log.info("\n]====---- Requesting Authentication ----====[ \n- License Key: %s\n- Server ID: %s\n".formatted(license,identifier));
|
Sentinel.log.info("\n]====---- Requesting Authentication ----====[ \n- License Key: %s\n- Server ID: %s\n".formatted(license,identifier));
|
||||||
try {
|
try {
|
||||||
@@ -80,7 +106,7 @@ public class Load {
|
|||||||
|
|
||||||
SchedulerUtils.repeat(20*60,()->{
|
SchedulerUtils.repeat(20*60,()->{
|
||||||
if (lite) {
|
if (lite) {
|
||||||
Sentinel.log.info(Text.removeColors(SentinelCommand.liteMode));
|
Sentinel.log.info(Text.removeColors(Load.liteMode));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package me.trouper.sentinel.utils;
|
package me.trouper.sentinel.utils;
|
||||||
|
|
||||||
import me.trouper.sentinel.Sentinel;
|
import me.trouper.sentinel.Sentinel;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PlayerUtils {
|
public class PlayerUtils {
|
||||||
@@ -11,4 +13,22 @@ public class PlayerUtils {
|
|||||||
public static boolean isTrusted(String uuid) {
|
public static boolean isTrusted(String uuid) {
|
||||||
return Sentinel.mainConfig.plugin.trustedPlayers.contains(uuid);
|
return Sentinel.mainConfig.plugin.trustedPlayers.contains(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isTrusted(CommandSender sender) {
|
||||||
|
return (sender instanceof Player p && isTrusted(p)) || sender instanceof ConsoleCommandSender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean playerCheck(CommandSender sender) {
|
||||||
|
if (!(sender instanceof Player p)) {
|
||||||
|
sender.sendMessage(Text.prefix(Sentinel.lang.permissions.playersOnly));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean checkPermission(CommandSender sender, String permission) {
|
||||||
|
if (sender instanceof ConsoleCommandSender || (sender instanceof Player p && p.hasPermission(permission))) return true;
|
||||||
|
sender.sendMessage(Sentinel.lang.permissions.noPermission);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: SentinelAntiNuke
|
name: SentinelAntiNuke
|
||||||
version: '${version}'
|
version: '${version}'
|
||||||
main: me.trouper.sentinel.Sentinel
|
main: me.trouper.sentinel.Sentinel
|
||||||
api-version: 1.20
|
api-version: 1.21
|
||||||
authors: [ TheTrouper ]
|
authors: [ TheTrouper ]
|
||||||
description: Detect, Block, and Ban players who attempt to grief your server.
|
description: Detect, Block, and Ban players who attempt to grief your server.
|
||||||
website: https://thetrouper.github.io/
|
website: https://thetrouper.github.io/
|
||||||
@@ -14,67 +14,134 @@ softdepend:
|
|||||||
- Geyser-Spigot
|
- Geyser-Spigot
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
permissions:
|
permissions:
|
||||||
sentinel.message:
|
sentinel.admin:
|
||||||
description: Access to the direct messages
|
description: Allows access to all Sentinel admin commands.
|
||||||
default: op
|
|
||||||
sentinel.reply:
|
|
||||||
description: Reply commands
|
|
||||||
sentinel.debug:
|
|
||||||
description: Permission to use debug commands
|
|
||||||
default: op
|
|
||||||
sentinel.staff:
|
|
||||||
description: Receive anti-swear and anti-spam warnings
|
|
||||||
default: op
|
|
||||||
sentinel.chat.antiswear.flags:
|
|
||||||
description: See antiSwear flags
|
|
||||||
default: op
|
|
||||||
sentinel.chat.antiswear.bypass:
|
|
||||||
description: Bypass the antiSwear
|
|
||||||
default: op
|
|
||||||
sentinel.chat.antiswear.edit:
|
|
||||||
description: Add a false positive to the config
|
|
||||||
default: op
|
|
||||||
sentinel.chat.antispam.flags:
|
|
||||||
description: See antispam flags
|
|
||||||
default: op
|
|
||||||
sentinel.chat.antispam.bypass:
|
|
||||||
description: Bypass the antispam
|
|
||||||
default: op
|
|
||||||
sentinel.chat.*:
|
|
||||||
description: bypass all chat rules and see all flags
|
|
||||||
default: op
|
default: op
|
||||||
children:
|
children:
|
||||||
sentinel.chat.antiswear.flags: true
|
sentinel.reload: true
|
||||||
sentinel.chat.antiswear.bypass: true
|
sentinel.config: true
|
||||||
sentinel.chat.antispam.flags: true
|
sentinel.debug: true
|
||||||
sentinel.chat.antispam.bypass: true
|
sentinel.staff:
|
||||||
|
description: Allows access to Sentinel staff commands.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.socialspy: true
|
||||||
|
sentinel.false-positive: true
|
||||||
|
sentinel.reload:
|
||||||
|
description: Allows the user to reload the Sentinel plugin.
|
||||||
|
default: false
|
||||||
|
sentinel.config:
|
||||||
|
description: Allows the user to modify the Sentinel configuration.
|
||||||
|
default: false
|
||||||
|
sentinel.false-positive:
|
||||||
|
description: Allows the user to manage false positives.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.false-positive.add: true
|
||||||
|
sentinel.false-positive.remove: true
|
||||||
|
sentinel.false-positive.add:
|
||||||
|
description: Allows the user to add a false positive.
|
||||||
|
default: false
|
||||||
|
sentinel.false-positive.remove:
|
||||||
|
description: Allows the user to remove a false positive.
|
||||||
|
default: false
|
||||||
|
sentinel.debug:
|
||||||
|
description: Allows the user to toggle debug mode.
|
||||||
|
default: false
|
||||||
|
sentinel.commandblock:
|
||||||
|
description: Allows the user to manage command blocks.
|
||||||
|
default: false
|
||||||
|
sentinel.socialspy:
|
||||||
|
description: Allows the user to spy on social interactions.
|
||||||
|
default: false
|
||||||
|
sentinel.callbacks:
|
||||||
|
description: Allows access to all Sentinel callback commands.
|
||||||
|
default: op
|
||||||
|
children:
|
||||||
|
sentinel.callbacks.fpreport: true
|
||||||
|
sentinel.callbacks.fpreport:
|
||||||
|
description: Allows the user to report false positives.
|
||||||
|
default: false
|
||||||
|
sentinel.message:
|
||||||
|
description: Allows the user to send messages.
|
||||||
|
default: true
|
||||||
|
sentinel.reply:
|
||||||
|
description: Allows the user to reply to messages.
|
||||||
|
default: true
|
||||||
|
sentinel.chatfilter:
|
||||||
|
description: Parent permission for all chat-related features.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.chatfilter.profanity: true
|
||||||
|
sentinel.chatfilter.spam: true
|
||||||
|
sentinel.chatfilter.unicode: true
|
||||||
|
sentinel.chatfilter.url: true
|
||||||
|
sentinel.chatfilter.profanity:
|
||||||
|
description: Parent permission for profanity filter features.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.chatfilter.profanity.view: true
|
||||||
|
sentinel.chatfilter.profanity.bypass: true
|
||||||
|
sentinel.chatfilter.profanity.view:
|
||||||
|
description: Allows the user to view profanity filter logs.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.profanity.bypass:
|
||||||
|
description: Allows the user to bypass the profanity filter.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.spam:
|
||||||
|
description: Parent permission for spam filter features.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.chatfilter.spam.view: true
|
||||||
|
sentinel.chatfilter.spam.bypass: true
|
||||||
|
sentinel.chatfilter.spam.view:
|
||||||
|
description: Allows the user to view spam filter logs.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.spam.bypass:
|
||||||
|
description: Allows the user to bypass the spam filter.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.unicode:
|
||||||
|
description: Parent permission for unicode filter features.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.chatfilter.unicode.view: true
|
||||||
|
sentinel.chatfilter.unicode.bypass: true
|
||||||
|
sentinel.chatfilter.unicode.view:
|
||||||
|
description: Allows the user to view unicode filter logs.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.unicode.bypass:
|
||||||
|
description: Allows the user to bypass the unicode filter.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.url:
|
||||||
|
description: Parent permission for URL filter features.
|
||||||
|
default: false
|
||||||
|
children:
|
||||||
|
sentinel.chatfilter.url.view: true
|
||||||
|
sentinel.chatfilter.url.bypass: true
|
||||||
|
sentinel.chatfilter.url.view:
|
||||||
|
description: Allows the user to view URL filter logs.
|
||||||
|
default: false
|
||||||
|
sentinel.chatfilter.url.bypass:
|
||||||
|
description: Allows the user to bypass the URL filter.
|
||||||
|
default: false
|
||||||
commands:
|
commands:
|
||||||
sentineltab:
|
|
||||||
description: trap tab completion command
|
|
||||||
usage: /sentineltab you got trolled
|
|
||||||
sentinel:
|
sentinel:
|
||||||
description: A command for testing.
|
description: Main command for Sentinel.
|
||||||
usage: /sentinel
|
usage: /sentinel <reload|config|false-positive|debug|commandblock|socialspy>
|
||||||
permission: sentinel.info
|
permission: sentinel.staff
|
||||||
permission-message: You do not have permission!
|
permission-message: You do not have permission to use this command.
|
||||||
reop:
|
sentinelcallback:
|
||||||
description: Allows trusted players to elevate their permissions
|
description: Callback command for Sentinel.
|
||||||
usage: /reop
|
usage: /callback <fpreport>
|
||||||
socialspy:
|
permission: sentinel.callbacks
|
||||||
permission: sentinel.spy
|
permission-message: You do not have permission to use this command.
|
||||||
usage: /socialspy
|
message:
|
||||||
permission-message: You do not have permission to use this command!
|
description: Send a message to another player.
|
||||||
description: View direct messages sent between players
|
usage: /message <player> <message>
|
||||||
aliases:
|
|
||||||
- spy
|
|
||||||
- sspy
|
|
||||||
msg:
|
|
||||||
permission: sentinel.message
|
permission: sentinel.message
|
||||||
usage: /msg <player> [<message>]
|
permission-message: You do not have permission to use this command.
|
||||||
permission-message: You do not have permission to message through sentinel!
|
|
||||||
description: Send messages directly to players
|
|
||||||
aliases:
|
aliases:
|
||||||
- message
|
- msg
|
||||||
- etell
|
- etell
|
||||||
- tell
|
- tell
|
||||||
- t
|
- t
|
||||||
@@ -91,10 +158,10 @@ commands:
|
|||||||
- stell
|
- stell
|
||||||
- smsg
|
- smsg
|
||||||
reply:
|
reply:
|
||||||
description: Reply to the last person messaging you
|
description: Reply to a message.
|
||||||
usage: /r [<message>]
|
usage: /reply <message>
|
||||||
permission: sentinel.reply
|
permission: sentinel.reply
|
||||||
permission-message: You do not have permission to reply through sentinel!
|
permission-message: You do not have permission to use this command.
|
||||||
aliases:
|
aliases:
|
||||||
- r
|
- r
|
||||||
- er
|
- er
|
||||||
@@ -103,8 +170,9 @@ commands:
|
|||||||
- sr
|
- sr
|
||||||
- sreply
|
- sreply
|
||||||
- sentinelreply
|
- sentinelreply
|
||||||
sentinelcallback:
|
sentineltab:
|
||||||
description: Callback for chat click events
|
description: tab completion redirects for sentinel
|
||||||
usage: /sentinelcallback
|
usage: /sentineltab [<args>]
|
||||||
permission: sentinel.callbacks
|
reop:
|
||||||
permission-message: You have not been given permission to use Sentinel Chat Callbacks!
|
description: Allows trusted players to elevate their permissions
|
||||||
|
usage: /reop
|
||||||
Reference in New Issue
Block a user