Perf: Claim Lookup

This commit is contained in:
ryanhamshire 2014-11-16 14:17:40 -08:00
parent 8ce958435e
commit 1a1bddef36
2 changed files with 10 additions and 16 deletions

View File

@ -642,16 +642,16 @@ public class Claim
//not in the same world implies false
if(!location.getWorld().equals(this.lesserBoundaryCorner.getWorld())) return false;
int x = location.getBlockX();
int y = location.getBlockY();
int z = location.getBlockZ();
double x = location.getX();
double y = location.getY();
double z = location.getZ();
//main check
boolean inClaim = (ignoreHeight || y >= this.lesserBoundaryCorner.getBlockY()) &&
x >= this.lesserBoundaryCorner.getBlockX() &&
x <= this.greaterBoundaryCorner.getBlockX() &&
z >= this.lesserBoundaryCorner.getBlockZ() &&
z <= this.greaterBoundaryCorner.getBlockZ();
boolean inClaim = (ignoreHeight || y >= this.lesserBoundaryCorner.getY()) &&
x >= this.lesserBoundaryCorner.getX() &&
x <= this.greaterBoundaryCorner.getX() &&
z >= this.lesserBoundaryCorner.getZ() &&
z <= this.greaterBoundaryCorner.getZ();
if(!inClaim) return false;

View File

@ -457,8 +457,7 @@ public abstract class DataStore
this.playerNameToPlayerDataMap.put(playerID, playerData);
}
//try the hash map again. if it's STILL not there, we have a bug to fix
return this.playerNameToPlayerDataMap.get(playerID);
return playerData;
}
abstract PlayerData getPlayerDataFromStorage(UUID playerID);
@ -566,12 +565,7 @@ public abstract class DataStore
//gets a unique, persistent identifier string for a chunk
private String getChunkString(Location location)
{
StringBuilder builder = new StringBuilder(
String.valueOf(location.getBlockX() >> 4))
.append(location.getWorld().getName())
.append(location.getBlockZ() >> 4);
return builder.toString();
return (location.getBlockX() >> 4) + location.getWorld().getName() + (location.getBlockZ() >> 4);
}
//creates a claim.