mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-30 04:34:43 +02:00
My OCD made me do it.
This commit is contained in:
@ -6,7 +6,7 @@ public class ChunkletManagerFactory {
|
||||
public static ChunkletManager getChunkletManager() {
|
||||
HiddenConfig hConfig = HiddenConfig.getInstance();
|
||||
|
||||
if(hConfig.getChunkletsEnabled()) {
|
||||
if (hConfig.getChunkletsEnabled()) {
|
||||
return new HashChunkletManager();
|
||||
}
|
||||
|
||||
|
@ -25,14 +25,14 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
public void loadChunklet(int cx, int cy, int cz, World world) {
|
||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
||||
File cxDir = new File(dataDir, "" + cx);
|
||||
if(!cxDir.exists()) return;
|
||||
if (!cxDir.exists()) return;
|
||||
File czDir = new File(cxDir, "" + cz);
|
||||
if(!czDir.exists()) return;
|
||||
if (!czDir.exists()) return;
|
||||
File yFile = new File(czDir, "" + cy);
|
||||
if(!yFile.exists()) return;
|
||||
if (!yFile.exists()) return;
|
||||
|
||||
ChunkletStore in = deserializeChunkletStore(yFile);
|
||||
if(in != null) {
|
||||
if (in != null) {
|
||||
store.put(world.getName() + "," + cx + "," + cz + "," + cy, in);
|
||||
}
|
||||
}
|
||||
@ -40,11 +40,11 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
@Override
|
||||
public void unloadChunklet(int cx, int cy, int cz, World world) {
|
||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
||||
if(store.containsKey(world.getName() + "," + cx + "," + cz + "," + cy)) {
|
||||
if (store.containsKey(world.getName() + "," + cx + "," + cz + "," + cy)) {
|
||||
File cxDir = new File(dataDir, "" + cx);
|
||||
if(!cxDir.exists()) cxDir.mkdir();
|
||||
if (!cxDir.exists()) cxDir.mkdir();
|
||||
File czDir = new File(cxDir, "" + cz);
|
||||
if(!czDir.exists()) czDir.mkdir();
|
||||
if (!czDir.exists()) czDir.mkdir();
|
||||
File yFile = new File(czDir, "" + cy);
|
||||
|
||||
ChunkletStore out = store.get(world.getName() + "," + cx + "," + cz + "," + cy);
|
||||
@ -57,18 +57,18 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
public void loadChunk(int cx, int cz, World world) {
|
||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
||||
File cxDir = new File(dataDir, "" + cx);
|
||||
if(!cxDir.exists()) return;
|
||||
if (!cxDir.exists()) return;
|
||||
File czDir = new File(cxDir, "" + cz);
|
||||
if(!czDir.exists()) return;
|
||||
if (!czDir.exists()) return;
|
||||
|
||||
for(int y = 0; y < 4; y++) {
|
||||
File yFile = new File(czDir, "" + y);
|
||||
if(!yFile.exists()) {
|
||||
if (!yFile.exists()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ChunkletStore in = deserializeChunkletStore(yFile);
|
||||
if(in != null) {
|
||||
if (in != null) {
|
||||
store.put(world.getName() + "," + cx + "," + cz + "," + y, in);
|
||||
}
|
||||
}
|
||||
@ -79,11 +79,11 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
||||
|
||||
for(int y = 0; y < 4; y++) {
|
||||
if(store.containsKey(world.getName() + "," + cx + "," + cz + "," + y)) {
|
||||
if (store.containsKey(world.getName() + "," + cx + "," + cz + "," + y)) {
|
||||
File cxDir = new File(dataDir, "" + cx);
|
||||
if(!cxDir.exists()) cxDir.mkdir();
|
||||
if (!cxDir.exists()) cxDir.mkdir();
|
||||
File czDir = new File(cxDir, "" + cz);
|
||||
if(!czDir.exists()) czDir.mkdir();
|
||||
if (!czDir.exists()) czDir.mkdir();
|
||||
File yFile = new File(czDir, "" + y);
|
||||
|
||||
ChunkletStore out = store.get(world.getName() + "," + cx + "," + cz + "," + y);
|
||||
@ -107,16 +107,16 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
public void saveWorld(World world) {
|
||||
String worldName = world.getName();
|
||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
||||
if(!dataDir.exists())
|
||||
if (!dataDir.exists())
|
||||
dataDir.mkdirs();
|
||||
|
||||
for(String key : store.keySet()) {
|
||||
String[] info = key.split(",");
|
||||
if(worldName.equals(info[0])) {
|
||||
if (worldName.equals(info[0])) {
|
||||
File cxDir = new File(dataDir, "" + info[1]);
|
||||
if(!cxDir.exists()) cxDir.mkdir();
|
||||
if (!cxDir.exists()) cxDir.mkdir();
|
||||
File czDir = new File(cxDir, "" + info[2]);
|
||||
if(!czDir.exists()) czDir.mkdir();
|
||||
if (!czDir.exists()) czDir.mkdir();
|
||||
|
||||
File yFile = new File(czDir, "" + info[3]);
|
||||
serializeChunkletStore(store.get(key), yFile);
|
||||
@ -132,7 +132,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
|
||||
for(String key : store.keySet()) {
|
||||
String tempWorldName = key.split(",")[0];
|
||||
if(tempWorldName.equals(worldName)) {
|
||||
if (tempWorldName.equals(worldName)) {
|
||||
store.remove(key);
|
||||
return;
|
||||
}
|
||||
@ -254,21 +254,21 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
@Override
|
||||
public void cleanUp() {
|
||||
for(String key : store.keySet()) {
|
||||
if(store.get(key).isEmpty()) {
|
||||
if (store.get(key).isEmpty()) {
|
||||
String[] info = key.split(",");
|
||||
File dataDir = new File(Bukkit.getWorld(info[0]).getWorldFolder(), "mcmmo_data");
|
||||
|
||||
File cxDir = new File(dataDir, "" + info[1]);
|
||||
if(!cxDir.exists()) continue;
|
||||
if (!cxDir.exists()) continue;
|
||||
File czDir = new File(cxDir, "" + info[2]);
|
||||
if(!czDir.exists()) continue;
|
||||
if (!czDir.exists()) continue;
|
||||
|
||||
File yFile = new File(czDir, "" + info[3]);
|
||||
yFile.delete();
|
||||
|
||||
//Delete empty directories
|
||||
if(czDir.list().length == 0) czDir.delete();
|
||||
if(cxDir.list().length == 0) cxDir.delete();
|
||||
if (czDir.list().length == 0) czDir.delete();
|
||||
if (cxDir.list().length == 0) cxDir.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +282,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
ObjectOutputStream objOut = null;
|
||||
|
||||
try {
|
||||
if(!location.exists())
|
||||
if (!location.exists())
|
||||
location.createNewFile();
|
||||
fileOut = new FileOutputStream(location);
|
||||
objOut = new ObjectOutputStream(fileOut);
|
||||
@ -374,9 +374,9 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
// IMPORTANT! If ChunkletStoreFactory is going to be returning something other than PrimitiveEx we need to remove this, as it will be breaking time for old maps
|
||||
|
||||
/*
|
||||
if(!(storeIn instanceof PrimitiveExChunkletStore)) {
|
||||
if (!(storeIn instanceof PrimitiveExChunkletStore)) {
|
||||
ChunkletStore tempStore = ChunkletStoreFactory.getChunkletStore();
|
||||
if(storeIn != null) {
|
||||
if (storeIn != null) {
|
||||
tempStore.copyFrom(storeIn);
|
||||
}
|
||||
storeIn = tempStore;
|
||||
|
@ -26,7 +26,7 @@ public class PrimitiveChunkletStore implements ChunkletStore {
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
for(int y = 0; y < 64; y++) {
|
||||
if(store[x][z][y]) return false;
|
||||
if (store[x][z][y]) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
for(int y = 0; y < 64; y++) {
|
||||
if(store[x][z][y]) return false;
|
||||
if (store[x][z][y]) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -57,7 +57,7 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
for(int y = 0; y < 64; y++) {
|
||||
if(store[x][z][y]) {
|
||||
if (store[x][z][y]) {
|
||||
byte[] temp = constructColumn(x, z);
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
@ -81,7 +81,7 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
|
||||
byte[] temp = new byte[9];
|
||||
|
||||
// Could probably reorganize this loop to print nasty things if it does not equal 9 or -1
|
||||
while(in.read(temp, 0, 9) == 9) {
|
||||
while (in.read(temp, 0, 9) == 9) {
|
||||
int x = addressByteX(temp[0]);
|
||||
int z = addressByteZ(temp[0]);
|
||||
boolean[] yColumn = new boolean[64];
|
||||
@ -127,13 +127,13 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
|
||||
|
||||
column[0] = makeAddressByte(x, z);
|
||||
|
||||
for (int i = 0; i < 8; i++){
|
||||
for (int i = 0; i < 8; i++) {
|
||||
byte yCompressed = 0x0;
|
||||
int subColumnIndex = 8 * i;
|
||||
int subColumnEnd = subColumnIndex + 8;
|
||||
|
||||
for(int y = subColumnIndex; y < subColumnEnd; y++) {
|
||||
if(store[x][z][y]) {
|
||||
if (store[x][z][y]) {
|
||||
yCompressed |= 1 << (y % 8);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ public class ChunkManagerFactory {
|
||||
public static ChunkManager getChunkManager() {
|
||||
HiddenConfig hConfig = HiddenConfig.getInstance();
|
||||
|
||||
if(hConfig.getChunkletsEnabled()) {
|
||||
if (hConfig.getChunkletsEnabled()) {
|
||||
return new HashChunkManager();
|
||||
}
|
||||
|
||||
|
@ -143,19 +143,19 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void loadChunk(int cx, int cz, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
if(store.containsKey(world.getName() + "," + cx + "," + cz))
|
||||
if (store.containsKey(world.getName() + "," + cx + "," + cz))
|
||||
return;
|
||||
|
||||
ChunkStore in = null;
|
||||
|
||||
UUID key = world.getUID();
|
||||
if(!this.oldData.containsKey(key))
|
||||
if (!this.oldData.containsKey(key))
|
||||
this.oldData.put(key, (new File(world.getWorldFolder(), "mcmmo_data")).exists());
|
||||
|
||||
if(this.oldData.containsKey(key) && oldData.get(key))
|
||||
if (this.oldData.containsKey(key) && oldData.get(key))
|
||||
convertChunk(new File(world.getWorldFolder(), "mcmmo_data"), cx, cz, world, true);
|
||||
|
||||
try {
|
||||
@ -163,20 +163,20 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
catch(Exception e) {}
|
||||
|
||||
if(in != null) {
|
||||
if (in != null) {
|
||||
store.put(world.getName() + "," + cx + "," + cz, in);
|
||||
|
||||
List<UUID> mobs = in.getSpawnedMobs();
|
||||
List<UUID> pets = in.getSpawnedPets();
|
||||
|
||||
if(mobs.isEmpty() && pets.isEmpty())
|
||||
if (mobs.isEmpty() && pets.isEmpty())
|
||||
return;
|
||||
|
||||
for(LivingEntity entity : world.getLivingEntities()) {
|
||||
if(mobs.contains(entity.getUniqueId()))
|
||||
if (mobs.contains(entity.getUniqueId()))
|
||||
addSpawnedMob(entity);
|
||||
|
||||
if(pets.contains(entity.getUniqueId()))
|
||||
if (pets.contains(entity.getUniqueId()))
|
||||
addSpawnedPet(entity);
|
||||
}
|
||||
|
||||
@ -189,24 +189,24 @@ public class HashChunkManager implements ChunkManager {
|
||||
public synchronized void unloadChunk(int cx, int cz, World world) {
|
||||
saveChunk(cx, cz, world);
|
||||
|
||||
if(store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
||||
if (store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
||||
store.remove(world.getName() + "," + cx + "," + cz);
|
||||
|
||||
for(Entity entity : spawnedMobs) {
|
||||
if(!isEntityInChunk(entity, cx, cz, world))
|
||||
if (!isEntityInChunk(entity, cx, cz, world))
|
||||
continue;
|
||||
|
||||
mobsToRemove.add(entity);
|
||||
}
|
||||
|
||||
for(Entity entity : spawnedPets) {
|
||||
if(!isEntityInChunk(entity, cx, cz, world))
|
||||
if (!isEntityInChunk(entity, cx, cz, world))
|
||||
continue;
|
||||
|
||||
mobsToRemove.add(entity);
|
||||
}
|
||||
|
||||
if(safeToRemoveMobs) {
|
||||
if (safeToRemoveMobs) {
|
||||
spawnedMobs.remove(mobsToRemove);
|
||||
spawnedPets.remove(mobsToRemove);
|
||||
mobsToRemove.clear();
|
||||
@ -216,14 +216,14 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void saveChunk(int cx, int cz, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
boolean unloaded = false;
|
||||
if(!store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
||||
if (!store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
||||
List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs);
|
||||
for(Entity entity : tempSpawnedMobs) {
|
||||
if(!isEntityInChunk(entity, cx, cz, world))
|
||||
if (!isEntityInChunk(entity, cx, cz, world))
|
||||
continue;
|
||||
|
||||
loadChunk(cx, cz, world);
|
||||
@ -231,10 +231,10 @@ public class HashChunkManager implements ChunkManager {
|
||||
break;
|
||||
}
|
||||
|
||||
if(!unloaded) {
|
||||
if (!unloaded) {
|
||||
List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets);
|
||||
for(Entity entity : tempSpawnedPets) {
|
||||
if(!isEntityInChunk(entity, cx, cz, world))
|
||||
if (!isEntityInChunk(entity, cx, cz, world))
|
||||
continue;
|
||||
|
||||
loadChunk(cx, cz, world);
|
||||
@ -244,17 +244,17 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
}
|
||||
|
||||
if(!store.containsKey(world.getName() + "," + cx + "," + cz) && unloaded) {
|
||||
if (!store.containsKey(world.getName() + "," + cx + "," + cz) && unloaded) {
|
||||
ChunkStore cStore = ChunkStoreFactory.getChunkStore(world, cx, cz);
|
||||
store.put(world.getName() + "," + cx + "," + cz, cStore);
|
||||
}
|
||||
|
||||
if(store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
||||
if (store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
||||
ChunkStore out = store.get(world.getName() + "," + cx + "," + cz);
|
||||
|
||||
List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs);
|
||||
for(Entity entity : tempSpawnedMobs) {
|
||||
if(!isEntityInChunk(entity, cx, cz, world))
|
||||
if (!isEntityInChunk(entity, cx, cz, world))
|
||||
continue;
|
||||
|
||||
out.addSpawnedMob(entity.getUniqueId());
|
||||
@ -262,13 +262,13 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets);
|
||||
for(Entity entity : tempSpawnedPets) {
|
||||
if(!isEntityInChunk(entity, cx, cz, world))
|
||||
if (!isEntityInChunk(entity, cx, cz, world))
|
||||
continue;
|
||||
|
||||
out.addSpawnedPet(entity.getUniqueId());
|
||||
}
|
||||
|
||||
if(!out.isDirty())
|
||||
if (!out.isDirty())
|
||||
return;
|
||||
|
||||
writeChunkStore(world, cx, cz, out);
|
||||
@ -276,16 +276,16 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
private boolean isEntityInChunk(Entity entity, int cx, int cz, World world) {
|
||||
if(entity == null || world == null)
|
||||
if (entity == null || world == null)
|
||||
return false;
|
||||
|
||||
if(entity.getLocation().getChunk().getX() != cx)
|
||||
if (entity.getLocation().getChunk().getX() != cx)
|
||||
return false;
|
||||
|
||||
if(entity.getLocation().getChunk().getZ() != cz)
|
||||
if (entity.getLocation().getChunk().getZ() != cz)
|
||||
return false;
|
||||
|
||||
if(entity.getWorld() != world)
|
||||
if (entity.getWorld() != world)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -293,7 +293,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized boolean isChunkLoaded(int cx, int cz, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return false;
|
||||
|
||||
return store.containsKey(world.getName() + "," + cx + "," + cz);
|
||||
@ -304,7 +304,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void chunkUnloaded(int cx, int cz, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
ChunkletUnloader.addToList(cx, cz, world);
|
||||
@ -312,7 +312,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void saveWorld(World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
closeAll();
|
||||
@ -321,7 +321,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
List<String> keys = new ArrayList<String>(store.keySet());
|
||||
for(String key : keys) {
|
||||
String[] info = key.split(",");
|
||||
if(worldName.equals(info[0])) {
|
||||
if (worldName.equals(info[0])) {
|
||||
int cx = 0;
|
||||
int cz = 0;
|
||||
|
||||
@ -340,7 +340,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
for(Entity entity : tempSpawnedMobs) {
|
||||
World entityWorld = entity.getWorld();
|
||||
|
||||
if(world != entityWorld)
|
||||
if (world != entityWorld)
|
||||
continue;
|
||||
|
||||
int cx = entity.getLocation().getChunk().getX();
|
||||
@ -353,7 +353,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
for(Entity entity : tempSpawnedPets) {
|
||||
World entityWorld = entity.getWorld();
|
||||
|
||||
if(world != entityWorld)
|
||||
if (world != entityWorld)
|
||||
continue;
|
||||
|
||||
int cx = entity.getLocation().getChunk().getX();
|
||||
@ -365,7 +365,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void unloadWorld(World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
closeAll();
|
||||
@ -374,7 +374,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
List<String> keys = new ArrayList<String>(store.keySet());
|
||||
for(String key : keys) {
|
||||
String[] info = key.split(",");
|
||||
if(worldName.equals(info[0])) {
|
||||
if (worldName.equals(info[0])) {
|
||||
int cx = 0;
|
||||
int cz = 0;
|
||||
|
||||
@ -395,7 +395,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
for(Entity entity : tempSpawnedMobs) {
|
||||
World entityWorld = entity.getWorld();
|
||||
|
||||
if(world != entityWorld)
|
||||
if (world != entityWorld)
|
||||
continue;
|
||||
|
||||
int cx = entity.getLocation().getChunk().getX();
|
||||
@ -408,7 +408,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
for(Entity entity : tempSpawnedPets) {
|
||||
World entityWorld = entity.getWorld();
|
||||
|
||||
if(world != entityWorld)
|
||||
if (world != entityWorld)
|
||||
continue;
|
||||
|
||||
int cx = entity.getLocation().getChunk().getX();
|
||||
@ -447,7 +447,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized boolean isTrue(int x, int y, int z, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return false;
|
||||
|
||||
int cx = x / 16;
|
||||
@ -471,7 +471,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized boolean isTrue(Block block) {
|
||||
if(block == null)
|
||||
if (block == null)
|
||||
return false;
|
||||
|
||||
return isTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
|
||||
@ -479,7 +479,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void setTrue(int x, int y, int z, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
int cx = x / 16;
|
||||
@ -506,7 +506,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void setTrue(Block block) {
|
||||
if(block == null)
|
||||
if (block == null)
|
||||
return;
|
||||
|
||||
setTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
|
||||
@ -514,7 +514,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void setFalse(int x, int y, int z, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
int cx = x / 16;
|
||||
@ -540,7 +540,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void setFalse(Block block) {
|
||||
if(block == null)
|
||||
if (block == null)
|
||||
return;
|
||||
|
||||
setFalse(block.getX(), block.getY(), block.getZ(), block.getWorld());
|
||||
@ -554,21 +554,21 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
public synchronized void convertChunk(File dataDir, int cx, int cz, World world, boolean actually) {
|
||||
if(!actually)
|
||||
if (!actually)
|
||||
return;
|
||||
if(!dataDir.exists()) return;
|
||||
if (!dataDir.exists()) return;
|
||||
File cxDir = new File(dataDir, "" + cx);
|
||||
if(!cxDir.exists()) return;
|
||||
if (!cxDir.exists()) return;
|
||||
File czDir = new File(cxDir, "" + cz);
|
||||
if(!czDir.exists()) return;
|
||||
if (!czDir.exists()) return;
|
||||
|
||||
boolean conversionSet = false;
|
||||
|
||||
for(BlockStoreConversionZDirectory converter : this.converters) {
|
||||
if(converter == null)
|
||||
if (converter == null)
|
||||
continue;
|
||||
|
||||
if(converter.taskID >= 0)
|
||||
if (converter.taskID >= 0)
|
||||
continue;
|
||||
|
||||
converter.start(world, cxDir, czDir);
|
||||
@ -576,7 +576,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
break;
|
||||
}
|
||||
|
||||
if(!conversionSet) {
|
||||
if (!conversionSet) {
|
||||
BlockStoreConversionZDirectory converter = new BlockStoreConversionZDirectory();
|
||||
converter.start(world, cxDir, czDir);
|
||||
converters.add(converter);
|
||||
@ -592,22 +592,22 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
public void addSpawnedMob(Entity entity) {
|
||||
if(!isSpawnedMob(entity))
|
||||
if (!isSpawnedMob(entity))
|
||||
spawnedMobs.add(entity);
|
||||
}
|
||||
|
||||
public void addSpawnedPet(Entity entity) {
|
||||
if(!isSpawnedPet(entity))
|
||||
if (!isSpawnedPet(entity))
|
||||
spawnedPets.add(entity);
|
||||
}
|
||||
|
||||
public void removeSpawnedMob(Entity entity) {
|
||||
if(isSpawnedMob(entity))
|
||||
if (isSpawnedMob(entity))
|
||||
spawnedMobs.remove(entity);
|
||||
}
|
||||
|
||||
public void removeSpawnedPet(Entity entity) {
|
||||
if(isSpawnedPet(entity))
|
||||
if (isSpawnedPet(entity))
|
||||
spawnedPets.remove(entity);
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
for(int y = 0; y < this.worldHeight; y++) {
|
||||
if(store[x][z][y]) return false;
|
||||
if (store[x][z][y]) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -113,42 +113,42 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
}
|
||||
|
||||
public void addSpawnedMob(UUID id) {
|
||||
if(!isSpawnedMob(id)) {
|
||||
if (!isSpawnedMob(id)) {
|
||||
spawnedMobs.add(id);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void addSpawnedPet(UUID id) {
|
||||
if(!isSpawnedPet(id)) {
|
||||
if (!isSpawnedPet(id)) {
|
||||
spawnedPets.add(id);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void removeSpawnedMob(UUID id) {
|
||||
if(isSpawnedMob(id)) {
|
||||
if (isSpawnedMob(id)) {
|
||||
spawnedMobs.remove(id);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void removeSpawnedPet(UUID id) {
|
||||
if(isSpawnedPet(id)) {
|
||||
if (isSpawnedPet(id)) {
|
||||
spawnedPets.remove(id);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void clearSpawnedMobs() {
|
||||
if(!spawnedMobs.isEmpty()) {
|
||||
if (!spawnedMobs.isEmpty()) {
|
||||
spawnedMobs.clear();
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void clearSpawnedPets() {
|
||||
if(!spawnedPets.isEmpty()) {
|
||||
if (!spawnedPets.isEmpty()) {
|
||||
spawnedPets.clear();
|
||||
dirty = true;
|
||||
}
|
||||
@ -204,16 +204,16 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
store = (boolean[][][]) in.readObject();
|
||||
|
||||
if (fileVersionNumber < CURRENT_VERSION) {
|
||||
if(fileVersionNumber < 5)
|
||||
if (fileVersionNumber < 5)
|
||||
fixArray();
|
||||
if(fileVersionNumber < 6) {
|
||||
if (fileVersionNumber < 6) {
|
||||
spawnedMobs = new ArrayList<UUID>();
|
||||
spawnedPets = new ArrayList<UUID>();
|
||||
}
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
if(fileVersionNumber >= 6) {
|
||||
if (fileVersionNumber >= 6) {
|
||||
//What do we want to do about this? These casts are unchecked.
|
||||
spawnedMobs = (ArrayList<UUID>) in.readObject();
|
||||
spawnedPets = (ArrayList<UUID>) in.readObject();
|
||||
|
Reference in New Issue
Block a user