mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-02 07:33:44 +01:00
fix command NPE
This commit is contained in:
parent
c89724b391
commit
12a0c3b32a
@ -45,8 +45,6 @@ public class EventListen implements Listener {
|
|||||||
NPC npc = npcManager.getNPC(id);
|
NPC npc = npcManager.getNPC(id);
|
||||||
Location loc = npc.getTrait(SpawnLocation.class).getLocation();
|
Location loc = npc.getTrait(SpawnLocation.class).getLocation();
|
||||||
npc.spawn(loc);
|
npc.spawn(loc);
|
||||||
Messaging.log("Spawned " + npc.getId() + " at " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ()
|
|
||||||
+ " in world " + loc.getWorld().getName());
|
|
||||||
}
|
}
|
||||||
toRespawn.remove(event.getChunk());
|
toRespawn.remove(event.getChunk());
|
||||||
}
|
}
|
||||||
@ -63,8 +61,6 @@ public class EventListen implements Listener {
|
|||||||
Location loc = npc.getBukkitEntity().getLocation();
|
Location loc = npc.getBukkitEntity().getLocation();
|
||||||
if (event.getWorld().equals(loc.getWorld()) && event.getChunk().getX() == loc.getChunk().getX()
|
if (event.getWorld().equals(loc.getWorld()) && event.getChunk().getX() == loc.getChunk().getX()
|
||||||
&& event.getChunk().getZ() == loc.getChunk().getZ()) {
|
&& event.getChunk().getZ() == loc.getChunk().getZ()) {
|
||||||
Messaging.log("Despawned " + npc.getId() + " at " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ()
|
|
||||||
+ " in world " + loc.getWorld().getName());
|
|
||||||
npc.getTrait(SpawnLocation.class).setLocation(loc);
|
npc.getTrait(SpawnLocation.class).setLocation(loc);
|
||||||
npc.despawn();
|
npc.despawn();
|
||||||
respawn.add(npc.getId());
|
respawn.add(npc.getId());
|
||||||
|
@ -38,8 +38,8 @@ public class NPCCommands {
|
|||||||
public void showInfo(CommandContext args, Player player, NPC npc) {
|
public void showInfo(CommandContext args, Player player, NPC npc) {
|
||||||
Messaging.send(player, StringHelper.wrapHeader(npc.getName()));
|
Messaging.send(player, StringHelper.wrapHeader(npc.getName()));
|
||||||
Messaging.send(player, " <a>ID: <e>" + npc.getId());
|
Messaging.send(player, " <a>ID: <e>" + npc.getId());
|
||||||
Messaging.send(player, " <a>Character: <e>" + npc.getCharacter() != null ? npc.getCharacter().getName()
|
Messaging.send(player, " <a>Character: <e>" + (npc.getCharacter() != null ? npc.getCharacter().getName()
|
||||||
: "None");
|
: "None"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
|
Loading…
Reference in New Issue
Block a user