mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Fix single plot area NPEs & generator stackoverflow
This commit is contained in:
@ -22,7 +22,7 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
|
||||
@SuppressWarnings("unused") public class SingleWorldListener implements Listener {
|
||||
|
||||
private Method methodGetHandleChunk;
|
||||
private Field mustSave, done, lit, s;
|
||||
private Field mustSave;
|
||||
|
||||
public SingleWorldListener(Plugin plugin) throws Exception {
|
||||
ReflectionUtils.RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
@ -30,9 +30,6 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
|
||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod();
|
||||
this.mustSave = classChunk.getField("mustSave").getRealField();
|
||||
try {
|
||||
this.done = classChunk.getField("done").getRealField();
|
||||
this.lit = classChunk.getField("lit").getRealField();
|
||||
this.s = classChunk.getField("s").getRealField();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -42,18 +39,9 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
|
||||
public void markChunkAsClean(Chunk chunk) {
|
||||
try {
|
||||
Object nmsChunk = methodGetHandleChunk.invoke(chunk);
|
||||
if (done != null) {
|
||||
this.done.set(nmsChunk, true);
|
||||
}
|
||||
if (mustSave != null) {
|
||||
this.mustSave.set(nmsChunk, false);
|
||||
}
|
||||
if (lit != null) {
|
||||
this.lit.set(nmsChunk, false);
|
||||
}
|
||||
if (s != null) {
|
||||
this.s.set(nmsChunk, false);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
Reference in New Issue
Block a user