CyberdyneCC / Thermos

(NO LONGER DEVELOPED) Minecraft Forge Server Software implementing the Spigot/Bukkit API, formerly known as Cauldron/MCPC
http://cyberdynecc.github.io/Thermos/
GNU General Public License v3.0
258 stars 186 forks source link

Request - Bukkit Vehicle class doesnt support multiple passengers #505

Closed StargateMC closed 7 years ago

StargateMC commented 7 years ago

You will receive NO SUPPORT if you do not follow the template below. (Vous ne receverez pas aucune aide si vous effacer ce modèle)

Explanation of issue:

Using the Bukkit Vehicle Entity on a modded server makes it impossible to properly support those vehicles which have multiple passengers.

This is a request to add the following methods (and their backend) if possible.

vehicle.addPassenger(Entity e); vehicle.removePassenger(Entity e); List< Entity > vehicle.getPassengers();

To be clear I am not suggesting we change anything relating to the existing class...... just adding stuff :) So old plugins will use the old methods.

How to recreate this issue:

NA

Modpack Name: _(Only if public)_NA

Mods Installed:NA

Plugins Installed:NA

Warmroast Report: (Optional) NA

Thermos Version: B58

Forge Version: 1614

sameer commented 7 years ago

Are these methods available in spigot or any other related API?

StargateMC commented 7 years ago

These are not required in spigot or Bukkit, there are no multi seat vehicles I'm aware of? I'm trying to fix a plugin that handles user teleportation to take the vehicle they are in if they use it and noticed if they have a passenger they're not teleported with them.. And in Bukkit it seems you can't add multiple people back into the vehicle.

StargateMC commented 7 years ago

Nevermind.. this can be achieved...

        if (e.getPlayer().isInsideVehicle()) {
            List<Entity> entitiesToTransport = new ArrayList<Entity>();
            Entity vehicle = e.getPlayer().getVehicle();
            for (Entity entityToTransport : vehicle.getNearbyEntities(10.0, 10.0, 10.0)) {
                if (entityToTransport.isInsideVehicle() && entityToTransport.getVehicle().equals(vehicle)) {
                    entitiesToTransport.add(entityToTransport);
                }
            }
            vehicle.eject();
            vehicle.teleport(loc, TeleportCause.PLUGIN);
            for (Entity teleportingEntity : entitiesToTransport) {
                teleportingEntity.teleport(loc, TeleportCause.PLUGIN);
                vehicle.setPassenger(teleportingEntity);
            }
            e.setCancelled(true);
        } else {
            e.setTo(loc);
        }