Static Abuse Removal - Various Chunklet classes

This commit is contained in:
nossr50 2019-09-25 13:48:37 -07:00
parent f52144fb3e
commit e1656423c1
4 changed files with 23 additions and 9 deletions

View File

@ -1,7 +1,15 @@
package com.gmail.nossr50.util.blockmeta; //package com.gmail.nossr50.util.blockmeta;
//
public class ChunkletManagerFactory { //import com.gmail.nossr50.mcMMO;
public static ChunkletManager getChunkletManager() { //
return new HashChunkletManager(); //public class ChunkletManagerFactory {
} // private final mcMMO pluginRef;
} //
// public ChunkletManagerFactory(mcMMO pluginRef) {
// this.pluginRef = pluginRef;
// }
//
// public ChunkletManager getChunkletManager() {
// return new HashChunkletManager(pluginRef);
// }
//}

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.util.blockmeta; package com.gmail.nossr50.util.blockmeta;
import com.gmail.nossr50.mcMMO;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -7,8 +8,13 @@ import java.io.*;
import java.util.HashMap; import java.util.HashMap;
public class HashChunkletManager implements ChunkletManager { public class HashChunkletManager implements ChunkletManager {
private final mcMMO pluginRef;
public HashMap<String, ChunkletStore> store = new HashMap<>(); public HashMap<String, ChunkletStore> store = new HashMap<>();
public HashChunkletManager(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public void loadChunklet(int cx, int cy, int cz, World world) { public void loadChunklet(int cx, int cy, int cz, World world) {
File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); File dataDir = new File(world.getWorldFolder(), "mcmmo_data");

View File

@ -55,7 +55,7 @@ public class BlockStoreConversionMain implements Runnable {
for (int i = 0; (i < ChunkConversionOptions.getConversionRate()) && (i < this.xDirs.length); i++) { for (int i = 0; (i < ChunkConversionOptions.getConversionRate()) && (i < this.xDirs.length); i++) {
if (this.converters[i] == null) { if (this.converters[i] == null) {
this.converters[i] = new BlockStoreConversionXDirectory(); this.converters[i] = new BlockStoreConversionXDirectory(pluginRef);
} }
this.converters[i].start(this.world, this.xDirs[i]); this.converters[i].start(this.world, this.xDirs[i]);

View File

@ -33,7 +33,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
public void start(org.bukkit.World world, File xDir, File dataDir) { public void start(org.bukkit.World world, File xDir, File dataDir) {
this.world = world; this.world = world;
this.scheduler = pluginRef.getServer().getScheduler(); this.scheduler = pluginRef.getServer().getScheduler();
this.manager = new HashChunkletManager(); this.manager = new HashChunkletManager(pluginRef);
this.newManager = (HashChunkManager) pluginRef.getPlaceStore(); this.newManager = (HashChunkManager) pluginRef.getPlaceStore();
this.dataDir = dataDir; this.dataDir = dataDir;
this.xDir = xDir; this.xDir = xDir;