本文整理匯總了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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例7: canUseEditWand
import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
public boolean canUseEditWand(Permissible permissible) {
return permissible.hasPermission(EDIT_WAND_PERMISSION);
}
示例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();
}
}
示例9: isStaff
import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
public static boolean isStaff(Permissible permissible) {
return permissible.hasPermission(Permissions.STAFF);
}
示例10: isAdmin
import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
public static boolean isAdmin(Permissible permissible) {
return permissible.hasPermission(BLUR_ADMIN_PERMISSION);
}
示例11: isDev
import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
public static boolean isDev(Permissible permissible) {
return permissible.hasPermission(BLUR_DEV_PERMISSION) || isAdmin(permissible);
}
示例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());
}
示例13: hasPermission
import org.bukkit.permissions.Permissible; //導入方法依賴的package包/類
public static boolean hasPermission(Permissible sender, String permission) {
return sender instanceof ConsoleCommandSender || sender.hasPermission(permission);
}
示例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");
}
示例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");
}