org.bukkit.permissions.ServerOperator Java Examples

The following examples show how to use org.bukkit.permissions.ServerOperator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Players.java    From CardinalPGM with MIT License 5 votes vote down vote up
public static String getName(ServerOperator who, boolean flairs) {
    if (who instanceof OfflinePlayer) {
        OfflinePlayer player = (OfflinePlayer) who;
        return player.isOnline() ? (flairs ? player.getPlayer().getDisplayName() : Teams.getTeamColorByPlayer(player) + player.getPlayer().getName()) : Rank.getPrefix(player.getUniqueId()) + ChatColor.DARK_AQUA + player.getName();
    } else {
        return ChatColor.GOLD + "\u2756" + ChatColor.DARK_AQUA + "Console";
    }
}
 
Example #2
Source File: Players.java    From CardinalPGM with MIT License 4 votes vote down vote up
public static String getName(ServerOperator who) {
    return getName(who, true);
}
 
Example #3
Source File: BPPermissible.java    From BungeePerms with GNU General Public License v3.0 4 votes vote down vote up
public BPPermissible(CommandSender sender, User u, Permissible oldPermissible)
{
    super(sender);
    this.sender = sender;
    this.oldPermissible = oldPermissible;
    permissions = new LinkedHashMap<String, PermissionAttachmentInfo>()
    {
        @Override
        public PermissionAttachmentInfo put(String k, PermissionAttachmentInfo v)
        {
            PermissionAttachmentInfo existing = this.get(k);
            if (existing != null)
            {
                return existing;
            }
            return super.put(k, v);
        }
    };
    superperms = new LinkedHashMap<String, PermissionAttachmentInfo>()
    {
        @Override
        public PermissionAttachmentInfo put(String k, PermissionAttachmentInfo v)
        {
            PermissionAttachmentInfo existing = this.get(k);
            if (existing != null)
            {
                return existing;
            }
            return super.put(k, v);
        }
    };

    //inject an opable
    oldOpable = Statics.getField(PermissibleBase.class, oldPermissible, ServerOperator.class, "opable");
    opable = new ServerOperator()
    {
        @Override
        public boolean isOp()
        {
            BukkitConfig config = (BukkitConfig) BungeePerms.getInstance().getConfig();
            if (opdisabled)
            {
                if (!config.isAllowops())
                {
                    return false;
                }
            }
            if (config.isDebug())
            {
                BungeePerms.getLogger().info("op check: " + BPPermissible.this.sender.getName() + " has OP: " + oldOpable.isOp());
            }
            return oldOpable.isOp();
        }

        @Override
        public void setOp(boolean value)
        {
            oldOpable.setOp(value);
        }
    };

    init = true;

    recalculatePermissions();
}