From 0bbfd0f49a32189b30c82093f138963ad3351a99 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 29 Feb 2016 20:44:58 -0500 Subject: [PATCH] Begin 1.9 NMS updates --- .../bukkit/util/block/FastChunk_1_9.java | 35 +++++++++++++++++++ .../bukkit/util/block/FastQueue_1_8_3.java | 6 ---- .../bukkit/util/block/FastQueue_1_9.java | 12 +++++++ 3 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastChunk_1_9.java create mode 100644 Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastChunk_1_9.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastChunk_1_9.java new file mode 100644 index 000000000..66f674417 --- /dev/null +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastChunk_1_9.java @@ -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 { + + 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; + } +} diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java index a1021c83d..25f5a1005 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java @@ -49,11 +49,8 @@ public class FastQueue_1_8_3 extends SlowQueue { private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition"); private final RefClass classChunkSection = getRefClass("{nms}.ChunkSection"); public HashMap toUpdate = new HashMap<>(); - private RefMethod methodGetHandlePlayer; private RefMethod methodGetHandleChunk; private RefConstructor MapChunk; - private RefField connection; - private RefMethod send; private RefMethod methodInitLighting; private RefConstructor classBlockPositionConstructor; private RefConstructor classChunkSectionConstructor; @@ -64,12 +61,9 @@ public class FastQueue_1_8_3 extends SlowQueue { private RefMethod methodGetIdArray; public FastQueue_1_8_3() throws NoSuchMethodException, RuntimeException { - methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle"); methodGetHandleChunk = classCraftChunk.getMethod("getHandle"); methodInitLighting = classChunk.getMethod("initLighting"); 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); methodX = classWorld.getMethod("x", classBlockPosition.getRealClass()); fieldSections = classChunk.getField("sections"); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java new file mode 100644 index 000000000..0fd868a8b --- /dev/null +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java @@ -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 getChunk(SetQueue.ChunkWrapper wrap) { + return new FastChunk_1_9(wrap); + } +}