- Fixed an issue with LWC (defaulting to public protection)

- Fixed an issue with admins not receiving the refund when destroying a shop
This commit is contained in:
Acrobot 2012-03-11 22:56:51 +01:00
parent e87f5f4f11
commit 73e3616238
4 changed files with 14 additions and 9 deletions

View File

@ -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

View File

@ -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;
}
}

View File

@ -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){

View File

@ -2,7 +2,7 @@ name: ChestShop
main: com.Acrobot.ChestShop.ChestShop
version: 3.37
version: 3.38
author: Acrobot