mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-27 21:29:14 +01:00
Fix CITIZENS-425
This commit is contained in:
parent
1cb9c7b057
commit
da03a3cd26
@ -1051,8 +1051,19 @@ public class NPCCommands {
|
|||||||
// Spawn the NPC if it isn't spawned to prevent NPEs
|
// Spawn the NPC if it isn't spawned to prevent NPEs
|
||||||
if (!npc.isSpawned()) {
|
if (!npc.isSpawned()) {
|
||||||
npc.spawn(args.getSenderLocation());
|
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);
|
npc.getBukkitEntity().teleport(args.getSenderLocation(), TeleportCause.COMMAND);
|
||||||
|
}
|
||||||
Messaging.sendTr(sender, Messages.NPC_TELEPORTED, npc.getName());
|
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_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_SET = "citizens.commands.npc.zombiemod.villager-set";
|
||||||
public static final String ZOMBIE_VILLAGER_UNSET = "citizens.commands.npc.zombiemod.villager-unset";
|
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
Block a user