mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 22:26:46 +01:00
Remove static abuse - Chunklet stuff
This commit is contained in:
parent
ec4fbe678e
commit
bde66ee4e1
@ -87,6 +87,7 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
/* Not-Managers but my naming scheme sucks */
|
||||
private DatabaseManagerFactory databaseManagerFactory;
|
||||
private ChunkManagerFactory chunkManagerFactory;
|
||||
private CommandTools commandTools;
|
||||
private SkillTools skillTools; //TODO: Remove once a new skill system is in place
|
||||
private BlockTools blockTools;
|
||||
@ -200,7 +201,9 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
nbtManager = new NBTManager(this);
|
||||
|
||||
placeStore = ChunkManagerFactory.getChunkManager(); // Get our ChunkletManager
|
||||
//Init Chunk Manager Factory
|
||||
chunkManagerFactory = new ChunkManagerFactory(this);
|
||||
placeStore = chunkManagerFactory.getChunkManager(); // Get our ChunkletManager
|
||||
|
||||
if (getConfigManager().getConfigParty().getPTP().isPtpWorldBasedPermissions()) {
|
||||
getPermissionTools().generateWorldTeleportPermissions();
|
||||
|
@ -1,7 +1,15 @@
|
||||
package com.gmail.nossr50.util.blockmeta.chunkmeta;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public class ChunkManagerFactory {
|
||||
public static ChunkManager getChunkManager() {
|
||||
return new HashChunkManager();
|
||||
private final mcMMO pluginRef;
|
||||
|
||||
public ChunkManagerFactory(mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
}
|
||||
|
||||
public ChunkManager getChunkManager() {
|
||||
return new HashChunkManager(pluginRef);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.util.blockmeta.chunkmeta;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.blockmeta.conversion.BlockStoreConversionZDirectory;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
@ -14,6 +15,11 @@ public class HashChunkManager implements ChunkManager {
|
||||
public ArrayList<BlockStoreConversionZDirectory> converters = new ArrayList<>();
|
||||
private HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>> regionFiles = new HashMap<>();
|
||||
private HashMap<UUID, Boolean> oldData = new HashMap<>();
|
||||
private final mcMMO pluginRef;
|
||||
|
||||
public HashChunkManager(mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void closeAll() {
|
||||
@ -438,7 +444,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
if (!conversionSet) {
|
||||
BlockStoreConversionZDirectory converter = new BlockStoreConversionZDirectory();
|
||||
BlockStoreConversionZDirectory converter = new BlockStoreConversionZDirectory(pluginRef);
|
||||
converter.start(world, cxDir, czDir);
|
||||
converters.add(converter);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.gmail.nossr50.util.blockmeta.conversion;
|
||||
|
||||
import com.gmail.nossr50.core.ChunkConversionOptions;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import java.io.File;
|
||||
@ -12,8 +13,10 @@ public class BlockStoreConversionMain implements Runnable {
|
||||
BlockStoreConversionXDirectory[] converters;
|
||||
private int taskID;
|
||||
private org.bukkit.World world;
|
||||
private final mcMMO pluginRef;
|
||||
|
||||
public BlockStoreConversionMain(org.bukkit.World world) {
|
||||
public BlockStoreConversionMain(mcMMO pluginRef, org.bukkit.World world) {
|
||||
this.pluginRef = pluginRef;
|
||||
this.taskID = -1;
|
||||
this.world = world;
|
||||
this.scheduler = pluginRef.getServer().getScheduler();
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.gmail.nossr50.util.blockmeta.conversion;
|
||||
|
||||
import com.gmail.nossr50.core.ChunkConversionOptions;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import java.io.File;
|
||||
@ -12,8 +13,10 @@ public class BlockStoreConversionXDirectory implements Runnable {
|
||||
BlockStoreConversionZDirectory[] converters;
|
||||
private int taskID;
|
||||
private org.bukkit.World world;
|
||||
private final mcMMO pluginRef;
|
||||
|
||||
public BlockStoreConversionXDirectory() {
|
||||
public BlockStoreConversionXDirectory(mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
this.taskID = -1;
|
||||
}
|
||||
|
||||
@ -53,7 +56,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
|
||||
|
||||
for (int i = 0; (i < ChunkConversionOptions.getConversionRate()) && (i < this.zDirs.length); i++) {
|
||||
if (this.converters[i] == null) {
|
||||
this.converters[i] = new BlockStoreConversionZDirectory();
|
||||
this.converters[i] = new BlockStoreConversionZDirectory(pluginRef);
|
||||
}
|
||||
|
||||
this.converters[i].start(this.world, this.dataDir, this.zDirs[i]);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.util.blockmeta.conversion;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.blockmeta.ChunkletStore;
|
||||
import com.gmail.nossr50.util.blockmeta.HashChunkletManager;
|
||||
import com.gmail.nossr50.util.blockmeta.PrimitiveChunkletStore;
|
||||
@ -22,8 +23,10 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
private PrimitiveChunkletStore primitiveChunklet = null;
|
||||
private PrimitiveExChunkletStore primitiveExChunklet = null;
|
||||
private PrimitiveChunkStore currentChunk;
|
||||
private final mcMMO pluginRef;
|
||||
|
||||
public BlockStoreConversionZDirectory() {
|
||||
public BlockStoreConversionZDirectory(mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
this.taskID = -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user