diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..bc29287
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,24 @@
+*.class
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+# Eclipse stuff:
+.project
+.settings
+.classpath
+
+# IntelliJ stuff:
+.idea
+
+# Build:
+/classes/
+target/
\ No newline at end of file
diff --git a/contributors.txt b/contributors.txt
deleted file mode 100755
index 9c7a332..0000000
--- a/contributors.txt
+++ /dev/null
@@ -1 +0,0 @@
-Paddy Lamont
diff --git a/pom.xml b/pom.xml
index 879507b..21b2477 100755
--- a/pom.xml
+++ b/pom.xml
@@ -6,14 +6,13 @@
net.sothatsit
blockstore
- 1.5.0
-
+ 1.6.0
jar
UTF-8
- 1.7
- 1.7
+ 1.8
+ 1.8
@@ -35,7 +34,6 @@
spigot-repo
https://hub.spigotmc.org/nexus/content/repositories/snapshots/
-
sk89q-repo
http://maven.sk89q.com/repo
@@ -46,14 +44,14 @@
org.spigotmc
spigot-api
- 1.9-R0.1-SNAPSHOT
+ 1.13-R0.1-SNAPSHOT
provided
-
com.sk89q.worldedit
worldedit-bukkit
- 6.1.1-SNAPSHOT
+ 7.0.0-SNAPSHOT
+
\ No newline at end of file
diff --git a/releases/BlockStore 1.5.0.jar b/releases/BlockStore 1.5.0.jar
deleted file mode 100644
index 712a192..0000000
Binary files a/releases/BlockStore 1.5.0.jar and /dev/null differ
diff --git a/src/main/java/net/sothatsit/blockstore/WorldEditHook.java b/src/main/java/net/sothatsit/blockstore/WorldEditHook.java
index 13a2c48..8a53f8f 100755
--- a/src/main/java/net/sothatsit/blockstore/WorldEditHook.java
+++ b/src/main/java/net/sothatsit/blockstore/WorldEditHook.java
@@ -2,41 +2,39 @@
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit;
-import com.sk89q.worldedit.blocks.BaseBlock;
+import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.event.extent.EditSessionEvent;
-import com.sk89q.worldedit.extent.logging.AbstractLoggingExtent;
+import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.util.eventbus.Subscribe;
-
import com.sk89q.worldedit.world.World;
+import com.sk89q.worldedit.world.block.BlockStateHolder;
import net.sothatsit.blockstore.chunkstore.BlockLoc;
import net.sothatsit.blockstore.chunkstore.ChunkManager;
import net.sothatsit.blockstore.chunkstore.ChunkStore;
public class WorldEditHook {
- public void register() {
+ void register() {
WorldEdit.getInstance().getEventBus().register(this);
}
@Subscribe
public void wrapForLogging(EditSessionEvent event) {
World world = event.getWorld();
-
- if(world == null)
+ if (world == null) {
return;
+ }
final ChunkManager manager = BlockStore.getInstance().getManager(world.getName());
-
- event.setExtent(new AbstractLoggingExtent(event.getExtent()) {
+ event.setExtent(new AbstractDelegateExtent(event.getExtent()) {
@Override
- protected void onBlockChange(Vector pos, BaseBlock newBlock) {
- BlockLoc blockLoc = BlockLoc.fromLocation(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
-
+ public boolean setBlock(Vector pos, BlockStateHolder block) throws WorldEditException {
+ BlockLoc blockLoc = BlockLoc.fromLocation(pos.getX(), pos.getY(), pos.getZ());
ChunkStore store = manager.getChunkStore(blockLoc.chunkLoc, true);
-
store.setPlaced(blockLoc, false);
+ return getExtent().setBlock(pos, block);
}
});
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/net/sothatsit/blockstore/chunkstore/BlockLoc.java b/src/main/java/net/sothatsit/blockstore/chunkstore/BlockLoc.java
index e11314e..960bcc4 100644
--- a/src/main/java/net/sothatsit/blockstore/chunkstore/BlockLoc.java
+++ b/src/main/java/net/sothatsit/blockstore/chunkstore/BlockLoc.java
@@ -66,10 +66,10 @@ public boolean equals(Object obj) {
@Override
public String toString() {
return "{chunkLoc: " + chunkLoc
- + ", relx: " + relx
- + ", rely: " + rely
- + ", relz: " + relz
- + ", blockIndex: " + blockIndex + "}";
+ + ", relx: " + relx
+ + ", rely: " + rely
+ + ", relz: " + relz
+ + ", blockIndex: " + blockIndex + "}";
}
public static int calcBlockIndex(int relx, int rely, int relz) {
@@ -85,15 +85,15 @@ public static BlockLoc fromBlock(Block block) {
}
public static BlockLoc fromLocation(Location location) {
- return fromLocation(location.getBlockX(), location.getBlockY(), location.getBlockZ());
+ return fromLocation(location.getX(), location.getY(), location.getZ());
}
- public static BlockLoc fromLocation(int x, int y, int z) {
+ public static BlockLoc fromLocation(double x, double y, double z) {
ChunkLoc chunkLoc = ChunkLoc.fromLocation(x, y, z);
- int relx = x - chunkLoc.getBlockX();
- int rely = y - chunkLoc.getBlockY();
- int relz = z - chunkLoc.getBlockZ();
+ int relx = (int) x - chunkLoc.getBlockX();
+ int rely = (int) y - chunkLoc.getBlockY();
+ int relz = (int) z - chunkLoc.getBlockZ();
return new BlockLoc(chunkLoc, relx, rely, relz);
}
@@ -107,4 +107,4 @@ public static BlockLoc fromBlockIndex(ChunkLoc chunkLoc, int blockIndex) {
return new BlockLoc(chunkLoc, relx, rely, relz);
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/net/sothatsit/blockstore/chunkstore/ChunkLoc.java b/src/main/java/net/sothatsit/blockstore/chunkstore/ChunkLoc.java
index 0d27ab3..1c74b0c 100644
--- a/src/main/java/net/sothatsit/blockstore/chunkstore/ChunkLoc.java
+++ b/src/main/java/net/sothatsit/blockstore/chunkstore/ChunkLoc.java
@@ -52,11 +52,15 @@ public String toString() {
}
public static ChunkLoc fromLocation(Location location) {
- return fromLocation(location.getBlockX(), location.getBlockY(), location.getBlockZ());
+ return fromLocation(location.getX(), location.getY(), location.getZ());
}
- public static ChunkLoc fromLocation(int x, int y, int z) {
- return new ChunkLoc(x / 16, y / 64, z / 16);
+ public static ChunkLoc fromLocation(double x, double y, double z) {
+ int cx = (int) Math.floor(x / 16d);
+ int cy = (int) Math.floor(y / 64d);
+ int cz = (int) Math.floor(z / 16d);
+
+ return new ChunkLoc(cx, cy, cz);
}
-}
+}
\ No newline at end of file