mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-10-31 07:39:42 +01:00
Created addGroups method in permissions manager
This commit is contained in:
parent
a6fe728d79
commit
b07e4b62cc
@ -339,8 +339,8 @@ public class PermissionsManager {
|
|||||||
* @return True if the player has permission.
|
* @return True if the player has permission.
|
||||||
*/
|
*/
|
||||||
public boolean hasPermission(Player player, String permsNode, boolean def) {
|
public boolean hasPermission(Player player, String permsNode, boolean def) {
|
||||||
|
// If no permissions system is used, return the default value
|
||||||
if(!isEnabled())
|
if(!isEnabled())
|
||||||
// No permissions system is used, return default
|
|
||||||
return def;
|
return def;
|
||||||
|
|
||||||
switch(this.permsType) {
|
switch(this.permsType) {
|
||||||
@ -394,12 +394,12 @@ public class PermissionsManager {
|
|||||||
*
|
*
|
||||||
* @param player The player.
|
* @param player The player.
|
||||||
*
|
*
|
||||||
* @return Permission groups.
|
* @return Permission groups, or an empty list if this feature is not supported.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
|
@SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
|
||||||
public List<String> getGroups(Player player) {
|
public List<String> getGroups(Player player) {
|
||||||
|
// If no permissions system is used, return an empty list
|
||||||
if(!isEnabled())
|
if(!isEnabled())
|
||||||
// No permissions system is used, return an empty list
|
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
|
||||||
switch(this.permsType) {
|
switch(this.permsType) {
|
||||||
@ -449,11 +449,12 @@ public class PermissionsManager {
|
|||||||
* @param groupName The name of the group.
|
* @param groupName The name of the group.
|
||||||
*
|
*
|
||||||
* @return True if succeed, false otherwise.
|
* @return True if succeed, false otherwise.
|
||||||
|
* False is also returned if this feature isn't supported for the current permissions system.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
|
@SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
|
||||||
public boolean addGroup(Player player, String groupName) {
|
public boolean addGroup(Player player, String groupName) {
|
||||||
|
// If no permissions system is used, return false
|
||||||
if(!isEnabled())
|
if(!isEnabled())
|
||||||
// No permissions system is used, return false
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Set the group the proper way
|
// Set the group the proper way
|
||||||
@ -499,6 +500,31 @@ public class PermissionsManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the permission group of a player, if supported.
|
||||||
|
*
|
||||||
|
* @param player The player
|
||||||
|
* @param groupNames The name of the groups to add.
|
||||||
|
*
|
||||||
|
* @return True if succeed, false otherwise.
|
||||||
|
* False is also returned if this feature isn't supported for the current permissions system.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
|
||||||
|
public boolean addGroups(Player player, List<String> groupNames) {
|
||||||
|
// If no permissions system is used, return false
|
||||||
|
if(!isEnabled())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Add each group to the user
|
||||||
|
boolean result = true;
|
||||||
|
for(String groupName : groupNames)
|
||||||
|
if(!addGroup(player, groupName))
|
||||||
|
result = false;
|
||||||
|
|
||||||
|
// Return the result
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the permission group of a player, if supported.
|
* Set the permission group of a player, if supported.
|
||||||
*
|
*
|
||||||
@ -506,11 +532,12 @@ public class PermissionsManager {
|
|||||||
* @param groupName The name of the group.
|
* @param groupName The name of the group.
|
||||||
*
|
*
|
||||||
* @return True if succeed, false otherwise.
|
* @return True if succeed, false otherwise.
|
||||||
|
* False is also returned if this feature isn't supported for the current permissions system.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
|
@SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
|
||||||
public boolean setGroup(Player player, String groupName) {
|
public boolean setGroup(Player player, String groupName) {
|
||||||
|
// If no permissions system is used, return false
|
||||||
if(!isEnabled())
|
if(!isEnabled())
|
||||||
// No permissions system is used, return false
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Create a list of group names
|
// Create a list of group names
|
||||||
|
Loading…
Reference in New Issue
Block a user