1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-30 21:07:48 +01:00

Revert back to old permission check

This commit is contained in:
Zrips 2017-02-05 11:28:35 +02:00
parent e9187ad9fa
commit 7b55e161ea
2 changed files with 2 additions and 26 deletions

View File

@ -35,7 +35,6 @@ import com.gamingmesh.jobs.container.JobConditions;
import com.gamingmesh.jobs.container.JobPermission;
import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.Debug;
public class PermissionHandler {
private Jobs plugin;
@ -63,9 +62,9 @@ public class PermissionHandler {
this.plugin.getServer().getPluginManager().removePermission(permission);
changed = true;
}
// 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();
// calculate new permissions
HashMap<String, Boolean> permissions = new HashMap<String, Boolean>();
@ -252,26 +251,6 @@ public class PermissionHandler {
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) {
if (!Jobs.getPermissionManager().hasPermission(player, "jobs.use")) {
return false;

View File

@ -270,9 +270,6 @@ public class JobsPaymentListener implements Listener {
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
return;
if (!Jobs.getPermissionHandler().hasWorldPermission2(player, player.getLocation().getWorld().getName()))
return;
BlockActionInfo bInfo = new BlockActionInfo(block, ActionType.BREAK);
FastPayment fp = Jobs.FastPayment.get(player.getName());
if (fp != null) {