Use local settings for FaweQueue

This commit is contained in:
Jesse Boyd 2018-01-17 12:19:37 +11:00
parent 1186a00b47
commit 613f6bd5c0
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 11 additions and 12 deletions

View File

@ -72,13 +72,13 @@ public abstract class MappedFaweQueue<WORLD, CHUNK, CHUNKSECTIONS, SECTION> impl
public MappedFaweQueue(final String world) {
this.world = world;
map = Settings.IMP.PREVENT_CRASHES ? new WeakFaweQueueMap(this) : new DefaultFaweQueueMap(this);
map = getSettings().PREVENT_CRASHES ? new WeakFaweQueueMap(this) : new DefaultFaweQueueMap(this);
}
public MappedFaweQueue(final String world, IFaweQueueMap map) {
this.world = world;
if (map == null) {
map = Settings.IMP.PREVENT_CRASHES ? new WeakFaweQueueMap(this) : new DefaultFaweQueueMap(this);
map = getSettings().PREVENT_CRASHES ? new WeakFaweQueueMap(this) : new DefaultFaweQueueMap(this);
}
this.map = map;
}
@ -87,7 +87,7 @@ public abstract class MappedFaweQueue<WORLD, CHUNK, CHUNKSECTIONS, SECTION> impl
this.weWorld = world;
if (world != null) this.world = Fawe.imp().getWorldName(world);
if (map == null) {
map = Settings.IMP.PREVENT_CRASHES ? new WeakFaweQueueMap(this) : new DefaultFaweQueueMap(this);
map = getSettings().PREVENT_CRASHES ? new WeakFaweQueueMap(this) : new DefaultFaweQueueMap(this);
}
this.map = map;
}
@ -412,11 +412,11 @@ public abstract class MappedFaweQueue<WORLD, CHUNK, CHUNKSECTIONS, SECTION> impl
boolean sync = Thread.currentThread() == Fawe.get().getMainThread();
if (sync) {
return loadChunk(getWorld(), cx, cz, true);
} else if (Settings.IMP.HISTORY.CHUNK_WAIT_MS > 0) {
} else if (getSettings().HISTORY.CHUNK_WAIT_MS > 0) {
cachedLoadChunk = null;
loadChunk.value.x = cx;
loadChunk.value.z = cz;
TaskManager.IMP.syncWhenFree(loadChunk, Settings.IMP.HISTORY.CHUNK_WAIT_MS);
TaskManager.IMP.syncWhenFree(loadChunk, getSettings().HISTORY.CHUNK_WAIT_MS);
return cachedLoadChunk;
} else {
return null;

View File

@ -1,7 +1,6 @@
package com.boydti.fawe.example;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweChunk;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.TaskManager;
@ -42,7 +41,7 @@ public abstract class NMSMappedFaweQueue<WORLD, CHUNK, CHUNKSECTION, SECTION> ex
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
if (Settings.IMP.LIGHTING.REMOVE_FIRST) {
if (getSettings().IMP.LIGHTING.REMOVE_FIRST) {
getRelighter().removeAndRelight(hasSky());
} else {
getRelighter().fixLightingSafe(hasSky());
@ -52,7 +51,7 @@ public abstract class NMSMappedFaweQueue<WORLD, CHUNK, CHUNKSECTION, SECTION> ex
}
}
private final Relighter relighter = Settings.IMP.LIGHTING.MODE > 0 ? new NMSRelighter(this) : NullRelighter.INSTANCE;
private final Relighter relighter = getSettings().IMP.LIGHTING.MODE > 0 ? new NMSRelighter(this) : NullRelighter.INSTANCE;
@Override
public Relighter getRelighter() {
@ -62,14 +61,14 @@ public abstract class NMSMappedFaweQueue<WORLD, CHUNK, CHUNKSECTION, SECTION> ex
@Override
public void end(FaweChunk chunk) {
super.end(chunk);
if (Settings.IMP.LIGHTING.MODE == 0) {
if (getSettings().IMP.LIGHTING.MODE == 0) {
sendChunk(chunk);
return;
}
if (!Settings.IMP.LIGHTING.DELAY_PACKET_SENDING) {
if (!getSettings().IMP.LIGHTING.DELAY_PACKET_SENDING) {
sendChunk(chunk);
}
if (Settings.IMP.LIGHTING.MODE == 2) {
if (getSettings().IMP.LIGHTING.MODE == 2) {
getRelighter().addChunk(chunk.getX(), chunk.getZ(), null, chunk.getBitMask());
return;
}
@ -95,7 +94,7 @@ public abstract class NMSMappedFaweQueue<WORLD, CHUNK, CHUNKSECTION, SECTION> ex
}
if (relight) {
getRelighter().addChunk(chunk.getX(), chunk.getZ(), fix, chunk.getBitMask());
} else if (Settings.IMP.LIGHTING.DELAY_PACKET_SENDING) {
} else if (getSettings().IMP.LIGHTING.DELAY_PACKET_SENDING) {
sendChunk(chunk);
}
}