diff --git a/com/gamingmesh/jobs/.gitignore b/com/gamingmesh/jobs/.gitignore index 95030747..f7cbafcd 100644 --- a/com/gamingmesh/jobs/.gitignore +++ b/com/gamingmesh/jobs/.gitignore @@ -8,3 +8,5 @@ /NMS.class /JobsPlugin.class /PlayerManager$BoostOf.class +/PermissionManager.class +/PermissionManager$prm.class diff --git a/com/gamingmesh/jobs/Jobs.java b/com/gamingmesh/jobs/Jobs.java index b8dc34a2..3f44d64a 100644 --- a/com/gamingmesh/jobs/Jobs.java +++ b/com/gamingmesh/jobs/Jobs.java @@ -125,6 +125,7 @@ public class Jobs extends JavaPlugin { // public static WeakHashMap GlobalBoost = new WeakHashMap(); private static BufferedEconomy economy; private static PermissionHandler permissionHandler; + private static PermissionManager permissionManager; public static BufferedPaymentThread paymentThread = null; private static DatabaseSaveThread saveTask = null; @@ -540,6 +541,8 @@ public class Jobs extends JavaPlugin { Jobs.getScheduleManager().load(); if (GconfigManager.useGlobalBoostScheduler) Jobs.getScheduleManager().start(); + + permissionManager = new PermissionManager(); } /** @@ -630,6 +633,10 @@ public class Jobs extends JavaPlugin { return permissionHandler; } + public static PermissionManager getPermissionManager() { + return permissionManager; + } + /** * Sets the economy handler * @param eco - the economy handler diff --git a/com/gamingmesh/jobs/PermissionHandler.java b/com/gamingmesh/jobs/PermissionHandler.java index 0e328cb0..bf1c8ed2 100644 --- a/com/gamingmesh/jobs/PermissionHandler.java +++ b/com/gamingmesh/jobs/PermissionHandler.java @@ -239,6 +239,10 @@ public class PermissionHandler { /** * Check World permissions */ + public boolean hasWorldPermission(Player player) { + return hasWorldPermission(player, player.getWorld().getName()); + } + public boolean hasWorldPermission(Player player, String world) { if (!player.hasPermission("jobs.use")) { return false; diff --git a/com/gamingmesh/jobs/container/JobsPlayer.java b/com/gamingmesh/jobs/container/JobsPlayer.java index 5426eaf7..457911ca 100644 --- a/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/com/gamingmesh/jobs/container/JobsPlayer.java @@ -73,6 +73,9 @@ public class JobsPlayer { private Long seen = System.currentTimeMillis(); + private HashMap permissionsCache = null; + private Long lastPermissionUpdate = -1L; + public JobsPlayer(String userName, OfflinePlayer player) { this.userName = userName; this.OffPlayer = player; @@ -669,4 +672,24 @@ public class JobsPlayer { public void setSeen(Long seen) { this.seen = seen; } + + public HashMap getPermissionsCache() { + return permissionsCache; + } + + public void setPermissionsCache(HashMap permissionsCache) { + this.permissionsCache = permissionsCache; + } + + public void setPermissionsCache(String permission, Boolean state) { + this.permissionsCache.put(permission, state); + } + + public Long getLastPermissionUpdate() { + return lastPermissionUpdate; + } + + public void setLastPermissionUpdate(Long lastPermissionUpdate) { + this.lastPermissionUpdate = lastPermissionUpdate; + } } diff --git a/com/gamingmesh/jobs/listeners/JobsListener.java b/com/gamingmesh/jobs/listeners/JobsListener.java index 62dcd753..84b183f1 100644 --- a/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/com/gamingmesh/jobs/listeners/JobsListener.java @@ -65,7 +65,6 @@ import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobLimitedItems; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; -import com.gamingmesh.jobs.stuff.Debug; public class JobsListener implements Listener { // hook to the main plugin @@ -129,26 +128,17 @@ public class JobsListener implements Listener { Jobs.getGCManager().JobsGUISwitcheButtons && event.getClick() == ClickType.RIGHT)) { Job job = Jobs.getGUIManager().getJobBySlot(player, slot); if (job != null) { - Inventory inv = Jobs.getGUIManager().CreateJobsSubGUI(player, job); -// player.closeInventory(); Inventory top = player.getOpenInventory().getTopInventory(); if (top.getSize() == 54) top.setContents(inv.getContents()); -// player.openInventory(inv); } } else if (joblist.isJobInfo()) { if (slot == joblist.getbackButton()) { - Inventory inv = Jobs.getGUIManager().CreateJobsGUI(player); -// player.closeInventory(); Inventory top = player.getOpenInventory().getTopInventory(); if (top.getSize() == 54) top.setContents(inv.getContents()); - - Debug.D("back"); -// player.closeInventory(); -// player.openInventory(Jobs.getGUIManager().CreateJobsGUI(player)); } } else if (!Jobs.getGCManager().JobsGUISwitcheButtons && event.getClick() == ClickType.RIGHT || Jobs.getGCManager().JobsGUISwitcheButtons && event.getClick() == ClickType.LEFT) {