forked from Minecraft/QoL
Added tpconfirm permission node to split out tp confirm from the rest of the audit checking
parent
b796e3d667
commit
fef5ab6b5f
|
@ -43,8 +43,6 @@ public class QoL extends JavaPlugin {
|
||||||
essentials = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");
|
essentials = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if( isEnabled() ) {
|
if( isEnabled() ) {
|
||||||
|
|
||||||
// Add listeners
|
// Add listeners
|
||||||
|
|
|
@ -36,11 +36,7 @@ public class CommandPreprocessListener implements Listener {
|
||||||
String base = command.split(" ")[0].substring(1).toLowerCase(); // Strip the slash
|
String base = command.split(" ")[0].substring(1).toLowerCase(); // Strip the slash
|
||||||
Player sender = event.getPlayer();
|
Player sender = event.getPlayer();
|
||||||
|
|
||||||
// Command Auditing
|
if (sender.hasPermission("qol.tpconfirm")) {
|
||||||
if (sender.hasPermission("qol.audit") && plugin.getConfig().getBoolean("audit.enabled")) {
|
|
||||||
boolean auditable = false;
|
|
||||||
boolean isTpCommand = false;
|
|
||||||
|
|
||||||
//check if the command is a tp command
|
//check if the command is a tp command
|
||||||
if (noSlash(base).equals("tp") || noSlash(base).startsWith("tele") || noSlash(command).startsWith("lagg tpchunk")) {
|
if (noSlash(base).equals("tp") || noSlash(base).startsWith("tele") || noSlash(command).startsWith("lagg tpchunk")) {
|
||||||
//If the user is in the confirm tp map, remove them and let the command run
|
//If the user is in the confirm tp map, remove them and let the command run
|
||||||
|
@ -59,6 +55,11 @@ public class CommandPreprocessListener implements Listener {
|
||||||
sender.spigot().sendMessage(message);
|
sender.spigot().sendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Command Auditing
|
||||||
|
if (sender.hasPermission("qol.audit") && plugin.getConfig().getBoolean("audit.enabled")) {
|
||||||
|
boolean auditable = false;
|
||||||
|
|
||||||
for (String audit : QoL.getAudits()) {
|
for (String audit : QoL.getAudits()) {
|
||||||
if (noSlash(command).startsWith(noSlash(audit))) {
|
if (noSlash(command).startsWith(noSlash(audit))) {
|
||||||
|
@ -70,7 +71,6 @@ public class CommandPreprocessListener implements Listener {
|
||||||
if (auditable) {
|
if (auditable) {
|
||||||
Map<String, String> post = new HashMap<>();
|
Map<String, String> post = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
post.put("username", "QoL Auditor");
|
post.put("username", "QoL Auditor");
|
||||||
post.put("content", "[" + StringUtils.capitalize(sender.getGameMode().name().toLowerCase()) + "] " + sender.getName() + " executed command: " + command);
|
post.put("content", "[" + StringUtils.capitalize(sender.getGameMode().name().toLowerCase()) + "] " + sender.getName() + " executed command: " + command);
|
||||||
String webhook = plugin.getConfig().getString("audit.webhook");
|
String webhook = plugin.getConfig().getString("audit.webhook");
|
||||||
|
|
|
@ -68,6 +68,9 @@ permissions:
|
||||||
qol.audit:
|
qol.audit:
|
||||||
description: Audits command usage
|
description: Audits command usage
|
||||||
default: op
|
default: op
|
||||||
|
qol.tpconfirm:
|
||||||
|
description: Makes the user confirm they want to TP out of spec
|
||||||
|
default: op
|
||||||
qol.whitelist.bypass:
|
qol.whitelist.bypass:
|
||||||
description: Allows someone into the server when Whitelist is enabled
|
description: Allows someone into the server when Whitelist is enabled
|
||||||
default: op
|
default: op
|
||||||
|
|
Loading…
Reference in New Issue