Fixes
Fixes startup for 1.8 Fixes tile entity crash (1.8/1.9)
This commit is contained in:
parent
c91971012e
commit
18f1e90ca5
4
pom.xml
4
pom.xml
@ -8,7 +8,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<artifactId>FastAsyncWorldEdit</artifactId>
|
||||
<version>1.3.2</version>
|
||||
<version>3.3.1</version>
|
||||
<name>FastAsyncWorldEdit</name>
|
||||
<packaging>jar</packaging>
|
||||
<build>
|
||||
@ -163,7 +163,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.9-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.PrimeSoft</groupId>
|
||||
|
@ -133,10 +133,6 @@ public class Fawe {
|
||||
TaskManager.IMP.repeat(lag, 100);
|
||||
}
|
||||
|
||||
public boolean checkVersion(final int[] version, final int major, final int minor, final int minor2) {
|
||||
return (version[0] > major) || ((version[0] == major) && (version[1] > minor)) || ((version[0] == major) && (version[1] == minor) && (version[2] >= minor2));
|
||||
}
|
||||
|
||||
private void setupEvents() {
|
||||
WorldEdit.getInstance().getEventBus().register(new WESubscriber());
|
||||
if (Settings.COMMAND_PROCESSOR) {
|
||||
|
@ -34,6 +34,18 @@ import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
*/
|
||||
public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Compare two versions
|
||||
* @param version
|
||||
* @param major
|
||||
* @param minor
|
||||
* @param minor2
|
||||
* @return true if version is >= major, minor, minor2
|
||||
*/
|
||||
public static boolean checkVersion(final int[] version, final int major, final int minor, final int minor2) {
|
||||
return (version[0] > major) || ((version[0] == major) && (version[1] > minor)) || ((version[0] == major) && (version[1] == minor) && (version[2] >= minor2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a block at a location asynchronously
|
||||
* @param loc
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.IFawe;
|
||||
import com.boydti.fawe.bukkit.regions.FactionsFeature;
|
||||
import com.boydti.fawe.bukkit.regions.FactionsUUIDFeature;
|
||||
@ -134,7 +135,7 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
|
||||
|
||||
@Override
|
||||
public FaweQueue getQueue() {
|
||||
if (Fawe.get().checkVersion(getServerVersion(), 1, 9, 0)) {
|
||||
if (FaweAPI.checkVersion(getServerVersion(), 1, 9, 0)) {
|
||||
try {
|
||||
return new BukkitQueue_1_9();
|
||||
} catch (Throwable e) {
|
||||
|
@ -73,6 +73,8 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
|
||||
private RefField fieldSections;
|
||||
private RefField fieldWorld;
|
||||
private RefMethod methodGetIdArray;
|
||||
private RefMethod methodGetWorld;
|
||||
private RefField tileEntityUnload;
|
||||
|
||||
private final HashMap<String, FaweGenerator_1_8> worldMap = new HashMap<>();
|
||||
|
||||
@ -91,6 +93,8 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
|
||||
methodGetIdArray = classChunkSection.getMethod("getIdArray");
|
||||
methodAreNeighborsLoaded = classChunk.getMethod("areNeighborsLoaded", int.class);
|
||||
classChunkSectionConstructor = classChunkSection.getConstructor(int.class, boolean.class, char[].class);
|
||||
this.tileEntityUnload = classWorld.getField("c");
|
||||
this.methodGetWorld = classChunk.getMethod("getWorld");
|
||||
} catch (final NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -299,6 +303,7 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
|
||||
// Sections
|
||||
final Method getHandele = chunk.getClass().getDeclaredMethod("getHandle");
|
||||
final Object c = getHandele.invoke(chunk);
|
||||
Object w = methodGetWorld.of(c).call();
|
||||
final Class<? extends Object> clazz = c.getClass();
|
||||
final Field sf = clazz.getDeclaredField("sections");
|
||||
sf.setAccessible(true);
|
||||
@ -307,6 +312,7 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
|
||||
|
||||
final Object[] sections = (Object[]) sf.get(c);
|
||||
final HashMap<?, ?> tiles = (HashMap<?, ?>) tf.get(c);
|
||||
List<Object> tilesUnload = (List<Object>) tileEntityUnload.of(w).get();
|
||||
final List<?>[] entities = (List<?>[]) ef.get(c);
|
||||
|
||||
Method xm = null;
|
||||
@ -335,6 +341,7 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
|
||||
continue;
|
||||
}
|
||||
if (array[k] != 0) {
|
||||
tilesUnload.add(tile.getValue());
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,8 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
|
||||
private final RefMethod methodGetCombinedId;
|
||||
private final RefMethod methodGetByCombinedId;
|
||||
private final Object air;
|
||||
private final RefMethod methodGetWorld;
|
||||
private final RefField tileEntityUnload;
|
||||
|
||||
private final RefMethod methodGetHandlePlayer;
|
||||
private final RefField connection;
|
||||
@ -99,6 +101,8 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
|
||||
methodAreNeighborsLoaded = classChunk.getMethod("areNeighborsLoaded", int.class);
|
||||
classChunkSectionConstructor = classChunkSection.getConstructor(int.class, boolean.class, char[].class);
|
||||
air = methodGetByCombinedId.call(0);
|
||||
this.tileEntityUnload = classWorld.getField("tileEntityListUnload");
|
||||
this.methodGetWorld = classChunk.getMethod("getWorld");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -310,6 +314,7 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
|
||||
// Sections
|
||||
final Method getHandele = chunk.getClass().getDeclaredMethod("getHandle");
|
||||
final Object c = getHandele.invoke(chunk);
|
||||
Object w = methodGetWorld.of(c).call();
|
||||
final Class<? extends Object> clazz = c.getClass();
|
||||
final Field sf = clazz.getDeclaredField("sections");
|
||||
sf.setAccessible(true);
|
||||
@ -318,6 +323,7 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
|
||||
|
||||
final Object[] sections = (Object[]) sf.get(c);
|
||||
final HashMap<?, ?> tiles = (HashMap<?, ?>) tf.get(c);
|
||||
List<Object> tilesUnload = (List<Object>) tileEntityUnload.of(w).get();
|
||||
final List<?>[] entities = (List<?>[]) ef.get(c);
|
||||
|
||||
Method xm = null;
|
||||
@ -346,6 +352,7 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
|
||||
continue;
|
||||
}
|
||||
if (array[k] != 0) {
|
||||
tilesUnload.add(tile.getValue());
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: FastAsyncWorldEdit
|
||||
main: com.boydti.fawe.bukkit.FaweBukkit
|
||||
version: 1.2.1
|
||||
version: 3.3.1
|
||||
description: Fast Async WorldEdit plugin
|
||||
authors: [Empire92]
|
||||
loadbefore: [WorldEdit]
|
||||
|
Loading…
Reference in New Issue
Block a user