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 //not in the same world implies false
if(!location.getWorld().equals(this.lesserBoundaryCorner.getWorld())) return false; if(!location.getWorld().equals(this.lesserBoundaryCorner.getWorld())) return false;
int x = location.getBlockX(); double x = location.getX();
int y = location.getBlockY(); double y = location.getY();
int z = location.getBlockZ(); double z = location.getZ();
//main check //main check
boolean inClaim = (ignoreHeight || y >= this.lesserBoundaryCorner.getBlockY()) && boolean inClaim = (ignoreHeight || y >= this.lesserBoundaryCorner.getY()) &&
x >= this.lesserBoundaryCorner.getBlockX() && x >= this.lesserBoundaryCorner.getX() &&
x <= this.greaterBoundaryCorner.getBlockX() && x <= this.greaterBoundaryCorner.getX() &&
z >= this.lesserBoundaryCorner.getBlockZ() && z >= this.lesserBoundaryCorner.getZ() &&
z <= this.greaterBoundaryCorner.getBlockZ(); z <= this.greaterBoundaryCorner.getZ();
if(!inClaim) return false; if(!inClaim) return false;

View File

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