Fix a few things, getting back into the flow
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user