Mappings be obfuscated

This commit is contained in:
dordsor21 2021-09-11 12:19:46 +01:00
parent cfae804780
commit 04821f777e
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -46,7 +46,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
public class SingleWorldListener implements Listener { public class SingleWorldListener implements Listener {
private final Method methodGetHandleChunk; private final Method methodGetHandleChunk;
private Field mustSave; private Field shouldSave;
public SingleWorldListener() throws Exception { public SingleWorldListener() throws Exception {
ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk"); ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
@ -55,13 +55,13 @@ public class SingleWorldListener implements Listener {
if (PlotSquared.platform().serverVersion()[1] < 17) { if (PlotSquared.platform().serverVersion()[1] < 17) {
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.shouldSave = classChunk.getField("mustSave").getRealField();
} else { } else {
this.mustSave = classChunk.getField("unsaved").getRealField(); this.shouldSave = classChunk.getField("s").getRealField();
} }
} else { } else {
ReflectionUtils.RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk"); ReflectionUtils.RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
this.mustSave = classChunk.getField("mustNotSave").getRealField(); this.shouldSave = classChunk.getField("r").getRealField();
} }
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
e.printStackTrace(); e.printStackTrace();
@ -71,8 +71,8 @@ public class SingleWorldListener implements Listener {
public void markChunkAsClean(Chunk chunk) { public void markChunkAsClean(Chunk chunk) {
try { try {
Object nmsChunk = methodGetHandleChunk.invoke(chunk); Object nmsChunk = methodGetHandleChunk.invoke(chunk);
if (mustSave != null) { if (shouldSave != null) {
this.mustSave.set(nmsChunk, false); this.shouldSave.set(nmsChunk, false);
} }
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();