Begin 1.9 NMS updates

This commit is contained in:
Matt 2016-02-29 20:44:58 -05:00
parent 9596544f97
commit 0bbfd0f49a
3 changed files with 47 additions and 6 deletions

View File

@ -0,0 +1,35 @@
package com.plotsquared.bukkit.util.block;
import com.intellectualcrafters.plot.util.PlotChunk;
import com.intellectualcrafters.plot.util.SetQueue;
import com.plotsquared.bukkit.util.BukkitUtil;
import org.bukkit.Chunk;
public class FastChunk_1_9 extends PlotChunk<Chunk> {
public FastChunk_1_9(SetQueue.ChunkWrapper wrap) {
super(wrap);
}
@Override
public Chunk getChunkAbs() {
SetQueue.ChunkWrapper loc = getChunkWrapper();
return BukkitUtil.getWorld(loc.world).getChunkAt(loc.x, loc.z);
}
@Override public void setBlock(int x, int y, int z, int id, byte data) {
}
@Override public void setBiome(int x, int z, int biome) {
}
@Override public PlotChunk clone() {
return null;
}
@Override public PlotChunk shallowClone() {
return null;
}
}

View File

@ -49,11 +49,8 @@ public class FastQueue_1_8_3 extends SlowQueue {
private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition"); private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
private final RefClass classChunkSection = getRefClass("{nms}.ChunkSection"); private final RefClass classChunkSection = getRefClass("{nms}.ChunkSection");
public HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>(); public HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
private RefMethod methodGetHandlePlayer;
private RefMethod methodGetHandleChunk; private RefMethod methodGetHandleChunk;
private RefConstructor MapChunk; private RefConstructor MapChunk;
private RefField connection;
private RefMethod send;
private RefMethod methodInitLighting; private RefMethod methodInitLighting;
private RefConstructor classBlockPositionConstructor; private RefConstructor classBlockPositionConstructor;
private RefConstructor classChunkSectionConstructor; private RefConstructor classChunkSectionConstructor;
@ -64,12 +61,9 @@ public class FastQueue_1_8_3 extends SlowQueue {
private RefMethod methodGetIdArray; private RefMethod methodGetIdArray;
public FastQueue_1_8_3() throws NoSuchMethodException, RuntimeException { public FastQueue_1_8_3() throws NoSuchMethodException, RuntimeException {
methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle");
methodGetHandleChunk = classCraftChunk.getMethod("getHandle"); methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
methodInitLighting = classChunk.getMethod("initLighting"); methodInitLighting = classChunk.getMethod("initLighting");
MapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), boolean.class, int.class); MapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), boolean.class, int.class);
connection = classEntityPlayer.getField("playerConnection");
send = classConnection.getMethod("sendPacket", classPacket.getRealClass());
classBlockPositionConstructor = classBlockPosition.getConstructor(int.class, int.class, int.class); classBlockPositionConstructor = classBlockPosition.getConstructor(int.class, int.class, int.class);
methodX = classWorld.getMethod("x", classBlockPosition.getRealClass()); methodX = classWorld.getMethod("x", classBlockPosition.getRealClass());
fieldSections = classChunk.getField("sections"); fieldSections = classChunk.getField("sections");

View File

@ -0,0 +1,12 @@
package com.plotsquared.bukkit.util.block;
import com.intellectualcrafters.plot.util.PlotChunk;
import com.intellectualcrafters.plot.util.SetQueue;
import org.bukkit.Chunk;
public class FastQueue_1_9 extends SlowQueue {
@Override public PlotChunk<Chunk> getChunk(SetQueue.ChunkWrapper wrap) {
return new FastChunk_1_9(wrap);
}
}