Entity#addPassenger() does not function as intended.
With a small plugin setup I arranged, I implemented the "PlayerInteractEntityEvent" with simple methods of setting the event#getRightClicked method as the passenger of the event#getPlayer() method.
Here is the code for any questions:
package me.coderky.spigotbug; import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.plugin.java.JavaPlugin; public final class SpigotBug extends JavaPlugin implements Listener { @Override public void onEnable() { // Plugin startup logic getServer().getPluginManager().registerEvents(this, this); } @Override public void onDisable() { // Plugin shutdown logic } @EventHandler public void onInteract(PlayerInteractEntityEvent event) { event.getPlayer().addPassenger(event.getRightClicked()); Bukkit.broadcastMessage(event.getPlayer().addPassenger(event.getRightClicked())+""); event.getPlayer().sendMessage("Added Passenger: " + event.getRightClicked().getName()); } }
This method originally states:
Here is the output of my results from the code listed below:
Before I mention anything else, I'd like to state that there are no error stacktraces within my server's console.
As you can see, event#getRightClicked() works as intended; however, the entity clicked does not get stacked onto the vehicle (The player) instead, the passenger becomes completely frozen not being able to move or be pushed when walking into it's hit box.
This bug i cannot replicate in normal minecraft. Running the command:
/summon cow ~ ~1 ~ {Passengers:[{id:wolf}]}
Allows me to summon a normal cow with a wolf as a passenger normally