diff --git a/Resources/plugin.yml b/Resources/plugin.yml index b619aa6..82d6770 100644 --- a/Resources/plugin.yml +++ b/Resources/plugin.yml @@ -1,6 +1,6 @@ main: com.sekwah.advancedportals.AdvancedPortalsPlugin name: AdvancedPortals -version: 0.0.21 +version: 0.0.22 author: sekwah41 description: An advanced portals plugin for bukkit. commands: diff --git a/pom.xml b/pom.xml index 64240f5..c8a2f49 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - 0.0.21-snapshot + 0.0.22-snapshot UTF-8 1.7 diff --git a/src/com/sekwah/advancedportals/portals/Portal.java b/src/com/sekwah/advancedportals/portals/Portal.java index 41b38e1..cc5ee57 100644 --- a/src/com/sekwah/advancedportals/portals/Portal.java +++ b/src/com/sekwah/advancedportals/portals/Portal.java @@ -385,6 +385,32 @@ public class Portal { cooldown.put(player, System.currentTimeMillis()); boolean showFailMessage = true; + //plugin.getLogger().info(portal.portalName + ":" + portal.destiation); + boolean warped = false; + if (portal.bungee != null) { + if (ShowBungeeMessage) { + player.sendMessage(PluginMessages.customPrefix + "\u00A7a Attempting to warp to \u00A7e" + portal.bungee + "\u00A7a."); + } + ByteArrayDataOutput out = ByteStreams.newDataOutput(); + out.writeUTF("Connect"); + out.writeUTF(portal.bungee); + player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray()); + // Down to bungee to sort out the teleporting but yea theoretically they should warp. + } + else if (portal.destiation != null) { + ConfigAccessor configDesti = new ConfigAccessor(plugin, "destinations.yml"); + if (configDesti.getConfig().getString(portal.destiation + ".world") != null) { + warped = Destination.warp(player, portal.destiation); + } + } else { + if (showFailMessage) { + player.sendMessage(PluginMessages.customPrefix + "\u00A7c The portal you are trying to use doesn't have a destination!"); + plugin.getLogger().log(Level.SEVERE, "The portal '" + portal.portalName + "' has just had a warp " + + "attempt and either the data is corrupt or portal doesn't exist!"); + throwPlayerBack(player); + } + } + if (portal.getArg("command.1") != null) { showFailMessage = false; int commandLine = 1; @@ -426,32 +452,8 @@ public class Portal { command = portal.getArg("command." + ++commandLine); } while (command != null); } - //plugin.getLogger().info(portal.portalName + ":" + portal.destiation); - if (portal.bungee != null) { - if (ShowBungeeMessage) { - player.sendMessage(PluginMessages.customPrefix + "\u00A7a Attempting to warp to \u00A7e" + portal.bungee + "\u00A7a."); - } - ByteArrayDataOutput out = ByteStreams.newDataOutput(); - out.writeUTF("Connect"); - out.writeUTF(portal.bungee); - player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray()); - // Down to bungee to sort out the teleporting but yea theoretically they should warp. - } - else if (portal.destiation != null) { - ConfigAccessor configDesti = new ConfigAccessor(plugin, "destinations.yml"); - if (configDesti.getConfig().getString(portal.destiation + ".world") != null) { - boolean warped = Destination.warp(player, portal.destiation); - return warped; - } - } else { - if (showFailMessage) { - player.sendMessage(PluginMessages.customPrefix + "\u00A7c The portal you are trying to use doesn't have a destination!"); - plugin.getLogger().log(Level.SEVERE, "The portal '" + portal.portalName + "' has just had a warp " - + "attempt and either the data is corrupt or portal doesn't exist!"); - throwPlayerBack(player); - } - } - return false; + + return warped; } public static void rename(String oldName, String newName) {