ChestShop-3/com/Acrobot/ChestShop/Protection/Plugins/LWCplugin.java
Acrobot e87f5f4f11 - Added a warning if spawn-radius isn't set to 0
- Deleted a few outdated plugins from built-in Register
- System.out -> System.err for errors
- Blocked buying if you're holding a sign in your hand (allows, for example, for sign editors to work)
- Updated Heroes package
- Fixed WG integration (no longer throws errors, but uses ugly workaround)
- Fixed a small bug in Register plugin loading message
- Removed version checking for OddItem, WorldGuard and LWC
2012-03-06 19:41:14 +01:00

40 lines
1.3 KiB
Java

package com.Acrobot.ChestShop.Protection.Plugins;
import com.Acrobot.ChestShop.ChestShop;
import com.Acrobot.ChestShop.Protection.Protection;
import com.griefcraft.lwc.LWC;
import com.griefcraft.modules.limits.LimitsModule;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
/**
* @author Acrobot
*/
public class LWCplugin implements Protection {
public static LWC lwc;
private static LimitsModule limitsModule;
public static void setLWC(LWC LWC) {
lwc = LWC;
limitsModule = new LimitsModule();
}
public boolean isProtected(Block block) {
return lwc.findProtection(block) != null;
}
public boolean canAccess(Player player, Block block) {
return lwc.findProtection(block) == null || lwc.canAccessProtection(player, block);
}
public boolean protect(String name, Block block) {
if (lwc.findProtection(block) != null) return false;
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());
return true;
}
}