diff --git a/src/main/java/com/gamingmesh/jobs/PermissionManager.java b/src/main/java/com/gamingmesh/jobs/PermissionManager.java index 69f687e7..d1bbaba6 100644 --- a/src/main/java/com/gamingmesh/jobs/PermissionManager.java +++ b/src/main/java/com/gamingmesh/jobs/PermissionManager.java @@ -30,6 +30,8 @@ import org.bukkit.permissions.PermissionAttachmentInfo; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; +import net.Zrips.CMILib.Logs.CMIDebug; + public class PermissionManager { private final Map permDelay = new HashMap<>(); @@ -204,7 +206,9 @@ public class PermissionManager { Map permissions = jPlayer.getPermissionsCache(); if (permissions == null || getDelay(perm) + jPlayer.getLastPermissionUpdate() < System.currentTimeMillis()) { - permissions = getAll(player); + if (permissions == null) + permissions = new HashMap<>(); + permissions.put(perm, player.hasPermission(perm)); jPlayer.setPermissionsCache(permissions); jPlayer.setLastPermissionUpdate(System.currentTimeMillis()); } diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index a6e7a16d..19d30f27 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -1494,7 +1494,7 @@ public final class JobsPaymentListener implements Listener { Player player = (Player) human; - if (!player.isOnline() || event.getFoodLevel() <= player.getFoodLevel() ) + if (!player.isOnline() || event.getFoodLevel() <= player.getFoodLevel()) return; // check if in creative @@ -1728,12 +1728,13 @@ public final class JobsPaymentListener implements Listener { } public static boolean payIfCreative(Player player) { - if (!Jobs.getGCManager().payInCreative() && player.getGameMode() == GameMode.CREATIVE && !Jobs.getPermissionManager().hasPermission(Jobs.getPlayerManager().getJobsPlayer(player), - "jobs.paycreative")) { - return false; - } + if (Jobs.getGCManager().payInCreative() && player.getGameMode() == GameMode.CREATIVE) + return true; - return true; + if (player.getGameMode() == GameMode.CREATIVE && Jobs.getPermissionManager().hasPermission(Jobs.getPlayerManager().getJobsPlayer(player), "jobs.paycreative")) + return true; + + return player.getGameMode() != GameMode.CREATIVE; } // Prevent item durability loss