mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 19:16:34 +01:00
Set player position before and after
This commit is contained in:
parent
fd51c577ce
commit
d0d2f0fc1f
@ -185,6 +185,7 @@ public class CitizensNPC extends AbstractNPC {
|
||||
entityController.spawn(at, this);
|
||||
EntityLiving mcEntity = ((CraftLivingEntity) getBukkitEntity()).getHandle();
|
||||
boolean couldSpawn = !Util.isLoaded(at) ? false : mcEntity.world.addEntity(mcEntity, SpawnReason.CUSTOM);
|
||||
mcEntity.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getYaw(), at.getPitch());
|
||||
if (!couldSpawn) {
|
||||
Messaging.debug("Retrying spawn of", getId(), "later due to chunk being unloaded.");
|
||||
// we need to wait for a chunk load before trying to spawn
|
||||
|
@ -45,8 +45,6 @@ public abstract class MobEntityController extends AbstractEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<Class<?>, Constructor<?>> CONSTRUCTOR_CACHE = Maps.newHashMap();
|
||||
|
||||
private static Constructor<?> getConstructor(Class<?> clazz) {
|
||||
Constructor<?> constructor = CONSTRUCTOR_CACHE.get(clazz);
|
||||
if (constructor != null)
|
||||
@ -57,4 +55,6 @@ public abstract class MobEntityController extends AbstractEntityController {
|
||||
throw new IllegalStateException("unable to find an entity constructor");
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<Class<?>, Constructor<?>> CONSTRUCTOR_CACHE = Maps.newHashMap();
|
||||
}
|
@ -21,6 +21,7 @@ public class HumanController extends AbstractEntityController {
|
||||
World ws = ((CraftWorld) at.getWorld()).getHandle();
|
||||
final EntityHumanNPC handle = new EntityHumanNPC(ws.getServer().getServer(), ws, Colorizer.parseColors(npc
|
||||
.getFullName()), new PlayerInteractManager(ws), npc);
|
||||
handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getYaw(), at.getPitch());
|
||||
handle.getBukkitEntity().teleport(at);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user