mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07: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 Method methodGetHandleChunk;
|
||||||
private Field mustSave;
|
private Field mustSave;
|
||||||
|
private boolean isTrueForNotSave = true;
|
||||||
|
|
||||||
public SingleWorldListener(Plugin plugin) throws Exception {
|
public SingleWorldListener(Plugin plugin) throws Exception {
|
||||||
ReflectionUtils.RefClass classChunk = getRefClass("{nms}.Chunk");
|
ReflectionUtils.RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||||
ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod();
|
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod();
|
||||||
try {
|
try {
|
||||||
|
if (PlotSquared.get().IMP.getServerVersion()[1] == 13) {
|
||||||
this.mustSave = classChunk.getField("mustSave").getRealField();
|
this.mustSave = classChunk.getField("mustSave").getRealField();
|
||||||
|
this.isTrueForNotSave = false;
|
||||||
|
} else {
|
||||||
|
this.mustSave = classChunk.getField("mustNotSave").getRealField();
|
||||||
|
}
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user