當前位置: 首頁>>代碼示例>>Java>>正文


Java Permissible.hasPermission方法代碼示例

本文整理匯總了Java中org.bukkit.permissions.Permissible.hasPermission方法的典型用法代碼示例。如果您正苦於以下問題:Java Permissible.hasPermission方法的具體用法?Java Permissible.hasPermission怎麽用?Java Permissible.hasPermission使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.permissions.Permissible的用法示例。


在下文中一共展示了Permissible.hasPermission方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getUpdateText

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
public List<String> getUpdateText(Permissible player) {
    long yesterday = System.currentTimeMillis() - 1000l * 60 * 60 * 24;
    boolean isEnabled = lastNonNullGetUpdateText > yesterday;
    try {
        if (readerProvider == null) return null;
        if (!player.hasPermission(upgradePermission)) return null;
        lastNonNullGetUpdateText = System.currentTimeMillis();
        isEnabled = true;
        List<String> text;
        synchronized (this) {
            if (lastUpgradeCheck < yesterday) {
                enabled.set(1);
                lastUpgradeCheck = System.currentTimeMillis();
                asynchronousRunnableExecutor.runTaskAsynchronously(new GetLatestVersion());
            } else {
                enabled.set(0);
            }
            text = upgradeText;
        }
        return text;
    } finally {
        enabled.set(isEnabled ? 1 : 0);
    }
}
 
開發者ID:sciolizer,項目名稱:craftinomicon,代碼行數:25,代碼來源:UpdateChecker.java

示例2: isRecipeAllowedForPermissible

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
/**
 * Is the recipe allowed?
 *
 * @param permissible Permissible the permissible to check against
 * @param recipe      the recipe to check
 * @return boolean true if allowed, false if not
 */
private static boolean isRecipeAllowedForPermissible(Permissible permissible, Recipe recipe)
{
    Material result = recipe.getResult().getType();
    if(result == Material.SPECKLED_MELON && hasRecipeGotMaterial(recipe, Material.GOLD_NUGGET) && permissible.hasPermission(DISALLOW_OLD_GMELON)) {
        return false;
    }
    if(result == Material.SPECKLED_MELON && hasRecipeGotMaterial(recipe, Material.GOLD_BLOCK) && permissible.hasPermission(ALLOW_NEW_GMELON)) {
        return false;
    }
    if(result == Material.GOLDEN_CARROT && hasRecipeGotMaterial(recipe, Material.GOLD_NUGGET) && permissible.hasPermission(DISALLOW_OLD_GCARROT)) {
        return false;
    }
    if(result == Material.GOLDEN_CARROT && hasRecipeGotMaterial(recipe, Material.GOLD_INGOT) && permissible.hasPermission(ALLOW_NEW_GCARROT)) {
        return false;
    }
    //passed all checks
    return true;
}
 
開發者ID:Eluinhost,項目名稱:ultrahardcore,代碼行數:26,代碼來源:RecipeFeature.java

示例3: broadcast

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
@Override
public int broadcast(String message, String permission) {
    int count = 0;
    Set<Permissible> permissibles = getPluginManager().getPermissionSubscriptions(permission);

    for (Permissible permissible : permissibles) {
        if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
            CommandSender user = (CommandSender) permissible;
            user.sendMessage(message);
            count++;
        }
    }

    return count;
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:16,代碼來源:CraftServer.java

示例4: canExecute

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
/**
 * Check if {@code caller} has permission to execute this {@code SubCommand}
 * and all super commands.
 * @param caller the caller executing the sub command
 * @return true iff the called has permission to execute this and all super commands.
 */
public boolean canExecute(Permissible caller) {
	for (String permission : this.permissions) {
		if (caller.hasPermission(permission) && (this.isBase() || this.superCommand.canExecute(caller))) return true;
	}
	return false;
}
 
開發者ID:MrBlobman,項目名稱:SpigotCommandLib,代碼行數:13,代碼來源:SubCommand.java

示例5: broadcast

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
@Override
public int broadcast(String message, String permission) {
       int count = 0;
       Set<Permissible> permissibles = getPluginManager().getPermissionSubscriptions(permission);

       for (Permissible permissible : permissibles) {
           if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
               CommandSender user = (CommandSender) permissible;
               user.sendMessage(message);
               count++;
           }
       }

       return count;
}
 
開發者ID:DevotedMC,項目名稱:ExilePearl,代碼行數:16,代碼來源:TestServer.java

示例6: broadcast

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
public int broadcast(String message, String permission) {
    int count = 0;
    Set<Permissible> permissibles = getPluginManager().getPermissionSubscriptions(permission);

    for (Permissible permissible : permissibles) {
        if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
            CommandSender user = (CommandSender) permissible;
            user.sendMessage(message);
            count++;
        }
    }
    return count;
}
 
開發者ID:CanaryBukkitTeam,項目名稱:CanaryBukkit,代碼行數:14,代碼來源:CanaryServer.java

示例7: canUseEditWand

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
public boolean canUseEditWand(Permissible permissible) {
    return permissible.hasPermission(EDIT_WAND_PERMISSION);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:4,代碼來源:ObserverToolFactory.java

示例8: assertPermission

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
public static void assertPermission(Permissible permissible, String permission) throws CommandPermissionsException {
    if(!permissible.hasPermission(permission)) {
        throw new CommandPermissionsException();
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:6,代碼來源:CommandUtils.java

示例9: isStaff

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
public static boolean isStaff(Permissible permissible) {
    return permissible.hasPermission(Permissions.STAFF);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:4,代碼來源:PermissionUtils.java

示例10: isAdmin

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
public static boolean isAdmin(Permissible permissible) {
    return permissible.hasPermission(BLUR_ADMIN_PERMISSION);
}
 
開發者ID:BlurEngine,項目名稱:Blur,代碼行數:4,代碼來源:Blur.java

示例11: isDev

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
public static boolean isDev(Permissible permissible) {
    return permissible.hasPermission(BLUR_DEV_PERMISSION) || isAdmin(permissible);
}
 
開發者ID:BlurEngine,項目名稱:Blur,代碼行數:4,代碼來源:Blur.java

示例12: playerHasPermissionForFlag

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
private boolean playerHasPermissionForFlag(FlagDefinition flagDef, Permissible player)
{
    String flagName = flagDef.getName();
    return player == null || player.hasPermission("gpflags.allflags") || player.hasPermission("gpflags." + flagName) || player.hasPermission("gpflags." + flagName.toLowerCase());
   }
 
開發者ID:BigScary,項目名稱:GriefPreventionFlags,代碼行數:6,代碼來源:GPFlags.java

示例13: hasPermission

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
public static boolean hasPermission(Permissible sender, String permission) {
    return sender instanceof ConsoleCommandSender || sender.hasPermission(permission);
}
 
開發者ID:Scarsz,項目名稱:DiscordSRV,代碼行數:4,代碼來源:GamePermissionUtil.java

示例14: broadcast

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
/** Is the user allowed to broadcast the results of their roll? */
public static boolean broadcast(Permissible p) {
    return p.hasPermission("dice.roll.broadcast");
}
 
開發者ID:EasyMFnE,項目名稱:Dice,代碼行數:5,代碼來源:Perms.java

示例15: canRollMultiple

import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
/** Can the user roll multiple dice at once? */
public static boolean canRollMultiple(Permissible p) {
    return p.hasPermission("dice.roll.multiple");
}
 
開發者ID:EasyMFnE,項目名稱:Dice,代碼行數:5,代碼來源:Perms.java


注:本文中的org.bukkit.permissions.Permissible.hasPermission方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。