本文整理汇总了Java中ru.tehkode.permissions.bukkit.PermissionsEx.getUser方法的典型用法代码示例。如果您正苦于以下问题:Java PermissionsEx.getUser方法的具体用法?Java PermissionsEx.getUser怎么用?Java PermissionsEx.getUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ru.tehkode.permissions.bukkit.PermissionsEx
的用法示例。
在下文中一共展示了PermissionsEx.getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
@Override
@Nullable
protected String[] get(Event e) {
Object o = p.getSingle(e);
PermissionUser a = null;
if (o instanceof Player) {
a = PermissionsEx.getUser((Player) o);
}
if (o instanceof OfflinePlayer) {
a = PermissionsEx.getUser(((OfflinePlayer) o).getName());
} else {
a = PermissionsEx.getUser(o.toString());
}
ArrayList<String> farr = new ArrayList<String>();
for (PermissionGroup a1 : a.getParents()) {
farr.add(a1.getName());
}
return farr.toArray(new String[farr.size()]);
}
示例2: onJoin
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
@EventHandler
public void onJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
PermissionUser user = PermissionsEx.getUser(player);
if(!user.getOption("displayname").equals(""))
{
player.setDisplayName(user.getOption("displayname"));
}
if(!user.getOption("joinmessage").equals(""))
{
event.setJoinMessage(ChatUtil.formatMessage(event.getPlayer(), user.getOption("joinmessage")));
}
else
{
user.setOption("joinmessage", "&6%player &6has entered the fringe.");
event.setJoinMessage(ChatUtil.formatMessage(event.getPlayer(), user.getOption("joinmessage")));
}
}
示例3: getPrefix
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
private static String getPrefix(Player target){
if (Bukkit.getPluginManager().getPlugin("PermissionsEx") == null){
return null;
} else {
PermissionUser user = PermissionsEx.getUser(target);
String prefix = user.getPrefix();
return prefix;
}
}
开发者ID:AdvancedWhois-Developers,项目名称:AdvancedWhoisPlus-Reloaded,代码行数:10,代码来源:AdditionalWhoisSender.java
示例4: getPrefix
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
public static String getPrefix(Player player)
{
PermissionUser user = PermissionsEx.getUser(player);
if(user.getPrefix() != null)
{
return user.getPrefix();
}
else
{
return "";
}
}
示例5: getSuffix
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
public static String getSuffix(Player player)
{
PermissionUser user = PermissionsEx.getUser(player);
if(user.getSuffix() != null)
{
return user.getSuffix();
}
else
{
return "";
}
}
示例6: formatMessage
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
public static String formatMessage(Player player, String message)
{
PermissionUser user = PermissionsEx.getUser(player);
message = message.replace("%prefix", user.getPrefix());
message = message.replace("%suffix", user.getSuffix());
message = message.replace("%player", player.getDisplayName());
message = formatColours(message);
return message;
}
示例7: permFormatMessage
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
public static String permFormatMessage(Player player, String message)
{
PermissionUser user = PermissionsEx.getUser(player);
message = message.replace("%prefix", user.getPrefix());
message = message.replace("%suffix", user.getSuffix());
message = message.replace("%player", player.getDisplayName());
message = permFormatColours(player, message);
return message;
}
示例8: addToGroup
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
@Override
public boolean addToGroup(OfflinePlayer player, String group) {
if (!PermissionsEx.getPermissionManager().getGroupNames().contains(group)) {
return false;
}
PermissionUser user = PermissionsEx.getUser(player.getName());
user.addGroup(group);
return true;
}
示例9: getUser
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
public static PermissionUser getUser(Player p){
return PermissionsEx.getUser(p);
}
示例10: hasPermission
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
/**
* Check if a player has permission
* @param player player
* @param permissionNode permission node
* @param def default if no permissions system is used
* @return true if the player is permitted
*/
public boolean hasPermission(Player p, String permsNode, boolean def) {
if(!isEnabled()) {
// No permissions system is used, return default
return def;
}
switch (this.permsType) {
case PERMISSIONS_EX:
// Permissions Ex
PermissionUser user = PermissionsEx.getUser(p);
return user.has(permsNode);
case PERMISSIONS_BUKKIT:
// Permissions Bukkit
return p.hasPermission(permsNode);
case B_PERMISSIONS:
// bPermissions
return ApiLayer.hasPermission(p.getWorld().getName(), CalculableType.USER, p.getName(), permsNode);
case ESSENTIALS_GROUP_MANAGER:
// Essentials Group Manager
final AnjoPermissionsHandler handler = groupManagerPerms.getWorldsHolder().getWorldPermissions(p);
if (handler == null)
return false;
return handler.has(p, permsNode);
case Z_PERMISSIONS:
// zPermissions
Map<String, Boolean> perms = zPermissionsService.getPlayerPermissions(p.getWorld().getName(), null, p.getName());
if(perms.containsKey(permsNode)){
return perms.get(permsNode);
} else {
return def;
}
case VAULT:
// Vault
return vaultPerms.has(p, permsNode);
case PERMISSIONS:
// Permissions by nijiko
return this.defaultPerms.has(p, permsNode);
case NONE:
// Not hooked into any permissions system, return default
return def;
default:
// Something went wrong, return false to prevent problems
return false;
}
}
示例11: getGroups
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<String> getGroups(Player p) {
if(!isEnabled()) {
// No permissions system is used, return an empty list
return new ArrayList<String>();
}
switch (this.permsType) {
case PERMISSIONS_EX:
// Permissions Ex
PermissionUser user = PermissionsEx.getUser(p);
return Arrays.asList(user.getGroupsNames());
case PERMISSIONS_BUKKIT:
// Permissions Bukkit
// Permissions Bukkit doesn't support group, return an empty list
return new ArrayList<String>();
case B_PERMISSIONS:
// bPermissions
return Arrays.asList(ApiLayer.getGroups(p.getName(), CalculableType.USER, p.getName()));
case ESSENTIALS_GROUP_MANAGER:
// Essentials Group Manager
final AnjoPermissionsHandler handler = groupManagerPerms.getWorldsHolder().getWorldPermissions(p);
if (handler == null)
return new ArrayList<String>();
return Arrays.asList(handler.getGroups(p.getName()));
case Z_PERMISSIONS:
//zPermissions
return new ArrayList(zPermissionsService.getPlayerGroups(p.getName()));
case VAULT:
// Vault
return Arrays.asList(vaultPerms.getPlayerGroups(p));
case PERMISSIONS:
// Permissions by nijiko
return new ArrayList(this.defaultPerms.getGroups(p.getName()));
case NONE:
// Not hooked into any permissions system, return an empty list
return new ArrayList<String>();
default:
// Something went wrong, return an empty list to prevent problems
return new ArrayList<String>();
}
}
示例12: hasPermission
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
/**
* Check if a player has permission.
*
* @param player The player.
* @param permsNode The permission node.
* @param def Default returned if no permissions system is used.
* @return True if the player has permission.
*/
public boolean hasPermission(Player player, String permsNode, boolean def) {
// Make sure the manager is enabled and is hooked into a permissions system
if(!isEnabled() || !isHooked())
return def;
// Use the proper API
switch (this.permsType) {
case PERMISSIONS_EX:
// Permissions Ex
PermissionUser user = PermissionsEx.getUser(player);
return user.has(permsNode);
case PERMISSIONS_BUKKIT:
// Permissions Bukkit
return player.hasPermission(permsNode);
case B_PERMISSIONS:
// bPermissions
return ApiLayer.hasPermission(player.getWorld().getName(), CalculableType.USER, player.getName(), permsNode);
case ESSENTIALS_GROUP_MANAGER:
// Essentials Group Manager
final AnjoPermissionsHandler handler = groupManagerPerms.getWorldsHolder().getWorldPermissions(player);
return handler != null && handler.has(player, permsNode);
case Z_PERMISSIONS:
// zPermissions
@SuppressWarnings("deprecation")
Map<String, Boolean> perms = zPermissionsService.getPlayerPermissions(player.getWorld().getName(), null, player.getName());
return perms.containsKey(permsNode) ? perms.get(permsNode) : def;
case VAULT:
// Vault
return vaultPerms.has(player, permsNode);
case PERMISSIONS:
// Permissions
return this.defaultPerms.has(player, permsNode);
}
// Failed, return the default
return def;
}
示例13: getGroups
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
public List<String> getGroups(Player player) {
// Make sure the manager is enabled and is hooked into a permissions system
if(!isEnabled() || !isHooked())
return new ArrayList<>();
// Use the proper API
switch (this.permsType) {
case PERMISSIONS_EX:
// Permissions Ex
PermissionUser user = PermissionsEx.getUser(player);
return user.getParentIdentifiers(null);
case PERMISSIONS_BUKKIT:
// Permissions Bukkit
// FIXME: Add support for this!
return new ArrayList<>();
case B_PERMISSIONS:
// bPermissions
return Arrays.asList(ApiLayer.getGroups(player.getWorld().getName(), CalculableType.USER, player.getName()));
case ESSENTIALS_GROUP_MANAGER:
// Essentials Group Manager
final AnjoPermissionsHandler handler = groupManagerPerms.getWorldsHolder().getWorldPermissions(player);
if (handler == null)
return new ArrayList<>();
return Arrays.asList(handler.getGroups(player.getName()));
case Z_PERMISSIONS:
//zPermissions
return new ArrayList(zPermissionsService.getPlayerGroups(player.getName()));
case VAULT:
// Vault
return Arrays.asList(vaultPerms.getPlayerGroups(player));
case PERMISSIONS:
// Permissions
// Create a list to put the groups in
List<String> groups = new ArrayList<>();
// Get the groups and add each to the list
groups.addAll(this.defaultPerms.getGroups(player.getName()).stream().map(Group::getName).collect(Collectors.toList()));
// Return the groups
return groups;
}
// Failed, return an empty list
return new ArrayList<>();
}
示例14: inGroup
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
/**
* Check whether the player is in the specified group.
*
* @param player The player.
* @param groupName The group name.
* @return True if the player is in the specified group, false otherwise.
* False is also returned if groups aren't supported by the used permissions system.
*/
public boolean inGroup(Player player, String groupName) {
// Make sure the manager is enabled and is hooked into a permissions system
if(!isEnabled() || !isHooked())
return false;
// Use the proper API
switch (this.permsType) {
case PERMISSIONS_EX:
// Permissions Ex
PermissionUser user = PermissionsEx.getUser(player);
return user.inGroup(groupName);
case PERMISSIONS_BUKKIT:
case Z_PERMISSIONS:
// Get the current list of groups
List<String> groupNames = getGroups(player);
// Check whether the list contains the group name, return the result
for (String entry : groupNames)
if (entry.equals(groupName))
return true;
return false;
case B_PERMISSIONS:
// bPermissions
return ApiLayer.hasGroup(player.getWorld().getName(), CalculableType.USER, player.getName(), groupName);
case ESSENTIALS_GROUP_MANAGER:
// Essentials Group Manager
final AnjoPermissionsHandler handler = groupManagerPerms.getWorldsHolder().getWorldPermissions(player);
return handler != null && handler.inGroup(player.getName(), groupName);
case VAULT:
// Vault
return vaultPerms.playerInGroup(player, groupName);
case PERMISSIONS:
// Permissions
return this.defaultPerms.inGroup(player.getWorld().getName(), player.getName(), groupName);
}
// Failed, return false
return false;
}
示例15: addGroup
import ru.tehkode.permissions.bukkit.PermissionsEx; //导入方法依赖的package包/类
/**
* Add the permission group of a player, if supported.
*
* @param player The player
* @param groupName The name of the group.
* @return True if succeed, false otherwise.
* False is also returned if this feature isn't supported for the current permissions system.
*/
public boolean addGroup(Player player, String groupName) {
// Make sure the manager is enabled and is hooked into a permissions system
if(!isEnabled() || !isHooked())
return false;
// Set the group the proper way
switch (this.permsType) {
case PERMISSIONS_EX:
// Permissions Ex
PermissionUser user = PermissionsEx.getUser(player);
user.addGroup(groupName);
return true;
case PERMISSIONS_BUKKIT:
// Permissions Bukkit
// Add the group to the user using a command
return Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "permissions player addgroup " + player.getName() + " " + groupName);
case B_PERMISSIONS:
// bPermissions
ApiLayer.addGroup(player.getWorld().getName(), CalculableType.USER, player.getName(), groupName);
return true;
case ESSENTIALS_GROUP_MANAGER:
// Essentials Group Manager
// Add the group to the user using a command
return Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "manuaddsub " + player.getName() + " " + groupName);
case Z_PERMISSIONS:
// zPermissions
// Add the group to the user using a command
return Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "permissions player " + player.getName() + " addgroup " + groupName);
case VAULT:
// Vault
vaultPerms.playerAddGroup(player, groupName);
return true;
case PERMISSIONS:
// Permissions
// FIXME: Add support for this!
//return this.defaultPerms.group
return false;
}
// Failed, return false
return false;
}