From 4407ed0a6f2a27e5e776f490e1f90f117d40a0cd Mon Sep 17 00:00:00 2001 From: NuclearW Date: Sat, 16 Jun 2012 21:43:04 -0400 Subject: [PATCH] Fixed bug with Chunklets not being reloaded on /reload --- Changelog.txt | 1 + src/main/java/com/gmail/nossr50/mcMMO.java | 5 +++++ .../com/gmail/nossr50/util/blockmeta/ChunkletManager.java | 7 +++++++ .../gmail/nossr50/util/blockmeta/HashChunkletManager.java | 8 ++++++++ .../gmail/nossr50/util/blockmeta/NullChunkletManager.java | 5 +++++ 5 files changed, 26 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index b72b2fc96..0c1034458 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -29,6 +29,7 @@ Version 1.3.09 = Fixed bug with Tree Feller changing durability before checking for axe splintering = Fixed bug with Repair Mastery permission due to typo = Fixed bug with repairing items that use metadata + = Fixed bug with Chunklets not being reloaded on /reload ! API methods can now only be used in a static way ! Arrows shot from a bow having the Infitity enchantment can no longer be retrieved ! Changed Spout settings to be in their own config file (spout.yml) diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 3955b236a..2d616757e 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -9,6 +9,7 @@ import java.util.List; import net.shatteredlands.shatt.backup.ZipLibrary; import org.bukkit.OfflinePlayer; +import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginManager; @@ -223,6 +224,10 @@ public class mcMMO extends JavaPlugin { // Get our ChunkletManager placeStore = ChunkletManagerFactory.getChunkletManager(); + + for (World world : getServer().getWorlds()) { + placeStore.loadWorld(world); + } } /** diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManager.java index 394ef6ba9..65a34926a 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManager.java @@ -36,6 +36,13 @@ public interface ChunkletManager { */ public void unloadWorld(World world); + /** + * Load all ChunkletStores from all loaded chunks from this world into memory + * + * @param world World to load + */ + public void loadWorld(World world); + /** * Save all ChunkletStores */ diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java index 00935f091..b100545b7 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java @@ -11,6 +11,7 @@ import java.io.StreamCorruptedException; import java.util.HashMap; import org.bukkit.Bukkit; +import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.block.Block; @@ -92,6 +93,13 @@ public class HashChunkletManager implements ChunkletManager { } } + @Override + public void loadWorld(World world) { + for(Chunk chunk : world.getLoadedChunks()) { + this.chunkLoaded(chunk.getX(), chunk.getZ(), world); + } + } + @Override public void saveAll() { for(World world : Bukkit.getWorlds()) { diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/NullChunkletManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/NullChunkletManager.java index 15e391a45..4934bbf18 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/NullChunkletManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/NullChunkletManager.java @@ -29,6 +29,11 @@ public class NullChunkletManager implements ChunkletManager { return; } + @Override + public void loadWorld(World world) { + return; + } + @Override public void saveAll() { return;