diff --git a/.gitignore b/.gitignore
index ca4b531..cfa063b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,4 +27,7 @@ target/
profile
# bukkit
-bukkit/
\ No newline at end of file
+bukkit/
+
+# bukkit test-server
+bukkit-testserver/
diff --git a/pom.xml b/pom.xml
index 1ebb82f..ca5f186 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,41 +5,79 @@
de.craftinc
CraftIncGates
jar
- 1.1.1
+ 2.1.1
UTF-8
+
+ src
+
+
+ resources
+ true
+
+
+
+
+ maven-dependency-plugin
+
+
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}/lib
+
+
+
+
+
+ exec-maven-plugin
+ org.codehaus.mojo
+ 1.2.1
+
+
+ Run Test Bukkit Server
+ package
+
+ exec
+
+
+ ${basedir}/scripts/test-deployment.sh
+
+
+
+
+
+
+
org.bukkit
bukkit
- RELEASE
+ 1.5.2-R0.1
+ jar
+ compile
+
+
+ org.bukkit
+ craftbukkit
+ 1.5.2-R0.1
jar
compile
net.milkbowl.vault
Vault
- 1.2.23-SNAPSHOT
+ 1.2.26-SNAPSHOT
jar
compile
-
- target
- target/classes
- ${project.artifactId}
- src
-
-
- resources
-
-
-
-
bukkit-repo
diff --git a/scripts/minecraft.sh b/scripts/minecraft.sh
new file mode 100755
index 0000000..bcfa5b2
--- /dev/null
+++ b/scripts/minecraft.sh
@@ -0,0 +1,160 @@
+#!/bin/bash
+
+SCRIPT_DIR=$(dirname "$0")
+SERVICE='craftbukkit*.jar'
+#USERNAME="minecraft"
+CPU_COUNT=2
+BUKKIT="$SCRIPT_DIR/../target/lib/$SERVICE"
+INVOCATION="java -Xmx1000M -Xms300M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=$CPU_COUNT -XX:+AggressiveOpts -jar $BUKKIT nogui"
+MCPATH="$SCRIPT_DIR/../bukkit-testserver"
+
+if [ ! -d "$MCPATH" ]; then
+ mkdir -p "$MCPATH"
+fi
+
+ME=$(whoami)
+as_user() {
+ #if [ $ME == $USERNAME ] ; then
+ bash -c "$1"
+ #else
+ #su - $USERNAME -c "$1"
+ #fi
+}
+
+mc_start() {
+ if ps ax | grep -v grep | grep -v -i SCREEN | grep "craftbukkit" > /dev/null
+ then
+ echo "Tried to start but $SERVICE was already running!"
+ else
+ echo "$SERVICE was not running... starting."
+ cd "$MCPATH"
+ as_user "cd "$MCPATH" && screen -dmS minecraft $INVOCATION"
+ sleep 7
+ if ps ax | grep -v grep | grep -v -i SCREEN | grep "craftbukkit" > /dev/null
+ then
+ echo "$SERVICE is now running."
+ else
+ echo "Could not start $SERVICE."
+ fi
+ fi
+}
+
+mc_stop() {
+ if ps ax | grep -v grep | grep -v -i SCREEN | grep "craftbukkit" > /dev/null
+ then
+ echo "$SERVICE is running... stopping."
+ as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-all\"\015'"
+ sleep 2
+ as_user "screen -p 0 -S minecraft -X eval 'stuff \"stop\"\015'"
+ sleep 6
+ else
+ echo "$SERVICE was not running."
+ fi
+ if ps ax | grep -v grep | grep -v -i SCREEN | grep "craftbukkit" > /dev/null
+ then
+ echo "$SERVICE could not be shut down... still running."
+ else
+ echo "$SERVICE is shut down."
+ fi
+}
+
+mc_save() {
+ if ps ax | grep -v grep | grep -v -i SCREEN | grep "craftbukkit" > /dev/null
+ then
+ echo "$SERVICE is running... saving."
+ as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-all\"\015'"
+ else
+ echo "$SERVICE was not running."
+ fi
+}
+
+mc_reload() {
+ if ps ax | grep -v grep | grep -v -i SCREEN | grep "craftbukkit" > /dev/null
+ then
+ echo "$SERVICE is running... reloading."
+ as_user "screen -p 0 -S minecraft -X eval 'stuff \"reload\"\015'"
+ else
+ echo "$SERVICE was not running."
+ fi
+}
+
+mc_reload_or_start() {
+ if ps ax | grep -v grep | grep -v -i SCREEN | grep "craftbukkit" > /dev/null
+ then
+ echo "$SERVICE was already running! Doing a reload now!"
+ mc_reload
+ else
+ echo "$SERVICE was not running... starting."
+ cd "$MCPATH"
+ as_user "cd \"$MCPATH\" && screen -dmS minecraft $INVOCATION"
+ sleep 7
+ if ps ax | grep -v grep | grep -v -i SCREEN | grep "craftbukkit" > /dev/null
+ then
+ echo "$SERVICE is now running."
+ else
+ echo "Could not start $SERVICE."
+ fi
+ fi
+}
+
+mc_ddidderr_admin() {
+ if ps ax | grep -v grep | grep -v -i SCREEN | grep "craftbukkit" > /dev/null
+ then
+ echo "$SERVICE is running... making ddidder to admin and reloading permissions."
+ as_user "screen -p 0 -S minecraft -X eval 'stuff \"pex user ddidderr group set admin\"\015'"
+ as_user "screen -p 0 -S minecraft -X eval 'stuff \"pex reload\"\015'"
+ else
+ echo "$SERVICE was not running."
+ fi
+}
+
+case "$1" in
+ start)
+ echo "Starting Minecraft..."
+ mc_start
+ echo "DONE"
+ ;;
+ stop)
+ echo "Stopping Minecraft..."
+ as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER SHUTTING DOWN!\"\015'"
+ mc_stop
+ echo "DONE"
+ ;;
+ restart)
+ as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER REBOOT IN 10 SECONDS.\"\015'"
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ reload)
+ mc_reload
+ ;;
+ reload_or_start)
+ echo "Starting or reloading Minecraft..."
+ mc_reload_or_start
+ echo "DONE"
+ ;;
+ ddidderr_admin)
+ mc_ddidderr_admin
+ ;;
+ connected)
+ as_user "screen -p 0 -S minecraft -X eval 'stuff \"who\"\015'"
+ sleep 2s
+ tac "$MCPATH"/server.log | grep -m 1 "Connected"
+ ;;
+ status)
+ if ps ax | grep -v grep | grep -v -i SCREEN | grep "craftbukkit" > /dev/null
+ then
+ echo "$SERVICE is running."
+ else
+ echo "$SERVICE is not running."
+ fi
+ ;;
+ save)
+ mc_save
+ ;;
+ *)
+ echo "Usage: /etc/init.d/minecraft {start|stop|restart|connected|status}"
+ exit 1
+ ;;
+esac
diff --git a/scripts/test-deployment.sh b/scripts/test-deployment.sh
new file mode 100755
index 0000000..24ec64c
--- /dev/null
+++ b/scripts/test-deployment.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+SCRIPT_DIR=$(dirname "$0")
+
+BUKKIT_DIR="$SCRIPT_DIR/../bukkit-testserver"
+PLUGIN_DIR="$SCRIPT_DIR/../bukkit-testserver/plugins"
+
+# TODO: This is a bad solution! Maven should write necessary information into an extra file.
+ARTIFACT_ID="$(grep -C3 'de.craftinc' "$SCRIPT_DIR/../pom.xml" | grep '' | sed 's/[ \t]*//g' | sed 's/<\/artifactId>[ \t]*//g')"
+
+# TODO: This is a bad solution! Maven should write necessary information into an extra file.
+VERSION="$(grep -C3 'de.craftinc' "$SCRIPT_DIR/../pom.xml" | grep '' | sed 's/[ \t]*//g' | sed 's/<\/version>[ \t]*//g')"
+
+
+mkdir -p "$PLUGIN_DIR"
+
+cp "$SCRIPT_DIR/../target/$ARTIFACT_ID-$VERSION".jar "$PLUGIN_DIR/$ARTIFACT_ID".jar
+
+echo -e "ddidderr\nmice_on_drugs\nMochaccino\nbeuth_el_max" > "$BUKKIT_DIR/ops.txt"
+
+"$SCRIPT_DIR/minecraft.sh" reload_or_start
diff --git a/src/de/craftinc/gates/util/LocationUtil.java b/src/de/craftinc/gates/util/LocationUtil.java
index b8fb9f0..e04412f 100644
--- a/src/de/craftinc/gates/util/LocationUtil.java
+++ b/src/de/craftinc/gates/util/LocationUtil.java
@@ -2,7 +2,6 @@ package de.craftinc.gates.util;
import java.util.HashMap;
import java.util.Map;
-
import org.bukkit.Location;
import org.bukkit.World;
@@ -90,13 +89,13 @@ public class LocationUtil
if (l1.getWorld() != l2.getWorld() && (l1.getWorld() == null || !l1.getWorld().equals(l2.getWorld()))) {
return false;
}
- if (new Double(l1.getX()).longValue() != new Double(l2.getX()).longValue()) {
+ if (l1.getBlockX() != l2.getBlockX()) {
return false;
}
- if (new Double(l1.getY()).longValue() != new Double(l2.getY()).longValue()) {
+ if (l1.getBlockY() != l2.getBlockY()) {
return false;
}
- if (new Double(l1.getZ()).longValue() != new Double(l2.getZ()).longValue()) {
+ if (l1.getBlockZ() != l2.getBlockZ()) {
return false;
}