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