From 6006b0e011403a3e88dc515d530d61fb1be9086b Mon Sep 17 00:00:00 2001 From: boy0001 Date: Tue, 1 Sep 2015 14:02:37 +1000 Subject: [PATCH] Add world parameter to EconHandler permission checks Fixes #595 --- .../plot/util/EconHandler.java | 14 ++++++++++++-- .../plotsquared/bukkit/util/BukkitEconHandler.java | 10 +++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/intellectualcrafters/plot/util/EconHandler.java b/src/main/java/com/intellectualcrafters/plot/util/EconHandler.java index a15c2f115..064cf546b 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/EconHandler.java +++ b/src/main/java/com/intellectualcrafters/plot/util/EconHandler.java @@ -16,6 +16,16 @@ public abstract class EconHandler { public abstract void withdrawMoney(PlotPlayer player, double amount); public abstract void depositMoney(PlotPlayer player, double amount); public abstract void depositMoney(OfflinePlotPlayer player, double amount); - public abstract void setPermission(String player, String perm, boolean value); - public abstract boolean hasPermission(String player, String perm); + + public void setPermission(String player, String perm, boolean value) { + setPermission(null, player, perm, value); + } + + public abstract void setPermission(String world, String player, String perm, boolean value); + + public abstract boolean hasPermission(String world, String player, String perm); + + public boolean hasPermission(String player, String perm) { + return hasPermission(null, player, perm); + } } diff --git a/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java b/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java index b4b425e4f..a74fb27e5 100644 --- a/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java +++ b/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java @@ -78,17 +78,17 @@ public class BukkitEconHandler extends EconHandler { } @Override - public void setPermission(String player, String perm, boolean value) { + public void setPermission(String world, String player, String perm, boolean value) { if (value) { - perms.playerAdd((World) null, player, perm); + perms.playerAdd(world, player, perm); } else { - perms.playerRemove((World) null, player, perm); + perms.playerRemove(world, player, perm); } } @Override - public boolean hasPermission(String player, String perm) { - return perms.playerHas((String) null, Bukkit.getOfflinePlayer(player), perm); + public boolean hasPermission(String world, String player, String perm) { + return perms.playerHas(world, Bukkit.getOfflinePlayer(player), perm); } }