Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-13 22:50:06 +01:00
Make testPermission correctly check WEPIF/whatevermethodthecommandsmanagerisusing for permissions in the command
Dieser Commit ist enthalten in:
Ursprung
b938aa0be3
Commit
0cb0358bd2
@ -19,7 +19,10 @@
|
|||||||
|
|
||||||
package com.sk89q.bukkit.util;
|
package com.sk89q.bukkit.util;
|
||||||
|
|
||||||
|
import com.sk89q.minecraft.util.commands.CommandsManager;
|
||||||
import com.sk89q.util.StringUtil;
|
import com.sk89q.util.StringUtil;
|
||||||
|
import com.sk89q.wepif.PermissionsResolverManager;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.PluginIdentifiableCommand;
|
import org.bukkit.command.PluginIdentifiableCommand;
|
||||||
@ -72,4 +75,31 @@ public class DynamicPluginCommand extends org.bukkit.command.Command implements
|
|||||||
public Plugin getPlugin() {
|
public Plugin getPlugin() {
|
||||||
return owningPlugin;
|
return owningPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean testPermissionSilent(CommandSender sender) {
|
||||||
|
if (permissions == null || permissions.length == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (registeredWith instanceof CommandsManager<?>) {
|
||||||
|
try {
|
||||||
|
for (String permission : permissions) {
|
||||||
|
if (((CommandsManager<?>) registeredWith).hasPermission(sender, permission)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} catch (Throwable ignore) {
|
||||||
|
}
|
||||||
|
} else if (PermissionsResolverManager.isInitialized() && sender instanceof OfflinePlayer) {
|
||||||
|
for (String permission : permissions) {
|
||||||
|
if (PermissionsResolverManager.getInstance().hasPermission((OfflinePlayer) sender, permission)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.testPermissionSilent(sender);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren