Enable protecting endermen protections in jails

This commit is contained in:
graywolf336 2014-01-21 12:31:56 -06:00
parent 4179a6a2d3
commit abb3e70bdf
3 changed files with 15 additions and 0 deletions

View File

@ -17,6 +17,7 @@ public enum Settings {
DEBUG("system.debug"),
DEFAULTJAIL("jailing.jail.defaultJail"),
DELETEINVENTORY("jailing.jail.deleteInventory"),
ENDERMENPROTECTION("jails.endermenProtection"),
EXPLOSIONPROTECTION("jails.explosionProtection"),
FOODCONTROL("jailing.during.foodControl"),
FOODCONTROLMAX("jailing.during.foodControlMax"),

View File

@ -3,6 +3,7 @@ package com.graywolf336.jail.listeners;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import com.graywolf336.jail.JailMain;
@ -32,4 +33,16 @@ public class EntityListener implements Listener {
}
}
}
@EventHandler(ignoreCancelled=true)
public void protectFromEndermen(EntityChangeBlockEvent event) {
//If we are protecting the jails from endermen protection
if(pl.getConfig().getBoolean(Settings.ENDERMENPROTECTION.getPath())) {
//Check if there are any jails where the block's location is
if(pl.getJailManager().getJailFromLocation(event.getBlock().getLocation()) != null) {
//Let's cancel the event so it doesn't happen
event.setCancelled(true);
}
}
}
}

View File

@ -12,6 +12,7 @@ storage:
username: 'root'
password: 'password'
jails:
endermenProtection: true
explosionProtection: true
jailing:
during: