Solved mounted entity disappearing when player disconnects

Discussion in 'Spigot Plugin Development' started by xlis1, May 30, 2017.

  1. as the title implys i have a plugin that allows players to sit on armorstands with a certain name, however im having an issue where, if they disconnect while on said armourstand it takes the armorstand with them.

    i tried ejecting them on quit but that dient work.

    Code (Text):
    @EventHandler
        public void onQuit(final PlayerQuitEvent event) {
            Player player = event.getPlayer();
            if (player.isInsideVehicle()) {
                player.eject();
            }
        }

    any other ideas on how to stop this?
     
  2. Code (Java):
    player.getVehicle().eject();
    At the moment you're removing the entity which is riding the player, but you wan't to remove the entity riding the armorstand so you should probably do it like this. Unfortunately I can't test it right now, but loet me know if it worked.