Fix preset groups not using executor's permissions

This commit is contained in:
Esophose 2020-06-19 15:37:33 -06:00
parent 79abe31fd2
commit 5031659aa2
3 changed files with 16 additions and 1 deletions

View file

@ -1,6 +1,8 @@
=== v7.13 ===
+ Added particles for Minecraft 1.16
+ Added getVersion() method to API
* Fixed '/ppo <user> group load <group>' not using the executor's permissions
* Fixed confusion when using '/pp remove fishing'
=== v7.12 ===
+ Added WorldGuard region support
+ Added permission 'playerparticles.worldguard.bypass'

View file

@ -164,6 +164,17 @@ public class PermissionManager extends Manager {
}
/**
* Checks if the given player has the given permission
*
* @param pplayer The player to check
* @param permission The permission to check
* @return true if the player has the permission, otherwise false
*/
public boolean hasPermission(PPlayer pplayer, String permission) {
return pplayer.getUnderlyingExecutor().hasPermission(permission);
}
/**
* Checks if the given player has reached the max number of particles in their active group
*

View file

@ -1,5 +1,7 @@
package dev.esophose.playerparticles.particles;
import dev.esophose.playerparticles.PlayerParticles;
import dev.esophose.playerparticles.manager.PermissionManager;
import org.bukkit.Material;
public class ParticleGroupPreset {
@ -44,7 +46,7 @@ public class ParticleGroupPreset {
*/
public boolean canPlayerUse(PPlayer player) {
// If this particle group has a permission, does the player have it?
if (!this.permission.isEmpty() && !player.getPlayer().hasPermission(this.permission))
if (!this.permission.isEmpty() && PlayerParticles.getInstance().getManager(PermissionManager.class).hasPermission(player, this.permission))
return false;
// If allowPermissionOverride is true, always let the player apply this group