mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Do not access nms for older versions on newer ones
This commit is contained in:
parent
d9b5dc5dd7
commit
932873ba02
@ -49,13 +49,19 @@ public class SingleWorldListener implements Listener {
|
||||
|
||||
private Method methodGetHandleChunk;
|
||||
private Field mustSave;
|
||||
private boolean isTrueForNotSave = true;
|
||||
|
||||
public SingleWorldListener(Plugin plugin) throws Exception {
|
||||
ReflectionUtils.RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod();
|
||||
try {
|
||||
this.mustSave = classChunk.getField("mustSave").getRealField();
|
||||
if (PlotSquared.get().IMP.getServerVersion()[1] == 13) {
|
||||
this.mustSave = classChunk.getField("mustSave").getRealField();
|
||||
this.isTrueForNotSave = false;
|
||||
} else {
|
||||
this.mustSave = classChunk.getField("mustNotSave").getRealField();
|
||||
}
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user