diff --git a/AncientGates.jar b/AncientGates.jar deleted file mode 100644 index d023c83..0000000 Binary files a/AncientGates.jar and /dev/null differ 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 84f7322..a8bd868 100644 --- a/src/org/mcteam/ancientgates/MyLocationTypeAdapter.java +++ b/src/org/mcteam/ancientgates/MyLocationTypeAdapter.java @@ -5,6 +5,7 @@ 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,7 +64,7 @@ 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(name, Environment.NORMAL); + 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 31c05c1..d79341c 100644 --- a/src/org/mcteam/ancientgates/Plugin.java +++ b/src/org/mcteam/ancientgates/Plugin.java @@ -75,8 +75,8 @@ public class Plugin extends JavaPlugin { // Register events PluginManager pm = this.getServer().getPluginManager(); - pm.registerEvent(Event.Type.PLAYER_MOVE, this.playerListener, Event.Priority.Normal, this); - pm.registerEvent(Event.Type.BLOCK_PHYSICS, this.blockListener, Event.Priority.Normal, this); + pm.registerEvents(this.playerListener, this); + pm.registerEvents(this.blockListener, this); log("Enabled"); } @@ -98,8 +98,7 @@ public class Plugin extends JavaPlugin { if (this.baseCommand != null) { return this.baseCommand; } - - Map Commands = (Map)this.getDescription().getCommands(); + Map> Commands = 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 16b8877..1096d4b 100644 --- a/src/org/mcteam/ancientgates/commands/CommandSetFrom.java +++ b/src/org/mcteam/ancientgates/commands/CommandSetFrom.java @@ -19,7 +19,7 @@ public class CommandSetFrom extends BaseCommand { // The player might stand in a halfblock or a sign or whatever // Therefore we load som extra locations and blocks Block playerBlock = player.getLocation().getBlock(); - Block upBlock = playerBlock.getFace(BlockFace.UP); + Block upBlock = playerBlock.getRelative(BlockFace.UP); if (playerBlock.getType() == Material.AIR) { gate.setFrom(playerBlock.getLocation()); diff --git a/src/org/mcteam/ancientgates/listeners/PluginBlockListener.java b/src/org/mcteam/ancientgates/listeners/PluginBlockListener.java index f56d931..892ffb9 100644 --- a/src/org/mcteam/ancientgates/listeners/PluginBlockListener.java +++ b/src/org/mcteam/ancientgates/listeners/PluginBlockListener.java @@ -3,11 +3,14 @@ package org.mcteam.ancientgates.listeners; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.event.block.BlockListener; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPhysicsEvent; -public class PluginBlockListener extends BlockListener { - @Override +public class PluginBlockListener implements Listener { + + @EventHandler(priority = EventPriority.NORMAL) public void onBlockPhysics(BlockPhysicsEvent event) { if (event.isCancelled()) { return; @@ -23,19 +26,19 @@ public class PluginBlockListener extends BlockListener { } public boolean isBlockInPortal(Block block) { - if (block.getFace(BlockFace.UP).getType() == Material.AIR) { + if (block.getRelative(BlockFace.UP).getType() == Material.AIR) { return false; } - if (block.getFace(BlockFace.DOWN).getType() == Material.AIR) { + if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR) { return false; } - if ( block.getFace(BlockFace.NORTH).getType() != Material.AIR && block.getFace(BlockFace.SOUTH).getType() != Material.AIR ) { + if ( block.getRelative(BlockFace.NORTH).getType() != Material.AIR && block.getRelative(BlockFace.SOUTH).getType() != Material.AIR ) { return true; } - if ( block.getFace(BlockFace.WEST).getType() != Material.AIR && block.getFace(BlockFace.EAST).getType() != Material.AIR ) { + if ( block.getRelative(BlockFace.WEST).getType() != Material.AIR && block.getRelative(BlockFace.EAST).getType() != Material.AIR ) { return true; } diff --git a/src/org/mcteam/ancientgates/listeners/PluginPlayerListener.java b/src/org/mcteam/ancientgates/listeners/PluginPlayerListener.java index 675d884..7a88ac2 100644 --- a/src/org/mcteam/ancientgates/listeners/PluginPlayerListener.java +++ b/src/org/mcteam/ancientgates/listeners/PluginPlayerListener.java @@ -8,7 +8,9 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.event.player.PlayerListener; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerMoveEvent; import org.mcteam.ancientgates.Conf; import org.mcteam.ancientgates.Gate; @@ -16,15 +18,16 @@ import org.mcteam.ancientgates.Plugin; import org.mcteam.ancientgates.util.GeometryUtil; -public class PluginPlayerListener extends PlayerListener { - @Override +public class PluginPlayerListener implements Listener { + + @EventHandler(priority = EventPriority.NORMAL) public void onPlayerMove(PlayerMoveEvent event) { if (event.isCancelled()) { return; } Block blockTo = event.getTo().getBlock(); - Block blockToUp = blockTo.getFace(BlockFace.UP); + Block blockToUp = blockTo.getRelative(BlockFace.UP); if (blockTo.getType() != Material.PORTAL && blockToUp.getType() != Material.PORTAL) { return; diff --git a/src/org/mcteam/ancientgates/util/FloodUtil.java b/src/org/mcteam/ancientgates/util/FloodUtil.java index 0575c8b..95f06ec 100644 --- a/src/org/mcteam/ancientgates/util/FloodUtil.java +++ b/src/org/mcteam/ancientgates/util/FloodUtil.java @@ -68,7 +68,7 @@ public class FloodUtil { // ... And flood away ! for (BlockFace face : expandFaces) { - Block potentialBlock = startBlock.getFace(face); + Block potentialBlock = startBlock.getRelative(face); foundBlocks = getAirFloodBlocks(potentialBlock, foundBlocks, expandFaces, limit); } }