Rename TypeIdCache to BlockCache.

This commit is contained in:
asofold 2012-10-11 18:23:30 +02:00
parent 96f9232dae
commit b55c43ea71
3 changed files with 18 additions and 18 deletions

View File

@ -36,7 +36,7 @@ import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
import fr.neatmonster.nocheatplus.players.Permissions;
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.PlayerLocation;
import fr.neatmonster.nocheatplus.utilities.TypeIdCache;
import fr.neatmonster.nocheatplus.utilities.BlockCache;
/*
* M"""""`'"""`YM oo
@ -66,13 +66,13 @@ public class MovingListener implements Listener {
private static final class MoveInfo{
public final PlayerLocation from = new PlayerLocation();
public final PlayerLocation to = new PlayerLocation();
public final TypeIdCache cache = new TypeIdCache();
public final BlockCache cache = new BlockCache();
public final void set(final Player player, final Location from, final Location to, final double yOnGround){
this.from.set(from, player, yOnGround);
this.to.set(to, player, yOnGround);
this.cache.setAccess(this.from.getWorldServer());
this.from.setIdCache(cache);
this.to.setIdCache(cache);
this.from.setBlockCache(cache);
this.to.setBlockCache(cache);
}
public final void cleanup(){
from.cleanup();

View File

@ -11,11 +11,11 @@ import org.bukkit.World;
import org.bukkit.craftbukkit.CraftWorld;
/**
* Access to type-ids using caching techniques.
* Access to type-ids and data using caching techniques.
* @author mc_dev
*
*/
public class TypeIdCache implements IBlockAccess{
public class BlockCache implements IBlockAccess{
/**
* TODO: Make a map for faster queries (without object creation).
* TODO: Not sure the prime numbers are too big for normal use.
@ -79,14 +79,14 @@ public class TypeIdCache implements IBlockAccess{
// private int[] id = null;
// private int[] data = null;
public TypeIdCache(){
public BlockCache(){
}
public TypeIdCache(final World world){
public BlockCache(final World world){
setAccess(world);
}
public TypeIdCache(final IBlockAccess access){
public BlockCache(final IBlockAccess access){
setAccess(access);
}

View File

@ -96,7 +96,7 @@ public class PlayerLocation {
/** The worldServer. */
private WorldServer worldServer;
private TypeIdCache idCache;
private BlockCache blockCache;
/**
* Gets the location.
@ -337,7 +337,7 @@ public class PlayerLocation {
}
/**
* Sets the player location object. Does not set or reset idCache.
* Sets the player location object. Does not set or reset blockCache.
*
* @param location
* the location
@ -363,7 +363,7 @@ public class PlayerLocation {
typeId = typeIdBelow = data = null;
aboveStairs = inLava = inWater = inWeb = onGround = onIce = onLadder = passable = null;
// TODO: consider idCache.setAccess.
// TODO: consider blockCache.setAccess.
this.setyOnGround(yFreedom);
}
@ -376,7 +376,7 @@ public class PlayerLocation {
world = null;
worldServer = null;
boundingBox = null;
idCache = null;
blockCache = null;
}
public double getyOnGround() {
@ -462,7 +462,7 @@ public class PlayerLocation {
* @return
*/
public final int getTypeId(final int x, final int y, final int z){
return idCache == null ? worldServer.getTypeId(x, y, z) : idCache.getTypeId(x, y, z);
return blockCache == null ? worldServer.getTypeId(x, y, z) : blockCache.getTypeId(x, y, z);
}
/**
@ -473,7 +473,7 @@ public class PlayerLocation {
* @return
*/
public final int getData(final int x, final int y, final int z){
return idCache == null ? worldServer.getData(x, y, z) : idCache.getData(x, y, z);
return blockCache == null ? worldServer.getData(x, y, z) : blockCache.getData(x, y, z);
}
/**
@ -481,15 +481,15 @@ public class PlayerLocation {
* @return
*/
public final IBlockAccess getBlockAccess() {
return idCache == null ? worldServer : idCache;
return blockCache == null ? worldServer : blockCache;
}
/**
* Set the id cache for faster id getting.
* @param cache
*/
public void setIdCache(final TypeIdCache cache) {
this.idCache = cache;
public void setBlockCache(final BlockCache cache) {
this.blockCache = cache;
}