本文整理汇总了Java中net.dmulloy2.types.IPermission类的典型用法代码示例。如果您正苦于以下问题:Java IPermission类的具体用法?Java IPermission怎么用?Java IPermission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPermission类属于net.dmulloy2.types包,在下文中一共展示了IPermission类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: hasPermission
import net.dmulloy2.types.IPermission; //导入依赖的package包/类
/**
* Whether or not a given command sender has a given permission.
*
* @param sender Sender to check
* @param permission Permission to check for
* @param message Whether or not to send an error
* @return True if they have it, false if not
*/
protected final boolean hasPermission(CommandSender sender, IPermission permission, boolean message)
{
Validate.notNull(sender, "sender cannot be null!");
if (! plugin.getPermissionHandler().hasPermission(sender, permission))
{
if (message)
{
StringJoiner hoverText = new StringJoiner("\n");
hoverText.append(FormatUtil.format("&4Permission:"));
hoverText.append(FormatUtil.format("&r{0}", getPermissionString(permission)));
ComponentBuilder builder = new ComponentBuilder(FormatUtil.format("&cError: &4You do not have "));
builder.append(FormatUtil.format("&cpermission")).event(new HoverEvent(Action.SHOW_TEXT, hoverText.toString()));
builder.append(FormatUtil.format(" &4to perform this command!"));
sendMessage(sender, builder.create());
}
return false;
}
return true;
}
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:32,代码来源:Command.java
示例2: getPermissionString
import net.dmulloy2.types.IPermission; //导入依赖的package包/类
/**
* Gets the full permission string of a given permission.
*
* @param permission Permission
* @return The full string
*/
protected final String getPermissionString(IPermission permission)
{
Validate.notNull(permission, "permission cannot be null!");
return plugin.getPermissionHandler().getPermissionString(permission);
}
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:13,代码来源:Command.java
示例3: checkPermission
import net.dmulloy2.types.IPermission; //导入依赖的package包/类
protected void checkPermission(CommandSender sender, IPermission permission)
{
if (! hasPermission(sender, permission, true))
throw new CommandException(Reason.BREAK);
}
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:6,代码来源:Command.java
示例4: hasPermission
import net.dmulloy2.types.IPermission; //导入依赖的package包/类
public final boolean hasPermission(CommandSender sender, IPermission permission)
{
return permission == null || hasPermission(sender, getPermissionString(permission));
}
开发者ID:dmulloy2,项目名称:SwornPermissions,代码行数:5,代码来源:PermissionHandler.java
示例5: getPermissionString
import net.dmulloy2.types.IPermission; //导入依赖的package包/类
public final String getPermissionString(IPermission permission)
{
return plugin.getName().toLowerCase() + "." + permission.getNode().toLowerCase();
}
开发者ID:dmulloy2,项目名称:SwornPermissions,代码行数:5,代码来源:PermissionHandler.java
示例6: hasPermission
import net.dmulloy2.types.IPermission; //导入依赖的package包/类
/**
* Whether or not a {@link CommandSender} has a permission.
*
* @param sender Sender to check.
* @param permission Permission.
* @return True if they have the permission, false if not
*/
public final boolean hasPermission(CommandSender sender, IPermission permission)
{
return permission == null || hasPermission(sender, getPermissionString(permission));
}
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:12,代码来源:PermissionHandler.java
示例7: getPermissionString
import net.dmulloy2.types.IPermission; //导入依赖的package包/类
/**
* Gets the complete permission string for a given {@link IPermission}.
*
* @param permission - Permission to get the node for.
* @return The complete permission string
*/
public final String getPermissionString(IPermission permission)
{
return prefix + permission.getNode().toLowerCase();
}
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:11,代码来源:PermissionHandler.java
注:本文中的net.dmulloy2.types.IPermission类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论