本文整理汇总了Java中org.bukkit.permissions.PermissionAttachmentInfo.getPermission方法的典型用法代码示例。如果您正苦于以下问题:Java PermissionAttachmentInfo.getPermission方法的具体用法?Java PermissionAttachmentInfo.getPermission怎么用?Java PermissionAttachmentInfo.getPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.permissions.PermissionAttachmentInfo
的用法示例。
在下文中一共展示了PermissionAttachmentInfo.getPermission方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMaxPermission
import org.bukkit.permissions.PermissionAttachmentInfo; //导入方法依赖的package包/类
public static int getMaxPermission(Player p, String node) {
int maxLimit = 0;
for (PermissionAttachmentInfo perm : p.getEffectivePermissions()) {
String permission = perm.getPermission();
if (!permission.toLowerCase().startsWith(node.toLowerCase())) {
continue;
}
String[] split = permission.split("\\.");
try {
int number = Integer.parseInt(split[split.length - 1]);
if (number > maxLimit) {
maxLimit = number;
}
} catch (NumberFormatException ignore) { }
}
return maxLimit;
}
示例2: assignRanks
import org.bukkit.permissions.PermissionAttachmentInfo; //导入方法依赖的package包/类
public static void assignRanks(Player p, int tsDbId){
//Permissions
for(PermissionAttachmentInfo pai : p.getEffectivePermissions()) {
String perms = pai.getPermission();
if(UltimateTs.main().getConfig().get("perms."+perms) != null){
int gTs = UltimateTs.main().getConfig().getInt("perms."+perms);
BotManager.getBot().addClientToServerGroup(gTs, tsDbId);
}
}
//Default Ranks
int groupToAssign = UltimateTs.main().getConfig().getInt("config.assignWhenRegister");
if(groupToAssign > 0){
BotManager.getBot().addClientToServerGroup(groupToAssign, tsDbId);
}
}
示例3: getVaultCapacity
import org.bukkit.permissions.PermissionAttachmentInfo; //导入方法依赖的package包/类
public int getVaultCapacity(Player p)
{
int capacity = getVaultCapacity();
if(isVaultCapacityPermissionControl())
{
for(PermissionAttachmentInfo pai : p.getEffectivePermissions())
{
String per = pai.getPermission();
if(!per.toLowerCase().startsWith("wowsuchcleaner.vault.capacity.")) continue;
String capacityString = per.split("\\.")[3];
capacity = Integer.parseInt(capacityString);
continue;
}
}
return capacity;
}
示例4: getSuperpermsGroup
import org.bukkit.permissions.PermissionAttachmentInfo; //导入方法依赖的package包/类
/**
* Superperms has no group support, but we fake it (this is slow and stupid
* since it has to iterate through ALL permissions a player has). But if
* you're attached to superperms and not using a nice plugin like bPerms
* and Vault then this is as good as it gets.
*
* @param player
* @return the group name or null
*/
private String getSuperpermsGroup(Player player) {
if( player == null )
return null;
String group = null;
// this code shamelessly adapted from WorldEdit's WEPIF support for superperms
Permissible perms = getPermissible(player);
if (perms != null) {
for (PermissionAttachmentInfo permAttach : perms.getEffectivePermissions()) {
String perm = permAttach.getPermission();
if (!(perm.startsWith(GROUP_PREFIX) && permAttach.getValue())) {
continue;
}
// we just grab the first "group.X" permission we can find
group = perm.substring(GROUP_PREFIX.length(), perm.length());
break;
}
}
return group;
}
示例5: loadMultiplier
import org.bukkit.permissions.PermissionAttachmentInfo; //导入方法依赖的package包/类
public void loadMultiplier(Player p){
int id=1,ip=1;
for (PermissionAttachmentInfo perms : p.getEffectivePermissions()) {
String perm = perms.getPermission();
if (perm.toLowerCase().startsWith("pickupmoney.multiply.")) {
String[] spl = perm.split("\\.");
int num = Integer.parseInt(spl[3]);
if(spl[2].equals("drop") && id<num) id = num;
else if(spl[2].equals("pickup") && ip<num) ip = num;
}
}
dropMulti.put(p.getUniqueId(),id);
pickupMulti.put(p.getUniqueId(),ip);
}