diff --git a/.classpath b/.classpath
index 1913e2f..ab57551 100644
--- a/.classpath
+++ b/.classpath
@@ -2,6 +2,10 @@
-
+
+
+
+
+
diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..90ac188
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project AncientGates.
+
+
+
diff --git a/localexport.jardesc b/localexport.jardesc
deleted file mode 100644
index 30829fc..0000000
--- a/localexport.jardesc
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/plugin.yml b/plugin.yml
index 5a3ab39..33ce6a0 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -1,5 +1,5 @@
name: AncientGates
-version: 1.0.1
+version: 1.1
main: org.mcteam.ancientgates.Plugin
commands:
gate:
diff --git a/src/org/mcteam/ancientgates/MyLocationTypeAdapter.java b/src/org/mcteam/ancientgates/MyLocationTypeAdapter.java
index e8ba0b4..a8bd868 100644
--- a/src/org/mcteam/ancientgates/MyLocationTypeAdapter.java
+++ b/src/org/mcteam/ancientgates/MyLocationTypeAdapter.java
@@ -4,8 +4,8 @@ import java.lang.reflect.Type;
import org.bukkit.Location;
import org.bukkit.World;
+import org.bukkit.World.Environment;
import org.bukkit.WorldCreator;
-
import org.mcteam.ancientgates.gson.JsonDeserializationContext;
import org.mcteam.ancientgates.gson.JsonDeserializer;
import org.mcteam.ancientgates.gson.JsonElement;
@@ -63,10 +63,9 @@ public class MyLocationTypeAdapter implements JsonDeserializer, JsonSe
private World getWorld(String name) {
World world = Plugin.instance.getServer().getWorld(name);
-
- if (world == null)
- world = Plugin.instance.getServer().createWorld(new WorldCreator(name));
-
+ if (world == null) {
+ world = Plugin.instance.getServer().createWorld(new WorldCreator(name).environment(Environment.NORMAL));
+ }
return world;
}
}
diff --git a/src/org/mcteam/ancientgates/Plugin.java b/src/org/mcteam/ancientgates/Plugin.java
index db88eaa..7f8a67d 100644
--- a/src/org/mcteam/ancientgates/Plugin.java
+++ b/src/org/mcteam/ancientgates/Plugin.java
@@ -7,27 +7,12 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
-
import org.bukkit.plugin.java.JavaPlugin;
-
-import org.mcteam.ancientgates.commands.BaseCommand;
-import org.mcteam.ancientgates.commands.CommandClose;
-import org.mcteam.ancientgates.commands.CommandCreate;
-import org.mcteam.ancientgates.commands.CommandCreateSetFrom;
-import org.mcteam.ancientgates.commands.CommandDelete;
-import org.mcteam.ancientgates.commands.CommandHelp;
-import org.mcteam.ancientgates.commands.CommandInfo;
-import org.mcteam.ancientgates.commands.CommandList;
-import org.mcteam.ancientgates.commands.CommandOpen;
-import org.mcteam.ancientgates.commands.CommandRename;
-import org.mcteam.ancientgates.commands.CommandSetFrom;
-import org.mcteam.ancientgates.commands.CommandSetTo;
-
+import org.mcteam.ancientgates.commands.*;
import org.mcteam.ancientgates.gson.Gson;
import org.mcteam.ancientgates.gson.GsonBuilder;
@@ -35,7 +20,8 @@ import org.mcteam.ancientgates.listeners.PluginBlockListener;
import org.mcteam.ancientgates.listeners.PluginPlayerListener;
-public class Plugin extends JavaPlugin {
+public class Plugin extends JavaPlugin
+{
public static Plugin instance;
public PluginPlayerListener playerListener = new PluginPlayerListener();
@@ -52,7 +38,8 @@ public class Plugin extends JavaPlugin {
// Commands
public List commands = new ArrayList();
- public Plugin() {
+ public Plugin()
+ {
instance = this;
}
@@ -87,7 +74,7 @@ public class Plugin extends JavaPlugin {
// Register events
getServer().getPluginManager().registerEvents(this.playerListener, this);
getServer().getPluginManager().registerEvents(this.blockListener, this);
-
+
log("Enabled");
}
@@ -108,8 +95,7 @@ public class Plugin extends JavaPlugin {
if (this.baseCommand != null) {
return this.baseCommand;
}
-
- Map Commands = (Map)this.getDescription().getCommands();
+ Map> Commands = (Map>) this.getDescription().getCommands();
this.baseCommand = Commands.keySet().iterator().next();
return this.baseCommand;
}
diff --git a/src/org/mcteam/ancientgates/commands/CommandSetFrom.java b/src/org/mcteam/ancientgates/commands/CommandSetFrom.java
index fd88f4d..684239c 100644
--- a/src/org/mcteam/ancientgates/commands/CommandSetFrom.java
+++ b/src/org/mcteam/ancientgates/commands/CommandSetFrom.java
@@ -31,7 +31,7 @@ public class CommandSetFrom extends BaseCommand {
player.getLocation().getZ(),
player.getLocation().getYaw(),
player.getLocation().getPitch());
-
+
Set gateBlocks = FloodUtil.getGateFrameBlocks(player.getLocation().getBlock());
if (gateBlocks == null) {
sendMessage("There is no portal here, or your portal is too large.\nMax size is: " + Conf.getGateMaxArea() + " Blocks.");
@@ -48,12 +48,12 @@ public class CommandSetFrom extends BaseCommand {
sendMessage("There is not enough room for a gate to open here");
return;
}
-
+
sendMessage("From location for gate \""+gate.getId()+"\" is now where you stand.");
sendMessage("Your gate includes " + gateBlocks.size() + " Blocks.");
-
+
Gate.save();
}
diff --git a/src/org/mcteam/ancientgates/listeners/PluginBlockListener.java b/src/org/mcteam/ancientgates/listeners/PluginBlockListener.java
index 7fd4386..8910c9b 100644
--- a/src/org/mcteam/ancientgates/listeners/PluginBlockListener.java
+++ b/src/org/mcteam/ancientgates/listeners/PluginBlockListener.java
@@ -1,54 +1,47 @@
package org.mcteam.ancientgates.listeners;
import org.bukkit.Material;
-
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
-
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPhysicsEvent;
-import org.bukkit.event.EventHandler;
public class PluginBlockListener implements Listener
{
- @EventHandler
+ @EventHandler(priority = EventPriority.NORMAL)
public void onBlockPhysics(BlockPhysicsEvent event)
{
if (event.isCancelled())
return;
-
- if (event.getBlock().getType() != Material.PORTAL)
+ if (event.getBlock().getType() != Material.PORTAL) {
return;
+ }
-
- if (isBlockInPortal(event.getBlock()))
+ if (isBlockInPortal(event.getBlock())) {
event.setCancelled(true);
-
+ }
}
-
public boolean isBlockInPortal(Block block)
{
if (block.getRelative(BlockFace.UP).getType() == Material.AIR)
return false;
-
if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
return false;
-
if ( block.getRelative(BlockFace.NORTH).getType() != Material.AIR && block.getRelative(BlockFace.SOUTH).getType() != Material.AIR )
return true;
-
if ( block.getRelative(BlockFace.WEST).getType() != Material.AIR && block.getRelative(BlockFace.EAST).getType() != Material.AIR )
return true;
-
return false;
}
}
diff --git a/src/org/mcteam/ancientgates/listeners/PluginPlayerListener.java b/src/org/mcteam/ancientgates/listeners/PluginPlayerListener.java
index 2355447..0467bc4 100644
--- a/src/org/mcteam/ancientgates/listeners/PluginPlayerListener.java
+++ b/src/org/mcteam/ancientgates/listeners/PluginPlayerListener.java
@@ -9,8 +9,8 @@ import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
-
import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
@@ -20,12 +20,13 @@ import org.mcteam.ancientgates.Plugin;
import org.mcteam.ancientgates.util.GeometryUtil;
-public class PluginPlayerListener implements Listener
-{
- @EventHandler
+public class PluginPlayerListener implements Listener
+{
+
+ @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerMove(PlayerMoveEvent event)
{
- if (event.isCancelled())
+ if (event.isCancelled())
return;
Block blockTo = event.getTo().getBlock();
@@ -33,11 +34,9 @@ public class PluginPlayerListener implements Listener
// Check if player is standing inside a portal
- if (blockTo.getType() != Material.PORTAL && blockToUp.getType() != Material.PORTAL)
- {
+ if (blockTo.getType() != Material.PORTAL && blockToUp.getType() != Material.PORTAL)
return;
- }
-
+
// Ok so a player walks into a portal block
// Find the nearest gate!
@@ -71,14 +70,14 @@ public class PluginPlayerListener implements Listener
{
nearestGate = gate;
break;
- }
+ }
}
-
+
/*if (shortestDistance == -1 || shortestDistance > distance) {
nearestGate = gate;
shortestDistance = distance;
}*/
- }
+ }
if (nearestGate != null)
{
diff --git a/src/org/mcteam/ancientgates/util/FloodUtil.java b/src/org/mcteam/ancientgates/util/FloodUtil.java
index 5d89798..92523b2 100644
--- a/src/org/mcteam/ancientgates/util/FloodUtil.java
+++ b/src/org/mcteam/ancientgates/util/FloodUtil.java
@@ -47,7 +47,7 @@ public class FloodUtil {
if (blocks1.size() > blocks2.size()) {
return blocks2;
}
-
+
return blocks1;
}
@@ -55,11 +55,11 @@ public class FloodUtil {
{
if (foundBlocks == null)
return null;
-
+
if (foundBlocks.size() > limit)
{
Plugin.log(Level.ALL, "exceeding gate size limit.");
- return null;
+ return null;
}
if (foundBlocks.contains(startBlock))
@@ -77,7 +77,7 @@ public class FloodUtil {
foundBlocks = getAirFloodBlocks(potentialBlock, foundBlocks, expandFaces, limit);
}
}
-
+
return foundBlocks;
}