mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-02 14:29:07 +01:00
Fixing creative state check by permission node
This commit is contained in:
parent
88ed269041
commit
281542d745
@ -30,6 +30,8 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
|
|||||||
import com.gamingmesh.jobs.container.Job;
|
import com.gamingmesh.jobs.container.Job;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
|
|
||||||
|
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||||
|
|
||||||
public class PermissionManager {
|
public class PermissionManager {
|
||||||
|
|
||||||
private final Map<String, Integer> permDelay = new HashMap<>();
|
private final Map<String, Integer> permDelay = new HashMap<>();
|
||||||
@ -204,7 +206,9 @@ public class PermissionManager {
|
|||||||
|
|
||||||
Map<String, Boolean> permissions = jPlayer.getPermissionsCache();
|
Map<String, Boolean> permissions = jPlayer.getPermissionsCache();
|
||||||
if (permissions == null || getDelay(perm) + jPlayer.getLastPermissionUpdate() < System.currentTimeMillis()) {
|
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.setPermissionsCache(permissions);
|
||||||
jPlayer.setLastPermissionUpdate(System.currentTimeMillis());
|
jPlayer.setLastPermissionUpdate(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
@ -1494,7 +1494,7 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
|
|
||||||
Player player = (Player) human;
|
Player player = (Player) human;
|
||||||
|
|
||||||
if (!player.isOnline() || event.getFoodLevel() <= player.getFoodLevel() )
|
if (!player.isOnline() || event.getFoodLevel() <= player.getFoodLevel())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// check if in creative
|
// check if in creative
|
||||||
@ -1728,12 +1728,13 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean payIfCreative(Player player) {
|
public static boolean payIfCreative(Player player) {
|
||||||
if (!Jobs.getGCManager().payInCreative() && player.getGameMode() == GameMode.CREATIVE && !Jobs.getPermissionManager().hasPermission(Jobs.getPlayerManager().getJobsPlayer(player),
|
if (Jobs.getGCManager().payInCreative() && player.getGameMode() == GameMode.CREATIVE)
|
||||||
"jobs.paycreative")) {
|
return true;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
// Prevent item durability loss
|
||||||
|
Loading…
Reference in New Issue
Block a user