Various
Increase chunk-wait Sync packet sending Allow up outside region
This commit is contained in:
parent
27149ed67a
commit
8090bf9f1d
@ -142,7 +142,7 @@ public class Settings extends Config {
|
|||||||
" or increase chunk-wait-ms.",
|
" or increase chunk-wait-ms.",
|
||||||
"A value of 0 is faster simply because it doesn't bother loading the chunks or waiting.",
|
"A value of 0 is faster simply because it doesn't bother loading the chunks or waiting.",
|
||||||
})
|
})
|
||||||
public static int CHUNK_WAIT_MS = 100;
|
public static int CHUNK_WAIT_MS = 1000;
|
||||||
@Comment("Delete history on disk after a number of days")
|
@Comment("Delete history on disk after a number of days")
|
||||||
public static int DELETE_AFTER_DAYS = 7;
|
public static int DELETE_AFTER_DAYS = 7;
|
||||||
@Comment("Delete history in memory on logout (does not effect disk) (BROKEN, USE DISK INSTEAD)")
|
@Comment("Delete history in memory on logout (does not effect disk) (BROKEN, USE DISK INSTEAD)")
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.boydti.fawe.example;
|
package com.boydti.fawe.example;
|
||||||
|
|
||||||
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FaweChunk;
|
import com.boydti.fawe.object.FaweChunk;
|
||||||
import com.boydti.fawe.object.exception.FaweException;
|
import com.boydti.fawe.object.exception.FaweException;
|
||||||
|
import com.boydti.fawe.util.SetQueue;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
import com.boydti.fawe.util.TaskManager;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
@ -56,7 +58,7 @@ public abstract class NMSMappedFaweQueue<WORLD, CHUNK, CHUNKSECTION, SECTION> ex
|
|||||||
public void end(FaweChunk chunk) {
|
public void end(FaweChunk chunk) {
|
||||||
super.end(chunk);
|
super.end(chunk);
|
||||||
if (Settings.LIGHTING.MODE == 0) {
|
if (Settings.LIGHTING.MODE == 0) {
|
||||||
refreshChunk(chunk);
|
sendChunk(chunk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (relighter == null) {
|
if (relighter == null) {
|
||||||
@ -79,13 +81,22 @@ public abstract class NMSMappedFaweQueue<WORLD, CHUNK, CHUNKSECTION, SECTION> ex
|
|||||||
if (relight) {
|
if (relight) {
|
||||||
relighter.addChunk(chunk.getX(), chunk.getZ(), fix, chunk.getBitMask());
|
relighter.addChunk(chunk.getX(), chunk.getZ(), fix, chunk.getBitMask());
|
||||||
} else {
|
} else {
|
||||||
refreshChunk(chunk);
|
sendChunk(chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendChunk(final FaweChunk fc) {
|
public void sendChunk(final FaweChunk fc) {
|
||||||
refreshChunk(fc);
|
if (Fawe.get().isMainThread()) {
|
||||||
|
refreshChunk(fc);
|
||||||
|
} else {
|
||||||
|
SetQueue.IMP.addTask(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
refreshChunk(fc);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void setFullbright(CHUNKSECTION sections);
|
public abstract void setFullbright(CHUNKSECTION sections);
|
||||||
|
@ -210,7 +210,7 @@ public class MCAQueue extends NMSMappedFaweQueue<FaweQueue, FaweChunk, FaweChunk
|
|||||||
@Override
|
@Override
|
||||||
public void refreshChunk(FaweChunk fs) {
|
public void refreshChunk(FaweChunk fs) {
|
||||||
if (fs.getClass() != MCAChunk.class) {
|
if (fs.getClass() != MCAChunk.class) {
|
||||||
parentNMS.refreshChunk(fs);
|
parentNMS.sendChunk(fs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,6 +295,14 @@ public abstract class TaskManager {
|
|||||||
return syncWhenFree(function, Integer.MAX_VALUE);
|
return syncWhenFree(function, Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void taskWhenFree(Runnable run) {
|
||||||
|
if (Fawe.get().isMainThread()) {
|
||||||
|
run.run();
|
||||||
|
} else {
|
||||||
|
SetQueue.IMP.addTask(run);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run a task on the main thread when the TPS is high enough, and wait for execution to finish:<br>
|
* Run a task on the main thread when the TPS is high enough, and wait for execution to finish:<br>
|
||||||
* - Useful if you need to access something from the Bukkit API from another thread<br>
|
* - Useful if you need to access something from the Bukkit API from another thread<br>
|
||||||
|
@ -199,19 +199,27 @@ public class PlayerWrapper implements Player {
|
|||||||
@Override
|
@Override
|
||||||
public void floatAt(final int x, final int y, final int z, final boolean alwaysGlass) {
|
public void floatAt(final int x, final int y, final int z, final boolean alwaysGlass) {
|
||||||
EditSessionFactory factory = WorldEdit.getInstance().getEditSessionFactory();
|
EditSessionFactory factory = WorldEdit.getInstance().getEditSessionFactory();
|
||||||
final EditSession edit = factory.getEditSession(parent.getWorld(), -1, null, this);
|
RuntimeException caught = null;
|
||||||
edit.setBlockFast(new Vector(x, y - 1, z), new BaseBlock( BlockType.GLASS.getID()));
|
try {
|
||||||
LocalSession session = Fawe.get().getWorldEdit().getSession(this);
|
final EditSession edit = factory.getEditSession(parent.getWorld(), -1, null, this);
|
||||||
if (session != null) {
|
edit.setBlockFast(new Vector(x, y - 1, z), new BaseBlock(BlockType.GLASS.getID()));
|
||||||
session.remember(edit, true, false, FawePlayer.wrap(this).getLimit().MAX_HISTORY);
|
edit.flushQueue();
|
||||||
|
LocalSession session = Fawe.get().getWorldEdit().getSession(this);
|
||||||
|
if (session != null) {
|
||||||
|
session.remember(edit, true, false, FawePlayer.wrap(this).getLimit().MAX_HISTORY);
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
caught = e;
|
||||||
}
|
}
|
||||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Object value) {
|
public void run(Object value) {
|
||||||
edit.getQueue().flush();
|
|
||||||
setPosition(new Vector(x + 0.5, y, z + 0.5));
|
setPosition(new Vector(x + 0.5, y, z + 0.5));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (caught != null) {
|
||||||
|
throw caught;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user