Fix NPE, add MountTrait, fix 1.10 looking

This commit is contained in:
fullwall 2016-11-26 11:28:29 +08:00
parent 2bd712434d
commit deffc24bb7
5 changed files with 7 additions and 4 deletions

View File

@ -22,7 +22,7 @@ public class AdminCommands {
}
@Command(aliases = { "citizens" }, desc = "Show basic plugin information", max = 0, permission = "citizens.admin")
public void citizens(CommandContext args, CommandSender sender, NPC npc) {
public void citizens(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
Messaging.send(sender,
" " + StringHelper.wrapHeader("<e>Citizens v" + plugin.getDescription().getVersion()));
Messaging.send(sender, " <7>-- <c>Written by fullwall and aPunch");

View File

@ -27,6 +27,7 @@ import net.citizensnpcs.api.trait.Trait;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.trait.ArmorStandTrait;
import net.citizensnpcs.trait.LookClose;
import net.citizensnpcs.trait.MountTrait;
import net.citizensnpcs.util.NMS;
public class CitizensNPCRegistry implements NPCRegistry {
@ -58,6 +59,7 @@ public class CitizensNPCRegistry implements NPCRegistry {
if (Setting.DEFAULT_LOOK_CLOSE.asBoolean()) {
npc.addTrait(LookClose.class);
}
npc.addTrait(MountTrait.class);
return npc;
}

View File

@ -172,7 +172,9 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
@Override
public void stop() {
strategy.stop();
if (strategy != null) {
strategy.stop();
}
}
@Override

View File

@ -29,7 +29,6 @@ public class MountTrait extends Trait {
NMS.mount(other.getEntity(), npc.getEntity());
}
}
if (NMS.getVehicle(npc.getEntity()) instanceof NPCHolder) {
mountedOn = ((NPCHolder) NMS.getVehicle(npc.getEntity())).getNPC().getUniqueId();
}

View File

@ -301,6 +301,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
}
moveOnCurrentHeading();
}
NMSImpl.updateAI(this);
if (noDamageTicks > 0) {
--noDamageTicks;
@ -319,7 +320,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
}
private void moveOnCurrentHeading() {
NMSImpl.updateAI(this);
if (be) {
if (onGround && jumpTicks == 0) {
cl();