本文整理匯總了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);
}