|
@@ -26,6 +26,7 @@ public class Events implements Listener {
|
|
private CustomOreGen plugin;
|
|
private CustomOreGen plugin;
|
|
|
|
|
|
private boolean useLegacyBlockPlaceMethod;
|
|
private boolean useLegacyBlockPlaceMethod;
|
|
|
|
+ private boolean useLevelledClass;
|
|
private Method legacyBlockPlaceMethod;
|
|
private Method legacyBlockPlaceMethod;
|
|
|
|
|
|
private boolean enableStoneGenerator;
|
|
private boolean enableStoneGenerator;
|
|
@@ -46,6 +47,13 @@ public class Events implements Listener {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.enableStoneGenerator = plugin.getConfig().getBoolean("enable-stone-generator");
|
|
this.enableStoneGenerator = plugin.getConfig().getBoolean("enable-stone-generator");
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Class.forName("org.bukkit.block.data.Levelled");
|
|
|
|
+ useLevelledClass = true;
|
|
|
|
+ } catch( ClassNotFoundException e ) {
|
|
|
|
+ useLevelledClass = false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@SuppressWarnings("deprecation")
|
|
@SuppressWarnings("deprecation")
|
|
@@ -161,8 +169,7 @@ public class Events implements Listener {
|
|
}
|
|
}
|
|
|
|
|
|
public Type getType(Block b) {
|
|
public Type getType(Block b) {
|
|
- try {
|
|
|
|
- Class.forName("org.bukkit.block.data.Levelled");
|
|
|
|
|
|
+ if(useLevelledClass) {
|
|
if(b.getBlockData() != null && b.getBlockData() instanceof org.bukkit.block.data.Levelled) {
|
|
if(b.getBlockData() != null && b.getBlockData() instanceof org.bukkit.block.data.Levelled) {
|
|
org.bukkit.block.data.Levelled level = (org.bukkit.block.data.Levelled) b.getBlockData();
|
|
org.bukkit.block.data.Levelled level = (org.bukkit.block.data.Levelled) b.getBlockData();
|
|
if(level.getLevel() == 0) {
|
|
if(level.getLevel() == 0) {
|
|
@@ -179,7 +186,7 @@ public class Events implements Listener {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } catch( ClassNotFoundException e ) {
|
|
|
|
|
|
+ } else {
|
|
switch(b.getType().name()) {
|
|
switch(b.getType().name()) {
|
|
case "WATER":
|
|
case "WATER":
|
|
return Type.WATER;
|
|
return Type.WATER;
|