From db59f2487337c9966ea3554ff76ea3a08ca1945a Mon Sep 17 00:00:00 2001 From: NuclearW Date: Thu, 17 May 2012 03:57:16 -0400 Subject: [PATCH] Cleanup --- .../util/blockmeta/ChunkletManager.java | 20 +++++------ .../blockmeta/ChunkletManagerFactory.java | 8 ++--- .../nossr50/util/blockmeta/ChunkletStore.java | 6 ++-- .../util/blockmeta/ChunkletStoreFactory.java | 8 ++--- .../util/blockmeta/HashChunkletManager.java | 34 +++++++++---------- 5 files changed, 39 insertions(+), 37 deletions(-) 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 267af41ac..394ef6ba9 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManager.java @@ -6,7 +6,7 @@ import org.bukkit.block.Block; public interface ChunkletManager { /** * Informs the ChunkletManager a chunk is loaded, it should load appropriate data - * + * * @param cx Chunk X coordiate that is loaded * @param cz Chunk Z coordiate that is loaded * @param world World that the chunk was loaded in @@ -15,7 +15,7 @@ public interface ChunkletManager { /** * Informs the ChunkletManager a chunk is unloaded, it should unload and save appropriate data - * + * * @param cx Chunk X coordiate that is unloaded * @param cz Chunk Z coordiate that is unloaded * @param world World that the chunk was unloaded in @@ -24,14 +24,14 @@ public interface ChunkletManager { /** * Save all ChunkletStores related to the given world - * + * * @param world World to save */ public void saveWorld(World world); /** * Unload all ChunkletStores from memory related to the given world after saving them - * + * * @param world World to unload */ public void unloadWorld(World world); @@ -48,7 +48,7 @@ public interface ChunkletManager { /** * Check to see if a given location is set to true - * + * * @param x X coordinate to check * @param y Y coordinate to check * @param z Z coordinate to check @@ -59,7 +59,7 @@ public interface ChunkletManager { /** * Check to see if a given block location is set to true - * + * * @param block Block location to check * @return true if the given block location is set to true, false if otherwise */ @@ -67,7 +67,7 @@ public interface ChunkletManager { /** * Set a given location to true, should create stores as necessary if the location does not exist - * + * * @param x X coordinate to set * @param y Y coordinate to set * @param z Z coordinate to set @@ -77,14 +77,14 @@ public interface ChunkletManager { /** * Set a given block location to true, should create stores as necessary if the location does not exist - * + * * @param block Block location to set */ public void setTrue(Block block); /** * Set a given location to false, should not create stores if one does not exist for the given location - * + * * @param x X coordinate to set * @param y Y coordinate to set * @param z Z coordinate to set @@ -94,7 +94,7 @@ public interface ChunkletManager { /** * Set a given block location to false, should not create stores if one does not exist for the given location - * + * * @param block Block location to set */ public void setFalse(Block block); diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManagerFactory.java b/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManagerFactory.java index 2910f801c..f3351831c 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManagerFactory.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManagerFactory.java @@ -1,8 +1,8 @@ package com.gmail.nossr50.util.blockmeta; public class ChunkletManagerFactory { - public static ChunkletManager getChunkletManager() { - // TODO: Add in loading from config what type of manager we want. - return new HashChunkletManager(); - } + public static ChunkletManager getChunkletManager() { + // TODO: Add in loading from config what type of manager we want. + return new HashChunkletManager(); + } } diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletStore.java b/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletStore.java index fb8b0536a..81b2a8ef7 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletStore.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletStore.java @@ -4,6 +4,8 @@ import java.io.Serializable; public interface ChunkletStore extends Serializable { /** + * Checks the value at the given coordinates + * * @param x x coordinate in current chunklet * @param y y coordinate in current chunklet * @param z z coordinate in current chunklet @@ -13,7 +15,7 @@ public interface ChunkletStore extends Serializable { /** * Set the value to true at the given coordinates - * + * * @param x x coordinate in current chunklet * @param y y coordinate in current chunklet * @param z z coordinate in current chunklet @@ -22,7 +24,7 @@ public interface ChunkletStore extends Serializable { /** * Set the value to false at the given coordinates - * + * * @param x x coordinate in current chunklet * @param y y coordinate in current chunklet * @param z z coordinate in current chunklet diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletStoreFactory.java b/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletStoreFactory.java index aae2d3ff1..4d2f70945 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletStoreFactory.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletStoreFactory.java @@ -1,8 +1,8 @@ package com.gmail.nossr50.util.blockmeta; public class ChunkletStoreFactory { - protected static ChunkletStore getChunkletStore() { - // TODO: Add in loading from config what type of store we want. - return new PrimitiveChunkletStore(); - } + protected static ChunkletStore getChunkletStore() { + // TODO: Add in loading from config what type of store we want. + return new PrimitiveChunkletStore(); + } } 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 900b9df99..f36cdbba1 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java @@ -29,7 +29,7 @@ public class HashChunkletManager implements ChunkletManager { } else { ChunkletStore in = deserializeChunkletStore(yFile); if(in != null) { - store.put(world.getName() + "," + cx + "," + cz + "," + y, in); + store.put(world.getName() + "," + cx + "," + cz + "," + y, in); } } } @@ -78,29 +78,29 @@ public class HashChunkletManager implements ChunkletManager { } public void unloadWorld(World world) { - saveWorld(world); + saveWorld(world); String worldName = world.getName(); for(String key : store.keySet()) { - String tempWorldName = key.split(",")[0]; - if(tempWorldName.equals(worldName)) { - store.remove(key); - } + String tempWorldName = key.split(",")[0]; + if(tempWorldName.equals(worldName)) { + store.remove(key); + } } } public void saveAll() { - for(World world : Bukkit.getWorlds()) { - saveWorld(world); - } + for(World world : Bukkit.getWorlds()) { + saveWorld(world); + } } public void unloadAll() { - saveAll(); - for(World world : Bukkit.getWorlds()) { - unloadWorld(world); - } + saveAll(); + for(World world : Bukkit.getWorlds()) { + unloadWorld(world); + } } public boolean isTrue(int x, int y, int z, World world) { @@ -155,7 +155,7 @@ public class HashChunkletManager implements ChunkletManager { ChunkletStore cStore; if(!store.containsKey(world.getName() + "," + cx + "," + cz + "," + cy)) { - return; // No need to make a store for something we will be setting to false + return; // No need to make a store for something we will be setting to false } cStore = store.get(world.getName() + "," + cx + "," + cz + "," + cy); @@ -192,7 +192,7 @@ public class HashChunkletManager implements ChunkletManager { * @param location Where on the disk to put it */ private void serializeChunkletStore(ChunkletStore cStore, File location) { - try { + try { FileOutputStream fileOut = new FileOutputStream(location); ObjectOutputStream objOut = new ObjectOutputStream(fileOut); objOut.writeObject(cStore); @@ -219,8 +219,8 @@ public class HashChunkletManager implements ChunkletManager { } catch (IOException ex) { ex.printStackTrace(); } catch (ClassNotFoundException ex) { - ex.printStackTrace(); - } + ex.printStackTrace(); + } return storeIn; }