Skip to content

Commit

Permalink
Check cuboid contains better
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Apr 9, 2015
1 parent b3cb7a9 commit 1534c0f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Expand Up @@ -143,8 +143,8 @@ public void playerMoveEvent(PlayerMoveEvent event) {
// Look for cuboids that contain the block's location
List<dCuboid> cuboids = dCuboid.getNotableCuboidsContaining(event.getTo());
List<dCuboid> match = new ArrayList<dCuboid>();
String namelow = CoreUtilities.toLowerCase(event.getPlayer().getName());
if (player_cuboids.containsKey(namelow))
String namelow = CoreUtilities.toLowerCase(event.getPlayer().getName()); // TODO: UUID?
if (player_cuboids.containsKey(namelow)) // TODO: Clear on quit?
match = player_cuboids.get(namelow);

List<dCuboid> exits = new ArrayList<dCuboid>(match);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/aufdemrand/denizen/objects/dCuboid.java
Expand Up @@ -252,11 +252,11 @@ public boolean isInsideCuboid(Location location) {
for (LocationPair pair : pairs) {
if (!location.getWorld().equals(pair.low.getWorld()))
continue;
if (!Utilities.isBetween(pair.low.getBlockX(), pair.high.getBlockX(), location.getBlockX()))
if (!Utilities.isBetween(pair.low.getBlockX(), pair.high.getBlockX() + 1, location.getBlockX()))
continue;
if (!Utilities.isBetween(pair.low.getBlockY(), pair.high.getBlockY(), location.getBlockY()))
if (!Utilities.isBetween(pair.low.getBlockY(), pair.high.getBlockY() + 1, location.getBlockY()))
continue;
if (Utilities.isBetween(pair.low.getBlockZ(), pair.high.getBlockZ(), location.getBlockZ()))
if (Utilities.isBetween(pair.low.getBlockZ(), pair.high.getBlockZ() + 1, location.getBlockZ()))
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/aufdemrand/denizen/objects/dPlayer.java
Expand Up @@ -1991,7 +1991,7 @@ public void adjust(Mechanism mechanism) {
// Sets the time of day the Player is currently experiencing. Setting this will cause the
// player to have a different time than other Players in the world are experiencing though
// time will continue to progress. Using the 'reset_time' mechanism, or relogging your player
// will reset this mechanism to match the world's current time. Valid range is 0-28000
// will reset this mechanism to match the world's current time. Valid range is 0-24000
// @tags
// <player.time>
// -->
Expand All @@ -2008,7 +2008,7 @@ public void adjust(Mechanism mechanism) {
// there is a small 'twitch effect' when looking at the sky when time is frozen.
// Setting this will cause the player to have a different time than other Players in
// the world are experiencing. Using the 'reset_time' mechanism, or relogging your player
// will reset this mechanism to match the world's current time. Valid range is 0-28000
// will reset this mechanism to match the world's current time. Valid range is 0-24000
// @tags
// <player.time>
// -->
Expand Down
Expand Up @@ -142,7 +142,7 @@ public static int lastIndexOfUCL(String str) {
* @return true if c is in between.
*/
public static boolean isBetween(double a, double b, double c) {
return a == c || b == c || (b > a ? c > a && c < b : c > b && c < a);
return b > a ? c >= a && c <= b: c >= b && c <= a;
}


Expand Down

0 comments on commit 1534c0f

Please sign in to comment.