完善 @TCommand 注解
新增 TCommandHandler 类用于动态命令注册
This commit is contained in:
@@ -5,6 +5,8 @@ import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class PermissionUtils {
|
||||
|
||||
private static Permission perms;
|
||||
@@ -27,14 +29,6 @@ public class PermissionUtils {
|
||||
}
|
||||
|
||||
public static boolean hasPermission(Player player, String perm) {
|
||||
if (perms.playerHas(player, perm)) {
|
||||
return true;
|
||||
}
|
||||
for (String group : perms.getPlayerGroups(player)) {
|
||||
if (perms.groupHas(player.getWorld(), group, perm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return perms.playerHas(player, perm) || Arrays.stream(perms.getPlayerGroups(player)).anyMatch(group -> perms.groupHas(player.getWorld(), group, perm));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user