Change /npc mount permission, force chunk load on spawning due to chunk load

This commit is contained in:
fullwall 2019-06-12 21:06:06 +08:00
parent 2efdd3fcfe
commit d0b358a27c
3 changed files with 6 additions and 2 deletions

View File

@ -634,7 +634,7 @@ public class EventListen implements Listener {
} }
return false; return false;
} }
return npc.spawn(spawn); return npc.spawn(spawn, SpawnReason.CHUNK_LOAD);
} }
private void storeForRespawn(NPC npc) { private void storeForRespawn(NPC npc) {

View File

@ -954,7 +954,7 @@ public class NPCCommands {
min = 1, min = 1,
max = 1, max = 1,
flags = "c", flags = "c",
permission = "citizens.npc.controllable") permission = "citizens.npc.mount")
public void mount(CommandContext args, CommandSender sender, NPC npc) throws CommandException { public void mount(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
if (args.hasValueFlag("onnpc")) { if (args.hasValueFlag("onnpc")) {
NPC mount; NPC mount;

View File

@ -226,6 +226,10 @@ public class CitizensNPC extends AbstractNPC {
at = at.clone(); at = at.clone();
if (reason == SpawnReason.CHUNK_LOAD) {
at.getChunk().load();
}
getTrait(CurrentLocation.class).setLocation(at); getTrait(CurrentLocation.class).setLocation(at);
entityController.spawn(at, this); entityController.spawn(at, this);