mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 04:35:50 +01:00
Fix TeleportWaypointTrigger
This commit is contained in:
parent
d7237dff4e
commit
147a3e4c26
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user