Java Code Examples for cn.nukkit.permission.Permissible#hasPermission()

The following examples show how to use cn.nukkit.permission.Permissible#hasPermission() . 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: Server.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public int broadcast(String message, String permissions) {
    Set<CommandSender> recipients = new HashSet<>();

    for (String permission : permissions.split(";")) {
        for (Permissible permissible : this.pluginManager.getPermissionSubscriptions(permission)) {
            if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
                recipients.add((CommandSender) permissible);
            }
        }
    }

    for (CommandSender recipient : recipients) {
        recipient.sendMessage(message);
    }

    return recipients.size();
}
 
Example 2
Source File: Server.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public int broadcast(TextContainer message, String permissions) {
    Set<CommandSender> recipients = new HashSet<>();

    for (String permission : permissions.split(";")) {
        for (Permissible permissible : this.pluginManager.getPermissionSubscriptions(permission)) {
            if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
                recipients.add((CommandSender) permissible);
            }
        }
    }

    for (CommandSender recipient : recipients) {
        recipient.sendMessage(message);
    }

    return recipients.size();
}
 
Example 3
Source File: Server.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public int broadcastPopup(String message, String permissions) {
    Set<Player> recipients = new HashSet<>();

    for (String permission : permissions.split(";")) {
        for (Permissible permissible : this.pluginManager.getPermissionSubscriptions(permission)) {
            if (permissible instanceof Player && permissible.hasPermission(permission)) {
                recipients.add((Player) permissible);
            }
        }
    }

    for (Player recipient : recipients) {
        recipient.sendPopup(message);
    }

    return recipients.size();
}
 
Example 4
Source File: Server.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public int broadcastTip(String message, String permissions) {
    Set<Player> recipients = new HashSet<>();

    for (String permission : permissions.split(";")) {
        for (Permissible permissible : this.pluginManager.getPermissionSubscriptions(permission)) {
            if (permissible instanceof Player && permissible.hasPermission(permission)) {
                recipients.add((Player) permissible);
            }
        }
    }

    for (Player recipient : recipients) {
        recipient.sendTip(message);
    }

    return recipients.size();
}
 
Example 5
Source File: Server.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public int broadcastTitle(String message, String permissions) {
    Set<Player> recipients = new HashSet<>();

    for (String permission : permissions.split(";")) {
        for (Permissible permissible : this.pluginManager.getPermissionSubscriptions(permission)) {
            if (permissible instanceof Player && permissible.hasPermission(permission)) {
                recipients.add((Player) permissible);
            }
        }
    }

    for (Player recipient : recipients) {
        recipient.sendTitle(message);
    }

    return recipients.size();
}
 
Example 6
Source File: Server.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public int broadcastSubtitle(String message, String permissions) {
    Set<Player> recipients = new HashSet<>();

    for (String permission : permissions.split(";")) {
        for (Permissible permissible : this.pluginManager.getPermissionSubscriptions(permission)) {
            if (permissible instanceof Player && permissible.hasPermission(permission)) {
                recipients.add((Player) permissible);
            }
        }
    }

    for (Player recipient : recipients) {
        recipient.setSubtitle(message);
    }

    return recipients.size();
}
 
Example 7
Source File: Server.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public int broadcastImportantMessage(String message, String permissions) {
    Set<CommandSender> recipients = new HashSet<>();

    for (String permission : permissions.split(";")) {
        for (Permissible permissible : this.pluginManager.getPermissionSubscriptions(permission)) {
            if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
                recipients.add((CommandSender) permissible);
            }
        }
    }

    for (CommandSender recipient : recipients) {
        recipient.sendImportantMessage(message);
    }

    return recipients.size();
}
 
Example 8
Source File: Server.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public int broadcast(String message, String permissions) {
    Set<CommandSender> recipients = new HashSet<>();

    for (String permission : permissions.split(";")) {
        for (Permissible permissible : this.pluginManager.getPermissionSubscriptions(permission)) {
            if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
                recipients.add((CommandSender) permissible);
            }
        }
    }

    for (CommandSender recipient : recipients) {
        recipient.sendMessage(message);
    }

    return recipients.size();
}
 
Example 9
Source File: Server.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public int broadcast(TextContainer message, String permissions) {
    Set<CommandSender> recipients = new HashSet<>();

    for (String permission : permissions.split(";")) {
        for (Permissible permissible : this.pluginManager.getPermissionSubscriptions(permission)) {
            if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
                recipients.add((CommandSender) permissible);
            }
        }
    }

    for (CommandSender recipient : recipients) {
        recipient.sendMessage(message);
    }

    return recipients.size();
}
 
Example 10
Source File: LuckPermsSubscriptionMap.java    From LuckPerms with MIT License 6 votes vote down vote up
@Override
public boolean contains(Object key) {
    // try the backing map
    if (this.backing.contains(key)) {
        return true;
    }

    // then try the permissible
    if (key instanceof Permissible) {
        Permissible p = (Permissible) key;
        return p.hasPermission(this.permission);
    }

    // no result
    return false;
}
 
Example 11
Source File: Server.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public int broadcast(String message, String permissions) {
    Set<CommandSender> recipients = new HashSet<>();

    for (String permission : permissions.split(";")) {
        for (Permissible permissible : this.pluginManager.getPermissionSubscriptions(permission)) {
            if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
                recipients.add((CommandSender) permissible);
            }
        }
    }

    for (CommandSender recipient : recipients) {
        recipient.sendMessage(message);
    }

    return recipients.size();
}
 
Example 12
Source File: Server.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public int broadcast(TextContainer message, String permissions) {
    Set<CommandSender> recipients = new HashSet<>();

    for (String permission : permissions.split(";")) {
        for (Permissible permissible : this.pluginManager.getPermissionSubscriptions(permission)) {
            if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
                recipients.add((CommandSender) permissible);
            }
        }
    }

    for (CommandSender recipient : recipients) {
        recipient.sendMessage(message);
    }

    return recipients.size();
}