Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

Commit

Permalink
Perform permissions checks before trying to perform a synchronous use…
Browse files Browse the repository at this point in the history
…rname resolution
  • Loading branch information
zml2008 committed Dec 21, 2015
1 parent f25d016 commit abad593
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -529,17 +529,7 @@ public void userAddGroup(PermissionsEx plugin, CommandSender sender, Map<String,
permission = "",
description = "Set <group> for <user>")
public void userSetGroup(PermissionsEx plugin, CommandSender sender, Map<String, String> args) {
String userName = this.autoCompletePlayerName(args.get("user"));
String worldName = this.autoCompleteWorldName(args.get("world"));

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

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

String groupName = args.get("group");

List<PermissionGroup> groups;
Expand Down Expand Up @@ -574,6 +564,17 @@ public void userSetGroup(PermissionsEx plugin, CommandSender sender, Map<String,
}
}

String userName = this.autoCompletePlayerName(args.get("user"));
String worldName = this.autoCompleteWorldName(args.get("world"));

PermissionUser user = manager.getUser(userName);

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


if (!groups.isEmpty()) {
user.setParents(groups, worldName);
sender.sendMessage(ChatColor.WHITE + "User groups set!");
Expand Down

0 comments on commit abad593

Please sign in to comment.