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