From 817ac36f8b75fd84f754f822db3042a0014e60a5 Mon Sep 17 00:00:00 2001 From: asofold Date: Mon, 17 Dec 2012 17:57:07 +0100 Subject: [PATCH] Comments, order, init values. --- .../checks/moving/MovingListener.java | 3 +- .../nocheatplus/utilities/PlayerLocation.java | 91 ++++++++++--------- 2 files changed, 49 insertions(+), 45 deletions(-) diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java index 57e89d72..769df982 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java @@ -226,11 +226,10 @@ public class MovingListener extends CheckListener{ if (bedLeave.isEnabled(player) && bedLeave.checkBed(player)) { // Check if the player has to be reset. - // To cancel the event, we teleport the player. + // To "cancel" the event, we teleport the player. final Location loc = player.getLocation(); final MovingData data = MovingData.getData(player); final MovingConfig cc = MovingConfig.getConfig(player); - // TODO: Check if survivalfly is active at all for tp loc? Location target = null; final boolean sfCheck = shouldCheckSurvivalFly(player, data, cc); if (sfCheck) target = data.setBack; diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java index 074bfc2b..ea909b20 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java @@ -32,39 +32,9 @@ import fr.neatmonster.nocheatplus.compat.AlmostBoolean; * given. */ public class PlayerLocation { - - /** Type id of the block at the position. */ - private Integer typeId; - - /** Type id of the block below. */ - private Integer typeIdBelow; - - private Integer data; - - /** Is the player above stairs? */ - private Boolean aboveStairs; - - /** Is the player in lava? */ - private Boolean inLava; - - /** Is the player in water? */ - private Boolean inWater; - - /** Is the player is web? */ - private Boolean inWeb; - - /** Is the player on the ground? */ - private Boolean onGround; - - /** Is the player on ice? */ - private Boolean onIce; - - /** Is the player on ladder? */ - private Boolean onClimbable; - - /** Simple test if the exact position is passable. */ - private Boolean passable; - + + // Simple members // + /** Y parameter for growing the bounding box with the isOnGround check. */ private double yOnGround = 0.001; @@ -80,20 +50,55 @@ public class PlayerLocation { /** Bounding box of the player. */ private double minX, maxX, minY, maxY, minZ, maxZ; - - // Members that need cleanup // - - /** The player ! */ - private Player player; - /** Bukkit world. */ - private World world; + // Object members (reset to null) // - /** Optional block property cache. */ - private BlockCache blockCache; + /** Type id of the block at the position. */ + private Integer typeId = null; + + /** Type id of the block below. */ + private Integer typeIdBelow = null; + + /** Data value of the block this position is on. */ + private Integer data = null; + + /** Is the player above stairs? */ + private Boolean aboveStairs = null; + + /** Is the player in lava? */ + private Boolean inLava = null; + + /** Is the player in water? */ + private Boolean inWater = null; + + /** Is the player is web? */ + private Boolean inWeb = null; + + /** Is the player on the ground? */ + private Boolean onGround = null; + + /** Is the player on ice? */ + private Boolean onIce = null; + + /** Is the player on ladder? */ + private Boolean onClimbable = null; + + /** Simple test if the exact position is passable. */ + private Boolean passable = null; /** All block flags collected for maximum used bounds. */ - private Long blockFlags; + private Long blockFlags = null; + + // "Heavy" members (should be reset to null or cleaned up at some point) // + + /** The player ! */ + private Player player = null; + + /** Bukkit world. */ + private World world = null; + + /** Optional block property cache. */ + private BlockCache blockCache = null; public PlayerLocation(final BlockCache blockCache){