mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-10-31 07:39:42 +01:00
Fixed addNormal method, updated it's JavaDocs
This commit is contained in:
parent
7902cd87bb
commit
89b5444d69
@ -178,27 +178,30 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method addNormal.
|
* TODO: This method requires better explanation.
|
||||||
* @param player Player
|
*
|
||||||
* @param group String
|
* Set the normal group of a player.
|
||||||
|
*
|
||||||
* @return boolean */
|
* @param player The player.
|
||||||
|
* @param group The normal group.
|
||||||
|
|
||||||
|
* @return True on success, false on failure.
|
||||||
|
*/
|
||||||
public static boolean addNormal(Player player, String group) {
|
public static boolean addNormal(Player player, String group) {
|
||||||
if (!useGroupSystem()) {
|
if(!Settings.isPermissionCheckEnabled)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (plugin.vaultGroupManagement == null)
|
// Get the permissions manager, and make sure it's valid
|
||||||
return false;
|
PermissionsManager permsMan = plugin.getPermissionsManager();
|
||||||
try {
|
if(permsMan == null)
|
||||||
if (plugin.vaultGroupManagement.playerRemoveGroup(player, Settings.getUnloggedinGroup) && plugin.vaultGroupManagement.playerAddGroup(player, group)) {
|
ConsoleLogger.showError("Failed to access permissions manager instance, shutting down.");
|
||||||
return true;
|
assert permsMan != null;
|
||||||
}
|
|
||||||
} catch (UnsupportedOperationException e) {
|
// Remove old groups
|
||||||
ConsoleLogger.showError("Your permission system (" + plugin.vaultGroupManagement.getName() + ") do not support Group system with that config... unhook!");
|
permsMan.removeGroups(player, Arrays.asList(Settings.unRegisteredGroup, Settings.getRegisteredGroup, Settings.getUnloggedinGroup));
|
||||||
plugin.vaultGroupManagement = null;
|
|
||||||
return false;
|
// Add the normal group, return the result
|
||||||
}
|
return permsMan.addGroup(player, group);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Move to a Manager
|
// TODO: Move to a Manager
|
||||||
|
Loading…
Reference in New Issue
Block a user