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

@ -33,7 +33,14 @@ import com.graywolf336.jail.beans.Prisoner;
public class Util {
private final static Pattern DURATION_PATTERN = Pattern.compile("^(\\d+)\\s*(m(?:inute)?s?|h(?:ours?)?|d(?:ays?)?|s(?:econd)?s?)?$", Pattern.CASE_INSENSITIVE);
/** Checks if the first {@link Vector} is inside the other two. */
/**
* Checks if the first {@link Vector} is inside this region.
*
* @param point The point to check
* @param first point of the region
* @param second second point of the region
* @return True if all the coords of the first vector are in the entire region.
*/
public static boolean isInsideAB(Vector point, Vector first, Vector second) {
boolean x = isInside(point.getBlockX(), first.getBlockX(), second.getBlockX());
boolean y = isInside(point.getBlockY(), first.getBlockY(), second.getBlockY());