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"), DEBUG("system.debug"),
DEFAULTJAIL("jailing.jail.defaultJail"), DEFAULTJAIL("jailing.jail.defaultJail"),
DELETEINVENTORY("jailing.jail.deleteInventory"), DELETEINVENTORY("jailing.jail.deleteInventory"),
ENDERMENPROTECTION("jails.endermenProtection"),
EXPLOSIONPROTECTION("jails.explosionProtection"), EXPLOSIONPROTECTION("jails.explosionProtection"),
FOODCONTROL("jailing.during.foodControl"), FOODCONTROL("jailing.during.foodControl"),
FOODCONTROLMAX("jailing.during.foodControlMax"), FOODCONTROLMAX("jailing.during.foodControlMax"),

View File

@ -3,6 +3,7 @@ package com.graywolf336.jail.listeners;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import com.graywolf336.jail.JailMain; 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' username: 'root'
password: 'password' password: 'password'
jails: jails:
endermenProtection: true
explosionProtection: true explosionProtection: true
jailing: jailing:
during: during: