Armor Stand Passenger


I’m trying to add an armor stand to a player using the Player addPassenger(Entity) method. How can I create an Armor Stand Entity, then add it as a passenger?


Check out the Sponge Docs for more information on spawning entities.

To add it as a passenger, use player.offer(Keys.PASSENGERS, Collections.singletonList(armorStand.getId()).

You may also want to check if the player already has anything riding them (unlikely, but possible with plugins). You can get a list of UUID objects pointing to the entities with player.get(Keys.PASSENGERS).get(). You can then convert each of those UUIDs back to their entity with World.getEntity(uuid).get().