mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-08-20 18:32:49 +00:00
Minor optimization when checking bukkit permissions.
This commit is contained in:
parent
a8da3eebd7
commit
d2d8d191da
|
@ -146,4 +146,5 @@ v 1.9:
|
||||||
- Removed BukkitPermsOverride as this is now the default with bukkit handling child nodes.
|
- Removed BukkitPermsOverride as this is now the default with bukkit handling child nodes.
|
||||||
- Prevent adding inheritances and info nodes to globalgroups. These are permissions collections, not player groups.
|
- Prevent adding inheritances and info nodes to globalgroups. These are permissions collections, not player groups.
|
||||||
- Prevent promoting players to, and demoting to GlobalGroups.
|
- Prevent promoting players to, and demoting to GlobalGroups.
|
||||||
- Make 'manload' reload the config correctly.
|
- Make 'manload' reload the config correctly.
|
||||||
|
- Minor optimization when checking bukkit permissions.
|
|
@ -17,9 +17,7 @@ import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
|
||||||
import org.anjocaido.groupmanager.data.User;
|
import org.anjocaido.groupmanager.data.User;
|
||||||
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
|
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
|
||||||
import org.anjocaido.groupmanager.utils.PermissionCheckResult.Type;
|
import org.anjocaido.groupmanager.utils.PermissionCheckResult.Type;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.permissions.Permission;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Everything here maintains the model created by Nijikokun
|
* Everything here maintains the model created by Nijikokun
|
||||||
|
@ -767,9 +765,9 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||||
// Check Bukkit perms to support plugins which add perms via code
|
// Check Bukkit perms to support plugins which add perms via code
|
||||||
// (Heroes).
|
// (Heroes).
|
||||||
final Player player = user.getBukkitPlayer();
|
final Player player = user.getBukkitPlayer();
|
||||||
final Permission bukkitPerm = Bukkit.getPluginManager().getPermission(targetPermission);
|
//final Permission bukkitPerm = Bukkit.getPluginManager().getPermission(targetPermission);
|
||||||
if (player != null && bukkitPerm != null) {
|
if (player != null && player.hasPermission(targetPermission)) {
|
||||||
result.resultType = player.hasPermission(bukkitPerm) ? PermissionCheckResult.Type.FOUND : PermissionCheckResult.Type.NEGATION;
|
result.resultType = PermissionCheckResult.Type.FOUND;
|
||||||
result.owner = user;
|
result.owner = user;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue