Fix CITIZENS-425
This commit is contained in:
parent
de8a613170
commit
d1279e269c
|
@ -1051,8 +1051,19 @@ public class NPCCommands {
|
|||
// Spawn the NPC if it isn't spawned to prevent NPEs
|
||||
if (!npc.isSpawned()) {
|
||||
npc.spawn(args.getSenderLocation());
|
||||
} else
|
||||
if (!sender.hasPermission("citizens.npc.tphere.multiworld")
|
||||
&& npc.getBukkitEntity().getLocation().getWorld() != args.getSenderLocation().getWorld()) {
|
||||
npc.despawn();
|
||||
throw new CommandException(Messages.CANNOT_TELEPORT_ACROSS_WORLDS);
|
||||
}
|
||||
} else {
|
||||
if (!sender.hasPermission("citizens.npc.tphere.multiworld")
|
||||
&& npc.getBukkitEntity().getLocation().getWorld() != args.getSenderLocation().getWorld()) {
|
||||
npc.despawn();
|
||||
throw new CommandException(Messages.CANNOT_TELEPORT_ACROSS_WORLDS);
|
||||
}
|
||||
npc.getBukkitEntity().teleport(args.getSenderLocation(), TeleportCause.COMMAND);
|
||||
}
|
||||
Messaging.sendTr(sender, Messages.NPC_TELEPORTED, npc.getName());
|
||||
}
|
||||
|
||||
|
|
|
@ -210,4 +210,5 @@ public class Messages {
|
|||
public static final String ZOMBIE_BABY_UNSET = "citizens.commands.npc.zombiemod.baby-unset";
|
||||
public static final String ZOMBIE_VILLAGER_SET = "citizens.commands.npc.zombiemod.villager-set";
|
||||
public static final String ZOMBIE_VILLAGER_UNSET = "citizens.commands.npc.zombiemod.villager-unset";
|
||||
public static final String CANNOT_TELEPORT_ACROSS_WORLDS = "citizens.commands.npc.tphere.multiworld-not-allowed";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue