From abe22f8104c3ba46b7632e29f824a107a0eb5044 Mon Sep 17 00:00:00 2001 From: asofold Date: Wed, 30 Jan 2013 03:22:58 +0100 Subject: [PATCH] Cleanup BlockProperties on disable. --- .../nocheatplus/utilities/BlockProperties.java | 11 +++++++++++ .../java/fr/neatmonster/nocheatplus/NoCheatPlus.java | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java b/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java index 70e48a6a..db3fdadc 100644 --- a/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java +++ b/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java @@ -1465,4 +1465,15 @@ public class BlockProperties { public static void setBreakPenaltyOffGround(float breakPenaltyOffGround) { BlockProperties.breakPenaltyOffGround = breakPenaltyOffGround; } + + /** + * Cleanup. Call init() to re-initialize. + */ + public static void cleanup() { + pLoc.cleanup(); + pLoc = null; + blockCache.cleanup(); + blockCache = null; + // TODO: might empty mappings... + } } diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/NoCheatPlus.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/NoCheatPlus.java index 8b92959e..eb1838cd 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/NoCheatPlus.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/NoCheatPlus.java @@ -392,6 +392,10 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI { removeComponent(obj); } + // Cleanup BlockProperties. + if (verbose) LogUtil.logInfo("[NoCheatPlus] Cleanup BlockProperties..."); + BlockProperties.cleanup(); + if (verbose) LogUtil.logInfo("[NoCheatPlus] Cleanup some mappings..."); // Remove listeners. listeners.clear();