1.1.3-pre1
Action permissions
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: AuxProtectBungee
|
||||
main: dev.heliosares.auxprotect.bungee.AuxProtectBungee
|
||||
version: 1.1.2
|
||||
version: 1.1.3-pre1
|
||||
author: Heliosares
|
||||
@@ -4,6 +4,7 @@ no-permission: '&cYou don''t have permission for that.'
|
||||
no-permission-flag: '&cYou don''t have permission for that flag.'
|
||||
lookup-invalid-parameter: '&cInvalid parameter: %s'
|
||||
lookup-invalid-syntax: '&cInvalid syntax.'
|
||||
lookup-invalid-notenough: '&cNot enough arguments.'
|
||||
lookup-error: '&cAn error occured'
|
||||
lookup-unknown-world: '&cUnknown world: %s'
|
||||
lookup-looking: '&9Searching database...'
|
||||
@@ -16,6 +17,7 @@ lookup-toomany: '&cToo many entries. Try narrowing your search. (Over %d entries
|
||||
lookup-incompatible-tables: '&cThose actions are incompatible.'
|
||||
lookup-action-negate: '&cYou cannot negate actions.'
|
||||
lookup-action-perm: '&cYou do not have permission to lookup that action.'
|
||||
lookup-action-none: '&cYou must specify an action.'
|
||||
command-help-1: '&cYou don''t have a lookup to page through.'
|
||||
purge-purging: '&9Purging ''%s''...'
|
||||
purge-uids: '&9Purging unused UIDs...'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: AuxProtect
|
||||
version: 1.1.2
|
||||
version: 1.1.3-pre1
|
||||
main: dev.heliosares.auxprotect.AuxProtect
|
||||
description: A plugin designed to supplement CoreProtect in a few ways.
|
||||
api-version: 1.13
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>AuxProtect</groupId>
|
||||
<artifactId>AuxProtect</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>1.1.3-pre1</version>
|
||||
<name>AuxProtect</name>
|
||||
<build>
|
||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||
|
||||
@@ -12,6 +12,7 @@ import dev.heliosares.auxprotect.database.DbEntry;
|
||||
import dev.heliosares.auxprotect.database.EntryAction;
|
||||
import dev.heliosares.auxprotect.database.Results;
|
||||
import dev.heliosares.auxprotect.database.SQLManager.LookupException;
|
||||
import dev.heliosares.auxprotect.database.Table;
|
||||
import dev.heliosares.auxprotect.utils.ActivitySolver;
|
||||
import dev.heliosares.auxprotect.utils.MoneySolver;
|
||||
import dev.heliosares.auxprotect.utils.MyPermission;
|
||||
@@ -202,7 +203,19 @@ public class LookupCommand {
|
||||
return;
|
||||
}
|
||||
String param = split[1];
|
||||
if (token.equalsIgnoreCase("time") || token.equalsIgnoreCase("before")
|
||||
if (token.equalsIgnoreCase("action")) {
|
||||
for (String actionStr : param.split(",")) {
|
||||
EntryAction action = EntryAction.getAction(actionStr);
|
||||
if (action == null) {
|
||||
continue;
|
||||
}
|
||||
if (!MyPermission.LOOKUP.hasPermission("action." + action.toString().toLowerCase(),
|
||||
sender)) {
|
||||
sender.sendMessage(String.format(plugin.translate("lookup-action-perm"), param));
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (token.equalsIgnoreCase("time") || token.equalsIgnoreCase("before")
|
||||
|| token.equalsIgnoreCase("after")) {
|
||||
if (param.contains("-")) {
|
||||
String[] range = param.split("-");
|
||||
@@ -252,9 +265,18 @@ public class LookupCommand {
|
||||
params.put(token, param.toLowerCase());
|
||||
}
|
||||
if (params.size() < 1) {
|
||||
sender.sendMessage(plugin.translate("purge-error-notenough"));
|
||||
sender.sendMessage(plugin.translate("lookup-invalid-notenough"));
|
||||
return;
|
||||
}
|
||||
if (!params.containsKey("action")) {
|
||||
for (EntryAction action : EntryAction.values()) {
|
||||
if (action.getTable() == Table.AUXPROTECT_MAIN && !MyPermission.LOOKUP
|
||||
.hasPermission("action." + action.toString().toLowerCase(), sender)) {
|
||||
sender.sendMessage(plugin.translate("lookup-action-none"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bw) {
|
||||
String user = params.get("user");
|
||||
final String targetOld = params.get("target");
|
||||
|
||||
@@ -902,9 +902,10 @@ public class SQLManager {
|
||||
}
|
||||
String build = "";
|
||||
boolean escape = false;
|
||||
final boolean allowEscape = key.equalsIgnoreCase("target") || key.equalsIgnoreCase("data");
|
||||
ArrayList<String> values = new ArrayList<>();
|
||||
for (char current : value.toCharArray()) {
|
||||
if (current == '\\') {
|
||||
if (allowEscape && current == '\\') {
|
||||
escape = true;
|
||||
continue;
|
||||
}
|
||||
@@ -970,12 +971,6 @@ public class SQLManager {
|
||||
throw new LookupException(LookupExceptionType.UNKNOWN_ACTION,
|
||||
String.format(plugin.translate("lookup-unknownaction"), param));
|
||||
} else {
|
||||
/*
|
||||
* TODO if (sender != null) { if
|
||||
* (!MyPermission.LOOKUP.hasPermission(action.toString().toLowerCase(), sender))
|
||||
* { sender.sendMessage(String.format(plugin.translate("lookup-action-perm"),
|
||||
* param)); return null; } }
|
||||
*/
|
||||
if (table == null) {
|
||||
table = action.getTable();
|
||||
} else {
|
||||
|
||||
@@ -19,27 +19,19 @@ public enum MyPermission {
|
||||
return player.hasPermission(node);
|
||||
}
|
||||
|
||||
public boolean hasPermission(org.bukkit.command.CommandSender player) {
|
||||
public boolean hasPermission(MySender player) {
|
||||
return player.hasPermission(node);
|
||||
}
|
||||
|
||||
public boolean hasPermission(MySender player) {
|
||||
return player.hasPermission(node);
|
||||
public boolean hasPermission(String dot, MySender player) {
|
||||
return player.hasPermission(node + "." + dot);
|
||||
}
|
||||
|
||||
public boolean hasPermission(net.md_5.bungee.api.CommandSender player) {
|
||||
return player.hasPermission(node);
|
||||
}
|
||||
|
||||
public boolean hasPermission(String dot, Player player) {
|
||||
return player.hasPermission(node + "." + dot);
|
||||
}
|
||||
|
||||
public boolean hasPermission(String dot, org.bukkit.command.CommandSender player) {
|
||||
return player.hasPermission(node + "." + dot);
|
||||
}
|
||||
|
||||
public boolean hasPermission(String dot, net.md_5.bungee.api.CommandSender player) {
|
||||
return player.hasPermission(node + "." + dot);
|
||||
public boolean hasPermission(org.bukkit.command.CommandSender player) {
|
||||
return player.hasPermission(node);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user