Fix a few things, getting back into the flow

This commit is contained in:
Bradley Hilton
2019-04-15 15:41:33 -05:00
parent abc561ded8
commit f0a816513b
3 changed files with 21 additions and 5 deletions

View File

@@ -199,6 +199,22 @@ public class JailManager {
return null;
}
/**
* Gets whether the location is inside of a Jail.
*
* @param l to determine if is in a jail
* @return whether it is inside a jail or not
*/
public boolean isLocationAJail(Location l) {
for(Jail j : jails.values()) {
if(Util.isInsideAB(l.toVector(), j.getMinPoint().toVector(), j.getMaxPoint().toVector())) {
return true;
}
}
return false;
}
/**
* Checks to see if the given name for a {@link Jail} is valid, returns true if it is a valid jail.
*

View File

@@ -25,7 +25,7 @@ public class EntityListener implements Listener {
for(Block b : event.blockList()) {
//Check the current block and if it is inside a jail,
//then let's do something else
if(pl.getJailManager().getJailFromLocation(b.getLocation()) != null) {
if(pl.getJailManager().isLocationAJail(b.getLocation())) {
//Clear the blocklist, this way the explosion effect still happens
event.blockList().clear();
return;
@@ -39,7 +39,7 @@ public class EntityListener implements Listener {
//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) {
if(pl.getJailManager().isLocationAJail(event.getBlock().getLocation())) {
//Let's cancel the event so it doesn't happen
event.setCancelled(true);
}