Package ru.tehkode.permissions

Examples of ru.tehkode.permissions.PermissionUser


    }

    @Override
    public String[] getGroups(OfflinePlayer player) {
        if (getPermissible(player) == null) {
            PermissionUser user = manager.getUser(player.getName());
            if (user == null) {
                return new String[0];
            }
            return user.getGroupsNames();
        } else {
            return super.getGroups(player);
        }
    }
View Full Code Here


    }

    @EventHandler
    public void onPlayerQuit(PlayerQuitEvent event) {
      try {
        PermissionUser user = getPermissionsManager().getUser(event.getPlayer());
        if (!user.isVirtual()) {
          if (config.shouldLogPlayers()) {
            user.setOption("last-logout-time", Long.toString(System.currentTimeMillis() / 1000L));
          }

          user.getName(); // Set name if user was created during server run
        }
        getPermissionsManager().resetUser(event.getPlayer());
      } catch (Throwable t) {
        ErrorReport.handleError("While logout cleanup event", t);
      }
View Full Code Here

  }

  public boolean isDebug() {
    boolean debug = plugin.isDebug();
    try {
      PermissionUser user = plugin.getPermissionsManager().getUser(this.player);
      if (user != null) {
        debug |= user.isDebug();
      }
    } catch (Throwable ignore) {
    }
    return debug;
  }
View Full Code Here

      description = "List user permissions (list alias)")
  public void userListAliasPermissions(PermissionsEx plugin, CommandSender sender, Map<String, String> args) {
    String userName = this.autoCompletePlayerName(args.get("user"));
    String worldName = this.autoCompleteWorldName(args.get("world"));

    PermissionUser user = plugin.getPermissionsManager().getUser(userName);

    if (user == null) {
      sender.sendMessage(ChatColor.RED + "User \"" + userName + "\" doesn't exist.");
      return;
    }
    userName = user.getName();

    sender.sendMessage("'" + describeUser(user) + "' is a member of:");
    printEntityInheritance(sender, user.getParents());

    Map<String, List<PermissionGroup>> allParents = user.getAllParents();
    for (String world : allParents.keySet()) {
      if (world == null) {
        continue;
      }

      sender.sendMessage("  @" + world + ":");
      printEntityInheritance(sender, allParents.get(world));
    }

    sender.sendMessage(userName + "'s permissions:");

    this.sendMessage(sender, this.mapPermissions(worldName, user, 0));

    sender.sendMessage(userName + "'s options:");
    for (Map.Entry<String, String> option : user.getOptions(worldName).entrySet()) {
      sender.sendMessage("  " + option.getKey() + " = \"" + option.getValue() + "\"");
    }
  }
View Full Code Here

      description = "List user permissions")
  public void userListPermissions(PermissionsEx plugin, CommandSender sender, Map<String, String> args) {
    String userName = this.autoCompletePlayerName(args.get("user"));
    String worldName = this.autoCompleteWorldName(args.get("world"));

    PermissionUser user = plugin.getPermissionsManager().getUser(userName);

    if (user == null) {
      sender.sendMessage(ChatColor.RED + "User \"" + userName + "\" doesn't exist.");
      return;
    }

    sender.sendMessage(user.getName() + "'s permissions:");

    for (String permission : user.getPermissions(worldName)) {
      sender.sendMessage("  " + permission);
    }

  }
View Full Code Here

      description = "Get or set <user> prefix")
  public void userPrefix(PermissionsEx plugin, CommandSender sender, Map<String, String> args) {
    String userName = this.autoCompletePlayerName(args.get("user"));
    String worldName = this.autoCompleteWorldName(args.get("world"));

    PermissionUser user = plugin.getPermissionsManager().getUser(userName);

    if (user == null) {
      sender.sendMessage(ChatColor.RED + "User \"" + userName + "\" doesn't exist.");
      return;
    }

    if (args.containsKey("newprefix")) {
      user.setPrefix(args.get("newprefix"), worldName);
      sender.sendMessage(describeUser(user) + "'s prefix" + (worldName != null ? " (in world \"" + worldName + "\") " : "") + " has been set to \"" + user.getPrefix() + "\"");
    } else {
      sender.sendMessage(describeUser(user) + "'s prefix" + (worldName != null ? " (in world \"" + worldName + "\") " : "") + " is \"" + user.getPrefix() + "\"");
    }
  }
View Full Code Here

      description = "Get or set <user> suffix")
  public void userSuffix(PermissionsEx plugin, CommandSender sender, Map<String, String> args) {
    String userName = this.autoCompletePlayerName(args.get("user"));
    String worldName = this.autoCompleteWorldName(args.get("world"));

    PermissionUser user = plugin.getPermissionsManager().getUser(userName);

    if (user == null) {
      sender.sendMessage(ChatColor.RED + "User \"" + userName + "\" doesn't exist.");
      return;
    }

    if (args.containsKey("newsuffix")) {
      user.setSuffix(args.get("newsuffix"), worldName);
      sender.sendMessage(user.getName() + "'s suffix" + (worldName != null ? " (in world \"" + worldName + "\")" : "") + " has been set to \"" + user.getSuffix() + "\"");
    } else {
      sender.sendMessage(user.getName() + "'s suffix" + (worldName != null ? " (in world \"" + worldName + "\")" : "") + " is \"" + user.getSuffix() + "\"");
    }
  }
View Full Code Here

      permission = "permissions.manage.<user>",
      description = "Toggle debug only for <user>")
  public void userToggleDebug(PermissionsEx plugin, CommandSender sender, Map<String, String> args) {
    String userName = this.autoCompletePlayerName(args.get("user"));

    PermissionUser user = plugin.getPermissionsManager().getUser(userName);

    if (user == null) {
      sender.sendMessage(ChatColor.RED + "User \"" + userName + "\" doesn't exist.");
      return;
    }

    user.setDebug(!user.isDebug());

    sender.sendMessage("Debug mode for user " + describeUser(user) + " " + (user.isDebug() ? "enabled" : "disabled") + "!");
  }
View Full Code Here

      description = "Checks player for <permission>")
  public void userCheckPermission(PermissionsEx plugin, CommandSender sender, Map<String, String> args) {
    String userName = this.autoCompletePlayerName(args.get("user"));
    String worldName = this.autoCompleteWorldName(args.get("world"));

    PermissionUser user = plugin.getPermissionsManager().getUser(userName);

    if (user == null) {
      sender.sendMessage(ChatColor.RED + "User \"" + userName + "\" doesn't exist.");
      return;
    }

    worldName = this.getSafeWorldName(worldName, user);

    String permission = user.getMatchingExpression(args.get("permission"), worldName);

    if (permission == null) {
      sender.sendMessage("Permission \"" + permission + "\" has not been set for \"Player \"" + describeUser(user));
    } else {
      sender.sendMessage("Player \"" + describeUser(user) + "\" " + (user.explainExpression(permission) ? "has" : "doesn't have") + " \"" + permission + "\"");
    }
  }
View Full Code Here

      description = "Toggle debug only for <user>")
  public void userGetOption(PermissionsEx plugin, CommandSender sender, Map<String, String> args) {
    String userName = this.autoCompletePlayerName(args.get("user"));
    String worldName = this.autoCompleteWorldName(args.get("world"));

    PermissionUser user = plugin.getPermissionsManager().getUser(userName);

    if (user == null) {
      sender.sendMessage(ChatColor.RED + "User \"" + userName + "\" doesn't exist.");
      return;
    }

    worldName = this.getSafeWorldName(worldName, user);

    String value = user.getOption(args.get("option"), worldName, null);

    sender.sendMessage("Player \"" + describeUser(user) + "\" @ " + worldName + " option \"" + args.get("option") + "\" = \"" + value + "\"");
  }
View Full Code Here

TOP

Related Classes of ru.tehkode.permissions.PermissionUser

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.