1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Small changes

This commit is contained in:
Zrips 2017-01-11 19:21:33 +02:00
parent 1aa56869c2
commit 6062d403e2
5 changed files with 36 additions and 10 deletions

View File

@ -8,3 +8,5 @@
/NMS.class /NMS.class
/JobsPlugin.class /JobsPlugin.class
/PlayerManager$BoostOf.class /PlayerManager$BoostOf.class
/PermissionManager.class
/PermissionManager$prm.class

View File

@ -125,6 +125,7 @@ public class Jobs extends JavaPlugin {
// public static WeakHashMap<String, Double> GlobalBoost = new WeakHashMap<String, Double>(); // public static WeakHashMap<String, Double> GlobalBoost = new WeakHashMap<String, Double>();
private static BufferedEconomy economy; private static BufferedEconomy economy;
private static PermissionHandler permissionHandler; private static PermissionHandler permissionHandler;
private static PermissionManager permissionManager;
public static BufferedPaymentThread paymentThread = null; public static BufferedPaymentThread paymentThread = null;
private static DatabaseSaveThread saveTask = null; private static DatabaseSaveThread saveTask = null;
@ -540,6 +541,8 @@ public class Jobs extends JavaPlugin {
Jobs.getScheduleManager().load(); Jobs.getScheduleManager().load();
if (GconfigManager.useGlobalBoostScheduler) if (GconfigManager.useGlobalBoostScheduler)
Jobs.getScheduleManager().start(); Jobs.getScheduleManager().start();
permissionManager = new PermissionManager();
} }
/** /**
@ -630,6 +633,10 @@ public class Jobs extends JavaPlugin {
return permissionHandler; return permissionHandler;
} }
public static PermissionManager getPermissionManager() {
return permissionManager;
}
/** /**
* Sets the economy handler * Sets the economy handler
* @param eco - the economy handler * @param eco - the economy handler

View File

@ -239,6 +239,10 @@ public class PermissionHandler {
/** /**
* Check World permissions * Check World permissions
*/ */
public boolean hasWorldPermission(Player player) {
return hasWorldPermission(player, player.getWorld().getName());
}
public boolean hasWorldPermission(Player player, String world) { public boolean hasWorldPermission(Player player, String world) {
if (!player.hasPermission("jobs.use")) { if (!player.hasPermission("jobs.use")) {
return false; return false;

View File

@ -73,6 +73,9 @@ public class JobsPlayer {
private Long seen = System.currentTimeMillis(); private Long seen = System.currentTimeMillis();
private HashMap<String, Boolean> permissionsCache = null;
private Long lastPermissionUpdate = -1L;
public JobsPlayer(String userName, OfflinePlayer player) { public JobsPlayer(String userName, OfflinePlayer player) {
this.userName = userName; this.userName = userName;
this.OffPlayer = player; this.OffPlayer = player;
@ -669,4 +672,24 @@ public class JobsPlayer {
public void setSeen(Long seen) { public void setSeen(Long seen) {
this.seen = seen; this.seen = seen;
} }
public HashMap<String, Boolean> getPermissionsCache() {
return permissionsCache;
}
public void setPermissionsCache(HashMap<String, Boolean> 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;
}
} }

View File

@ -65,7 +65,6 @@ import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobLimitedItems; import com.gamingmesh.jobs.container.JobLimitedItems;
import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.Debug;
public class JobsListener implements Listener { public class JobsListener implements Listener {
// hook to the main plugin // hook to the main plugin
@ -129,26 +128,17 @@ public class JobsListener implements Listener {
Jobs.getGCManager().JobsGUISwitcheButtons && event.getClick() == ClickType.RIGHT)) { Jobs.getGCManager().JobsGUISwitcheButtons && event.getClick() == ClickType.RIGHT)) {
Job job = Jobs.getGUIManager().getJobBySlot(player, slot); Job job = Jobs.getGUIManager().getJobBySlot(player, slot);
if (job != null) { if (job != null) {
Inventory inv = Jobs.getGUIManager().CreateJobsSubGUI(player, job); Inventory inv = Jobs.getGUIManager().CreateJobsSubGUI(player, job);
// player.closeInventory();
Inventory top = player.getOpenInventory().getTopInventory(); Inventory top = player.getOpenInventory().getTopInventory();
if (top.getSize() == 54) if (top.getSize() == 54)
top.setContents(inv.getContents()); top.setContents(inv.getContents());
// player.openInventory(inv);
} }
} else if (joblist.isJobInfo()) { } else if (joblist.isJobInfo()) {
if (slot == joblist.getbackButton()) { if (slot == joblist.getbackButton()) {
Inventory inv = Jobs.getGUIManager().CreateJobsGUI(player); Inventory inv = Jobs.getGUIManager().CreateJobsGUI(player);
// player.closeInventory();
Inventory top = player.getOpenInventory().getTopInventory(); Inventory top = player.getOpenInventory().getTopInventory();
if (top.getSize() == 54) if (top.getSize() == 54)
top.setContents(inv.getContents()); top.setContents(inv.getContents());
Debug.D("back");
// player.closeInventory();
// player.openInventory(Jobs.getGUIManager().CreateJobsGUI(player));
} }
} else if (!Jobs.getGCManager().JobsGUISwitcheButtons && event.getClick() == ClickType.RIGHT || } else if (!Jobs.getGCManager().JobsGUISwitcheButtons && event.getClick() == ClickType.RIGHT ||
Jobs.getGCManager().JobsGUISwitcheButtons && event.getClick() == ClickType.LEFT) { Jobs.getGCManager().JobsGUISwitcheButtons && event.getClick() == ClickType.LEFT) {