From 73e361623835b4fe0f04815e4d8c6881cd405681 Mon Sep 17 00:00:00 2001 From: Acrobot Date: Sun, 11 Mar 2012 22:56:51 +0100 Subject: [PATCH] - Fixed an issue with LWC (defaulting to public protection) - Fixed an issue with admins not receiving the refund when destroying a shop --- com/Acrobot/ChestShop/Listeners/blockBreak.java | 9 +++++++-- .../ChestShop/Protection/Plugins/LWCplugin.java | 2 +- .../register/payment/forChestShop/Methods.java | 10 +++++----- plugin.yml | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/com/Acrobot/ChestShop/Listeners/blockBreak.java b/com/Acrobot/ChestShop/Listeners/blockBreak.java index 21dd3ca..0c16d50 100644 --- a/com/Acrobot/ChestShop/Listeners/blockBreak.java +++ b/com/Acrobot/ChestShop/Listeners/blockBreak.java @@ -30,7 +30,6 @@ import java.util.List; public class blockBreak implements Listener { public static boolean cancellingBlockBreak(Block block, Player player) { if (block == null) return false; - if (player != null && (Permission.has(player, Permission.ADMIN) || Permission.has(player, Permission.MOD))) return false; if (uSign.isSign(block)) block.getState().update(); //Show the text immediately @@ -38,14 +37,20 @@ public class blockBreak implements Listener { Sign sign = uBlock.findSign(block, (player != null ? uLongName.stripName(player.getName()) : null)); if (!isCorrectSign(sign, block)) return false; //It's not a correct shop sign, so don't cancel it - if (playerIsNotOwner(player, sign)) return true; //Player is not the owner of the shop - cancel! + if (playerIsNotOwner(player, sign)) return !isAdmin(player); //If the player isn't the owner or an admin - cancel! + if (weShouldReturnMoney() && !Permission.has(player, Permission.NOFEE)){ float refundPrice = Config.getFloat(Property.SHOP_REFUND_PRICE); Economy.add(uLongName.getName(sign.getLine(0)), refundPrice); //Add some money player.sendMessage(Config.getLocal(Language.SHOP_REFUNDED).replace("%amount", Economy.formatBalance(refundPrice))); } + return false; //Player is the owner, so we don't want to cancel this :) } + + private static boolean isAdmin(Player p) { + return p != null && (Permission.has(p, Permission.ADMIN) || Permission.has(p, Permission.MOD)); + } private static boolean weShouldReturnMoney() { //We should return money when it's turned on in config, obviously diff --git a/com/Acrobot/ChestShop/Protection/Plugins/LWCplugin.java b/com/Acrobot/ChestShop/Protection/Plugins/LWCplugin.java index 51e3c23..9eb9e4b 100644 --- a/com/Acrobot/ChestShop/Protection/Plugins/LWCplugin.java +++ b/com/Acrobot/ChestShop/Protection/Plugins/LWCplugin.java @@ -33,7 +33,7 @@ public class LWCplugin implements Protection { Player player = ChestShop.getBukkitServer().getPlayer(name); if (player != null && limitsModule.hasReachedLimit(player, block)) return false; - lwc.getPhysicalDatabase().registerProtection(block.getTypeId(), com.griefcraft.model.Protection.Type.PUBLIC, block.getWorld().getName(), name, "", block.getX(), block.getY(), block.getZ()); + lwc.getPhysicalDatabase().registerProtection(block.getTypeId(), com.griefcraft.model.Protection.Type.PRIVATE, block.getWorld().getName(), name, "", block.getX(), block.getY(), block.getZ()); return true; } } diff --git a/com/nijikokun/register/payment/forChestShop/Methods.java b/com/nijikokun/register/payment/forChestShop/Methods.java index b3de4e7..a9cb3fa 100644 --- a/com/nijikokun/register/payment/forChestShop/Methods.java +++ b/com/nijikokun/register/payment/forChestShop/Methods.java @@ -1,6 +1,9 @@ package com.nijikokun.register.payment.forChestShop; -import com.nijikokun.register.payment.forChestShop.methods.*; +import com.nijikokun.register.payment.forChestShop.methods.BOSE7; +import com.nijikokun.register.payment.forChestShop.methods.EE17; +import com.nijikokun.register.payment.forChestShop.methods.iCo5; +import com.nijikokun.register.payment.forChestShop.methods.iCo6; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; @@ -13,9 +16,6 @@ public class Methods { "iConomy", "BOSEconomy", "Essentials", - "Currency", - "MultiCurrency", - "3co" }; private static final Method[] methods = new Method[]{ new iCo5(), @@ -36,7 +36,7 @@ public class Methods { if (m != null) return m; } } - + for (String plugin : toLoad){ Plugin pl = pm.getPlugin(plugin); if (pl != null){ diff --git a/plugin.yml b/plugin.yml index 419ab7a..1ff0028 100644 --- a/plugin.yml +++ b/plugin.yml @@ -2,7 +2,7 @@ name: ChestShop main: com.Acrobot.ChestShop.ChestShop -version: 3.37 +version: 3.38 author: Acrobot