mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +01:00
Revert back to old permission check
This commit is contained in:
parent
e9187ad9fa
commit
7b55e161ea
@ -35,7 +35,6 @@ import com.gamingmesh.jobs.container.JobConditions;
|
|||||||
import com.gamingmesh.jobs.container.JobPermission;
|
import com.gamingmesh.jobs.container.JobPermission;
|
||||||
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 PermissionHandler {
|
public class PermissionHandler {
|
||||||
private Jobs plugin;
|
private Jobs plugin;
|
||||||
@ -63,9 +62,9 @@ public class PermissionHandler {
|
|||||||
this.plugin.getServer().getPluginManager().removePermission(permission);
|
this.plugin.getServer().getPluginManager().removePermission(permission);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Permissions should only apply if we have permission to use jobs in this world
|
// Permissions should only apply if we have permission to use jobs in this world
|
||||||
if (hasWorldPermission2(player, player.getWorld().getName())) {
|
if (hasWorldPermission(player, player.getWorld().getName())) {
|
||||||
List<JobProgression> progression = jPlayer.getJobProgression();
|
List<JobProgression> progression = jPlayer.getJobProgression();
|
||||||
// calculate new permissions
|
// calculate new permissions
|
||||||
HashMap<String, Boolean> permissions = new HashMap<String, Boolean>();
|
HashMap<String, Boolean> permissions = new HashMap<String, Boolean>();
|
||||||
@ -252,26 +251,6 @@ public class PermissionHandler {
|
|||||||
return player.hasPermission("jobs.world." + world.toLowerCase());
|
return player.hasPermission("jobs.world." + world.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasWorldPermission2(Player player, String world) {
|
|
||||||
boolean foundMain = false;
|
|
||||||
boolean foundWorld = false;
|
|
||||||
for (PermissionAttachmentInfo one : player.getEffectivePermissions()) {
|
|
||||||
if (one.getPermission().equalsIgnoreCase("jobs.use")) {
|
|
||||||
foundMain = true;
|
|
||||||
if (foundWorld)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (one.getPermission().equalsIgnoreCase("jobs.world." + world.toLowerCase())) {
|
|
||||||
foundWorld = true;
|
|
||||||
if (foundMain)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!foundMain || !foundWorld)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasWorldPermission(JobsPlayer player, String world) {
|
public boolean hasWorldPermission(JobsPlayer player, String world) {
|
||||||
if (!Jobs.getPermissionManager().hasPermission(player, "jobs.use")) {
|
if (!Jobs.getPermissionManager().hasPermission(player, "jobs.use")) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -270,9 +270,6 @@ public class JobsPaymentListener implements Listener {
|
|||||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Jobs.getPermissionHandler().hasWorldPermission2(player, player.getLocation().getWorld().getName()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
BlockActionInfo bInfo = new BlockActionInfo(block, ActionType.BREAK);
|
BlockActionInfo bInfo = new BlockActionInfo(block, ActionType.BREAK);
|
||||||
FastPayment fp = Jobs.FastPayment.get(player.getName());
|
FastPayment fp = Jobs.FastPayment.get(player.getName());
|
||||||
if (fp != null) {
|
if (fp != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user