Fix location missing bug... and bats

This commit is contained in:
fullwall 2012-10-30 08:59:52 +08:00
parent cb578bd677
commit c519cde217
4 changed files with 8 additions and 5 deletions

View File

@ -112,7 +112,8 @@ public class CitizensBatNPC extends CitizensMobNPC {
@Override @Override
public void j_() { public void j_() {
super.j_(); super.j_();
npc.update(); if (npc != null)
npc.update();
} }
} }
} }

View File

@ -143,7 +143,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
if (inLiquid) { if (inLiquid) {
motY += 0.04; motY += 0.04;
} else //(handled elsewhere)*/ } else //(handled elsewhere)*/
if (onGround && bW == 0) { if (onGround && Math.abs(bW) < EPSILON) {
bf(); // jump bf(); // jump
bW = 10; bW = 10;
} }

View File

@ -16,6 +16,7 @@ import net.minecraft.server.EntityPlayer;
import org.bukkit.craftbukkit.entity.CraftLivingEntity; import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -102,9 +103,10 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
} }
public boolean mount(Player toMount) { public boolean mount(Player toMount) {
if (npc.getBukkitEntity().getPassenger() != null) Entity passenger = npc.getBukkitEntity().getPassenger();
if (passenger != null && passenger != toMount)
return false; return false;
((CraftPlayer) toMount).getHandle().setPassengerOf(getHandle()); enterOrLeaveVehicle(toMount);
return true; return true;
} }

View File

@ -6,7 +6,7 @@ import net.citizensnpcs.api.trait.Trait;
import org.bukkit.Location; import org.bukkit.Location;
public class CurrentLocation extends Trait { public class CurrentLocation extends Trait {
@Persist(required = true) @Persist(value = "", required = true)
private Location loc; private Location loc;
public CurrentLocation() { public CurrentLocation() {