Makes boats keep their boat type when teleported using the CraftBook fix
Some checks failed
EpicKnarvik97/Stargate/pipeline/head There was a failure building this commit

This commit is contained in:
Kristian Knarvik 2022-02-08 19:00:44 +01:00
parent 99bceb9165
commit 28d84450fb
2 changed files with 5 additions and 0 deletions

View File

@ -407,6 +407,7 @@ portalInfoServer=Server: %server%
- Teleports boats/minecarts like other vehicles unless *enableCraftBookRemoveOnEjectFix* is enabled
- Adds the *waitForPlayerAfterTeleportDelay* config option which allows changing the delay between vehicle teleportation
and the player being teleported to the vehicle
- Makes boats keep their wood type even when re-created
#### \[Version 0.9.3.3] EpicKnarvik97 fork

View File

@ -8,6 +8,7 @@ import net.knarcraft.stargate.utility.DirectionHelper;
import net.knarcraft.stargate.utility.TeleportHelper;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Vehicle;
@ -156,6 +157,9 @@ public class VehicleTeleporter extends EntityTeleporter {
}
//Spawn a new vehicle
Vehicle newVehicle = vehicleWorld.spawn(exit, teleportingVehicle.getClass());
if (teleportingVehicle instanceof Boat boat) {
((Boat) newVehicle).setWoodType(boat.getWoodType());
}
//Remove the old vehicle
if (teleportingVehicle.eject()) {
TeleportHelper.handleEntityPassengers(passengers, newVehicle, origin, portal, exit.getDirection());