mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 11:45:19 +01:00
Fix issues with chunk saving in single world plots
This commit is contained in:
parent
7bc76a3824
commit
4568b17c54
@ -230,7 +230,7 @@ public class ChunkListener implements Listener {
|
||||
}
|
||||
Object c = this.methodGetHandleChunk.of(chunk).call();
|
||||
RefField.RefExecutor field = this.mustSave.of(c);
|
||||
if ((Boolean) field.get()) {
|
||||
if ((Boolean) field.get() != isTrueForNotSave) {
|
||||
field.set(isTrueForNotSave);
|
||||
if (chunk.isLoaded()) {
|
||||
ignoreUnload = true;
|
||||
|
@ -47,7 +47,6 @@ public class SingleWorldListener implements Listener {
|
||||
|
||||
private final Method methodGetHandleChunk;
|
||||
private Field mustSave;
|
||||
private boolean isTrueForNotSave = true;
|
||||
|
||||
public SingleWorldListener() throws Exception {
|
||||
ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
@ -57,9 +56,8 @@ public class SingleWorldListener implements Listener {
|
||||
ReflectionUtils.RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
if (PlotSquared.platform().serverVersion()[1] == 13) {
|
||||
this.mustSave = classChunk.getField("mustSave").getRealField();
|
||||
this.isTrueForNotSave = false;
|
||||
} else {
|
||||
this.mustSave = classChunk.getField("mustNotSave").getRealField();
|
||||
this.mustSave = classChunk.getField("unsaved").getRealField();
|
||||
}
|
||||
} else {
|
||||
ReflectionUtils.RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
|
||||
@ -74,7 +72,7 @@ public class SingleWorldListener implements Listener {
|
||||
try {
|
||||
Object nmsChunk = methodGetHandleChunk.invoke(chunk);
|
||||
if (mustSave != null) {
|
||||
this.mustSave.set(nmsChunk, isTrueForNotSave);
|
||||
this.mustSave.set(nmsChunk, false);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
@ -148,9 +148,7 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
|
||||
if (found != null && found.length != 0) {
|
||||
return found;
|
||||
}
|
||||
return isWorld(world) || world.equals("*") ?
|
||||
array :
|
||||
all.length == 0 ? noPlotAreas : super.getPlotAreas(world, region);
|
||||
return isWorld(world) || world.equals("*") ? array : all.length == 0 ? noPlotAreas : found;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user