Package ru.tehkode.permissions

Examples of ru.tehkode.permissions.PermissionManager


      syntax = "world <world>",
      description = "Print <world> inheritance info",
      permission = "permissions.manage.worlds")
  public void worldPrintInheritance(PermissionsEx plugin, CommandSender sender, Map<String, String> args) {
    String worldName = this.autoCompleteWorldName(args.get("world"));
    PermissionManager manager = plugin.getPermissionsManager();
    if (plugin.getServer().getWorld(worldName) == null) {
      sender.sendMessage("Specified world \"" + args.get("world") + "\" not found.");
      return;
    }

    List<String> parentWorlds = manager.getWorldInheritance(worldName);

    if (parentWorlds.isEmpty()) {
      sender.sendMessage("World \"" + worldName + "\" inherits nothing.");
      return;
    }

    sender.sendMessage("World \"" + worldName + "\" inherits:");

    for (String parentWorld : parentWorlds) {
      List<String> parents = manager.getWorldInheritance(parentWorld);
      String output = "  " + parentWorld;
      if (!parents.isEmpty()) {
        output += ChatColor.GREEN + " [" + ChatColor.WHITE + StringUtils.implode(parents, ", ") + ChatColor.GREEN + "]";
      }
View Full Code Here


  protected List<Player> getLocalRecipients(Player sender, String message, double range) {
    Location playerLocation = sender.getLocation();
    List<Player> recipients = new LinkedList<Player>();
    double squaredDistance = Math.pow(range, 2);
    PermissionManager manager = PermissionsEx.getPermissionManager();
    for (Player recipient : Bukkit.getServer().getOnlinePlayers()) {
      // Recipient are not from same world
      if (!recipient.getWorld().equals(sender.getWorld())) {
        continue;
      }

      if (playerLocation.distanceSquared(recipient.getLocation()) > squaredDistance && !manager.has(sender, "chatmanager.override.ranged")) {
        continue;
      }

      recipients.add(recipient);
    }
View Full Code Here

  public String getPrefixSuffix(Resident resident, String node) {
     
      String group = "", user = "";
        Player player = plugin.getServer().getPlayer(resident.getName());
       
        PermissionManager pexPM = PermissionsEx.getPermissionManager();
       
        if (node == "prefix") {
          group = pexPM.getUser(player).getPrefix(player.getWorld().getName());
          user = pexPM.getUser(player).getOwnPrefix();
        } else if (node == "suffix") {
          group = pexPM.getUser(player).getSuffix(player.getWorld().getName());
          user = pexPM.getUser(player).getOwnSuffix();
        }
        if (group == null) group = "";
        if (user == null) user = "";
     
      if (!group.equals(user))
View Full Code Here

    @Override
    public int getGroupPermissionIntNode(String playerName, String node) {
      Player player = plugin.getServer().getPlayer(playerName);
    String worldName = player.getWorld().getName();
   
    PermissionManager pexPM = PermissionsEx.getPermissionManager();
   
    //return pexPM.getUser(player).getOptionInteger(node, worldName, -1);
   
    String result = pexPM.getUser(player).getOption(node, worldName);
   
    try {
      return Integer.parseInt(result);
    } catch (NumberFormatException e) {
      return -1;
View Full Code Here

    @Override
    public String getPlayerPermissionStringNode(String playerName, String node) {
      Player player = plugin.getServer().getPlayer(playerName);
    String worldName = player.getWorld().getName();
   
    PermissionManager pexPM = PermissionsEx.getPermissionManager();
   
    //return pexPM.getUser(player).getOptionInteger(node, worldName, -1);
    String result = pexPM.getUser(player).getOption(node, worldName);
    if (result != null)
      return result;
   
    return "";
View Full Code Here

  public boolean hasPermission(Player player, String node) {
     
      if (player.isOp())
        return true;
       
      PermissionManager pexPM = PermissionsEx.getPermissionManager();
     
        return pexPM.getUser(player).has(node);
    }
View Full Code Here

     * @return Name of the players group
     */
    @Override
  public String getPlayerGroup(Player player) {

      PermissionManager pexPM = PermissionsEx.getPermissionManager();
     
      return pexPM.getUser(player).getGroupsNames()[0];
   
    }
View Full Code Here

     * @param player
     * @return Array of groups for this player
     */
    public PermissionGroup[] getPlayerGroups(Player player) {

      PermissionManager pexPM = PermissionsEx.getPermissionManager();
     
      return pexPM.getUser(player).getGroups();
   
    }
View Full Code Here

TOP

Related Classes of ru.tehkode.permissions.PermissionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.