From 147a3e4c26646011a494cdf360685f38e08d9456 Mon Sep 17 00:00:00 2001 From: fullwall Date: Fri, 9 Mar 2018 21:13:05 +0800 Subject: [PATCH] Fix TeleportWaypointTrigger --- .../trait/waypoint/triggers/TeleportTrigger.java | 8 ++++---- .../trait/waypoint/triggers/TeleportTriggerPrompt.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/trait/waypoint/triggers/TeleportTrigger.java b/main/src/main/java/net/citizensnpcs/trait/waypoint/triggers/TeleportTrigger.java index babb64599..cd3f8cbbc 100644 --- a/main/src/main/java/net/citizensnpcs/trait/waypoint/triggers/TeleportTrigger.java +++ b/main/src/main/java/net/citizensnpcs/trait/waypoint/triggers/TeleportTrigger.java @@ -1,11 +1,11 @@ package net.citizensnpcs.trait.waypoint.triggers; -import net.citizensnpcs.api.npc.NPC; -import net.citizensnpcs.api.persistence.Persist; - import org.bukkit.Location; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.api.persistence.Persist; + public class TeleportTrigger implements WaypointTrigger { @Persist(required = true) private Location location; @@ -26,7 +26,7 @@ public class TeleportTrigger implements WaypointTrigger { @Override public void onWaypointReached(NPC npc, Location waypoint) { if (location != null) { - npc.teleport(waypoint, TeleportCause.PLUGIN); + npc.teleport(location, TeleportCause.PLUGIN); } } } diff --git a/main/src/main/java/net/citizensnpcs/trait/waypoint/triggers/TeleportTriggerPrompt.java b/main/src/main/java/net/citizensnpcs/trait/waypoint/triggers/TeleportTriggerPrompt.java index d0e128bbb..c7779d6b0 100644 --- a/main/src/main/java/net/citizensnpcs/trait/waypoint/triggers/TeleportTriggerPrompt.java +++ b/main/src/main/java/net/citizensnpcs/trait/waypoint/triggers/TeleportTriggerPrompt.java @@ -2,9 +2,6 @@ package net.citizensnpcs.trait.waypoint.triggers; import java.util.regex.Pattern; -import net.citizensnpcs.api.util.Messaging; -import net.citizensnpcs.util.Messages; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; @@ -17,6 +14,9 @@ import org.bukkit.entity.Player; import com.google.common.base.Splitter; import com.google.common.collect.Iterables; +import net.citizensnpcs.api.util.Messaging; +import net.citizensnpcs.util.Messages; + public class TeleportTriggerPrompt extends RegexPrompt implements WaypointTriggerPrompt { public TeleportTriggerPrompt() { super(PATTERN); @@ -33,7 +33,7 @@ public class TeleportTriggerPrompt extends RegexPrompt implements WaypointTrigge new TeleportTrigger(player.getLocation())); return (Prompt) context.getSessionData(WaypointTriggerPrompt.RETURN_PROMPT_KEY); } - String[] parts = Iterables.toArray(Splitter.on(':').split(input), String.class); + String[] parts = Iterables.toArray(Splitter.on(':').omitEmptyStrings().split(input), String.class); String worldName = parts[0]; World world = Bukkit.getWorld(worldName); if (world == null) {