Protect against block breaking and block placing in jails

Unless the player has admin permission. This does not include the
penalties as those will be done in a future commit. This also has a
little better performance on the block placing and breaking events, if
these checks are disabled.
This commit is contained in:
graywolf336
2014-01-08 15:02:24 -06:00
parent ab74a158b8
commit d734d99e88
7 changed files with 89 additions and 4 deletions

View File

@ -111,6 +111,22 @@ public class JailManager {
}
}
/**
* Gets the jail which this location is in, will return null if none exist.
*
* @param loc to get the jail from
* @return The jail this block is in, null if no jail found.
*/
public Jail getJailFromLocation(Location loc) {
for(Jail j : jails.values()) {
if(Util.isInsideAB(loc.toVector(), j.getMinPoint().toVector(), j.getMaxPoint().toVector())) {
return j;
}
}
return null;
}
/**
* Checks to see if the given name for a {@link Jail} is valid, returns true if it is a valid jail.
*