mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Small changes
This commit is contained in:
parent
1aa56869c2
commit
6062d403e2
2
com/gamingmesh/jobs/.gitignore
vendored
2
com/gamingmesh/jobs/.gitignore
vendored
@ -8,3 +8,5 @@
|
||||
/NMS.class
|
||||
/JobsPlugin.class
|
||||
/PlayerManager$BoostOf.class
|
||||
/PermissionManager.class
|
||||
/PermissionManager$prm.class
|
||||
|
@ -125,6 +125,7 @@ public class Jobs extends JavaPlugin {
|
||||
// public static WeakHashMap<String, Double> GlobalBoost = new WeakHashMap<String, Double>();
|
||||
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
|
||||
|
@ -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;
|
||||
|
@ -73,6 +73,9 @@ public class JobsPlayer {
|
||||
|
||||
private Long seen = System.currentTimeMillis();
|
||||
|
||||
private HashMap<String, Boolean> 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<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;
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user