Added return statement for setGroup method, updated it's JavaDocs

This commit is contained in:
Tim Visée 2015-11-21 20:47:56 +01:00
parent 579c51f4a2
commit 7902cd87bb

View File

@ -121,11 +121,15 @@ public class Utils {
} }
/** /**
* Method setGroup. * Set the group of a player, by it's AuthMe group type.
* @param player Player *
* @param group GroupType * @param player The player.
* @param group The group type.
*
* @return True if succeed, false otherwise.
* False is also returned if groups aren't supported with the current permissions system.
*/ */
public static void setGroup(Player player, GroupType group) { public static boolean setGroup(Player player, GroupType group) {
if(!Settings.isPermissionCheckEnabled) if(!Settings.isPermissionCheckEnabled)
return; return;
@ -143,34 +147,33 @@ public class Utils {
case UNREGISTERED: case UNREGISTERED:
// Remove the other group type groups, set the current group // Remove the other group type groups, set the current group
permsMan.removeGroups(player, Arrays.asList(Settings.getRegisteredGroup, Settings.getUnloggedinGroup)); permsMan.removeGroups(player, Arrays.asList(Settings.getRegisteredGroup, Settings.getUnloggedinGroup));
permsMan.addGroup(player, Settings.unRegisteredGroup); return permsMan.addGroup(player, Settings.unRegisteredGroup);
break;
case REGISTERED: case REGISTERED:
// Remove the other group type groups, set the current group // Remove the other group type groups, set the current group
permsMan.removeGroups(player, Arrays.asList(Settings.unRegisteredGroup, Settings.getUnloggedinGroup)); permsMan.removeGroups(player, Arrays.asList(Settings.unRegisteredGroup, Settings.getUnloggedinGroup));
permsMan.addGroup(player, Settings.getRegisteredGroup); return permsMan.addGroup(player, Settings.getRegisteredGroup);
break;
case NOTLOGGEDIN: case NOTLOGGEDIN:
// Remove the other group type groups, set the current group // Remove the other group type groups, set the current group
permsMan.removeGroups(player, Arrays.asList(Settings.unRegisteredGroup, Settings.getRegisteredGroup)); permsMan.removeGroups(player, Arrays.asList(Settings.unRegisteredGroup, Settings.getRegisteredGroup));
permsMan.addGroup(player, Settings.getUnloggedinGroup); return permsMan.addGroup(player, Settings.getUnloggedinGroup);
break;
case LOGGEDIN: case LOGGEDIN:
// Get the limbo player data // Get the limbo player data
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase());
if(limbo == null) if(limbo == null)
break; return false;
// Get the players group // Get the players group
String realGroup = limbo.getGroup(); String realGroup = limbo.getGroup();
// Remove the other group types groups, set the real group // Remove the other group types groups, set the real group
permsMan.removeGroups(player, Arrays.asList(Settings.unRegisteredGroup, Settings.getRegisteredGroup, Settings.getUnloggedinGroup)); permsMan.removeGroups(player, Arrays.asList(Settings.unRegisteredGroup, Settings.getRegisteredGroup, Settings.getUnloggedinGroup));
permsMan.addGroup(player, realGroup); return permsMan.addGroup(player, realGroup);
break;
default:
return false;
} }
} }