New factories means more jobs for a better economy

This commit is contained in:
NuclearW 2012-05-15 01:43:34 -04:00
parent bcee6abb65
commit 3032572f18
4 changed files with 22 additions and 3 deletions

View File

@ -15,7 +15,7 @@ import com.gmail.nossr50.util.Leaderboard;
import com.gmail.nossr50.util.Metrics; import com.gmail.nossr50.util.Metrics;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.blockmeta.ChunkletManager; import com.gmail.nossr50.util.blockmeta.ChunkletManager;
import com.gmail.nossr50.util.blockmeta.HashChunkletManager; import com.gmail.nossr50.util.blockmeta.ChunkletManagerFactory;
import com.gmail.nossr50.listeners.BlockListener; import com.gmail.nossr50.listeners.BlockListener;
import com.gmail.nossr50.listeners.EntityListener; import com.gmail.nossr50.listeners.EntityListener;
import com.gmail.nossr50.listeners.HardcoreListener; import com.gmail.nossr50.listeners.HardcoreListener;
@ -54,7 +54,7 @@ public class mcMMO extends JavaPlugin {
public static Database database; public static Database database;
public static mcMMO p; public static mcMMO p;
public static ChunkletManager placeStore = new HashChunkletManager(); public static ChunkletManager placeStore;
/* Jar Stuff */ /* Jar Stuff */
public File mcmmo; public File mcmmo;
@ -132,6 +132,9 @@ public class mcMMO extends JavaPlugin {
System.out.println("Failed to submit stats."); System.out.println("Failed to submit stats.");
} }
} }
// Get our ChunkletManager
placeStore = ChunkletManagerFactory.getChunkletManager();
} }
public void setupFilePaths() { public void setupFilePaths() {

View File

@ -0,0 +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();
}
}

View File

@ -0,0 +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();
}
}

View File

@ -132,7 +132,7 @@ public class HashChunkletManager implements ChunkletManager {
ChunkletStore cStore; ChunkletStore cStore;
if(!store.containsKey(world.getName() + "," + cx + "," + cz + "," + cy)) { if(!store.containsKey(world.getName() + "," + cx + "," + cz + "," + cy)) {
cStore = new PrimitiveChunkletStore(); cStore = ChunkletStoreFactory.getChunkletStore();
store.put(world.getName() + "," + cx + "," + cz + "," + cy, cStore); store.put(world.getName() + "," + cx + "," + cz + "," + cy, cStore);
} }