2012-05-10 16:32:25 +02:00
|
|
|
package com.Acrobot.ChestShop.Plugins;
|
|
|
|
|
2012-06-08 15:28:36 +02:00
|
|
|
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
|
2012-05-10 16:32:25 +02:00
|
|
|
import org.bukkit.block.Block;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.Event;
|
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
import org.bukkit.event.Listener;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Acrobot
|
|
|
|
*/
|
|
|
|
public class Deadbolt implements Listener {
|
|
|
|
@EventHandler
|
|
|
|
public static void onProtectionCheck(ProtectionCheckEvent event) {
|
|
|
|
if (event.getResult() == Event.Result.DENY) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Player player = event.getPlayer();
|
|
|
|
Block block = event.getBlock();
|
|
|
|
|
|
|
|
if (!com.daemitus.deadbolt.Deadbolt.isProtected(block)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-06-08 15:28:36 +02:00
|
|
|
if (!com.daemitus.deadbolt.Deadbolt.isAuthorized(player, block)) {
|
2012-05-10 16:32:25 +02:00
|
|
|
event.setResult(Event.Result.DENY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|