From b55c43ea716416dc58ef214ecded57e322d80c60 Mon Sep 17 00:00:00 2001 From: asofold Date: Thu, 11 Oct 2012 18:23:30 +0200 Subject: [PATCH] Rename TypeIdCache to BlockCache. --- .../checks/moving/MovingListener.java | 8 ++++---- .../{TypeIdCache.java => BlockCache.java} | 10 +++++----- .../nocheatplus/utilities/PlayerLocation.java | 18 +++++++++--------- 3 files changed, 18 insertions(+), 18 deletions(-) rename src/fr/neatmonster/nocheatplus/utilities/{TypeIdCache.java => BlockCache.java} (91%) diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java b/src/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java index 3998c5af..30b07f55 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java @@ -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(); diff --git a/src/fr/neatmonster/nocheatplus/utilities/TypeIdCache.java b/src/fr/neatmonster/nocheatplus/utilities/BlockCache.java similarity index 91% rename from src/fr/neatmonster/nocheatplus/utilities/TypeIdCache.java rename to src/fr/neatmonster/nocheatplus/utilities/BlockCache.java index da2f48cb..57b9e67b 100644 --- a/src/fr/neatmonster/nocheatplus/utilities/TypeIdCache.java +++ b/src/fr/neatmonster/nocheatplus/utilities/BlockCache.java @@ -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); } diff --git a/src/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java b/src/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java index cc3228ab..72926044 100644 --- a/src/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java +++ b/src/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java @@ -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; }