Fix /plot auto performance and remove sign-guessing

This commit is contained in:
Alexander Söderberg 2020-04-07 23:39:56 +02:00
parent 0d4af3023d
commit 283ff945f3
3 changed files with 102 additions and 99 deletions

View File

@ -285,15 +285,15 @@ public class BukkitChunkManager extends ChunkManager {
int zzb = z << 4; int zzb = z << 4;
int xxt = xxb + 15; int xxt = xxb + 15;
int zzt = zzb + 15; int zzt = zzb + 15;
Chunk chunkObj = worldObj.getChunkAt(x, z); PaperLib.getChunkAtAsync(worldObj, x, z, false).thenAccept(chunkObj -> {
if (!chunkObj.load(false)) { if (chunkObj == null) {
continue; return;
} }
final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false); final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z) { if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z) {
AugmentedUtils.bypass(ignoreAugment, AugmentedUtils.bypass(ignoreAugment,
() -> queue.regenChunkSafe(chunk.getX(), chunk.getZ())); () -> queue.regenChunkSafe(chunk.getX(), chunk.getZ()));
continue; return;
} }
boolean checkX1 = false; boolean checkX1 = false;
@ -390,6 +390,7 @@ public class BukkitChunkManager extends ChunkManager {
}, world, chunk)); }, world, chunk));
//map.restoreBlocks(worldObj, 0, 0); //map.restoreBlocks(worldObj, 0, 0);
map.restoreEntities(worldObj, 0, 0); map.restoreEntities(worldObj, 0, 0);
});
} }
if (!chunks.isEmpty()) { if (!chunks.isEmpty()) {
TaskManager.runTaskLater(this, 1); TaskManager.runTaskLater(this, 1);

View File

@ -352,5 +352,7 @@ public class Settings extends Config {
public static boolean EXTERNAL_PLACEHOLDERS = true; public static boolean EXTERNAL_PLACEHOLDERS = true;
@Comment("Make road regeneration persistent across restarts") public static boolean @Comment("Make road regeneration persistent across restarts") public static boolean
PERSISTENT_ROAD_REGEN = false; PERSISTENT_ROAD_REGEN = false;
@Comment("Try to guess plot owners from sign data. This may decrease server performance")
public static boolean GUESS_PLOT_OWNER = false;
} }
} }

View File

@ -2368,7 +2368,7 @@ public class Plot {
if (this.hasOwner()) { if (this.hasOwner()) {
return this.owner; return this.owner;
} }
if (!this.area.allowSigns()) { if (!this.area.allowSigns() || !Settings.Enabled_Components.GUESS_PLOT_OWNER) {
return null; return null;
} }
try { try {