Makes the CraftBook remove on eject fix optional
This commit is contained in:
parent
8643a44df6
commit
497551d889
@ -50,6 +50,9 @@ public enum ConfigOption {
|
||||
*/
|
||||
HIGHLIGHT_SIGN_COLOR("gates.cosmetic.highlightSignColor", "The text color used for highlighting stargate signs", "WHITE"),
|
||||
|
||||
/**
|
||||
* The colors to use for each type of sign
|
||||
*/
|
||||
PER_SIGN_COLORS("gates.cosmetic.perSignColors", "The per-sign color specification", new String[]{
|
||||
"'ACACIA:default,default'", "'BIRCH:default,default'", "'CRIMSON:inverted,inverted'", "'DARK_OAK:inverted,inverted'",
|
||||
"'JUNGLE:default,default'", "'OAK:default,default'", "'SPRUCE:inverted,inverted'", "'WARPED:inverted,inverted'"}),
|
||||
@ -102,6 +105,13 @@ public enum ConfigOption {
|
||||
HANDLE_LEASHED_CREATURES("gates.functionality.handleLeashedCreatures",
|
||||
"Whether to enable players to teleport a creature on a leash", true),
|
||||
|
||||
/**
|
||||
* Whether to enable a fix that makes teleportation of minecarts/boats work even with craftbook's vehicle removal
|
||||
*/
|
||||
ENABLE_CRAFT_BOOK_REMOVE_ON_EJECT_FIX("gates.functionality.enableCraftBookRemoveOnEjectFix",
|
||||
"Whether to enable a fix that causes loss of NBT data, but allows vehicle teleportation to work " +
|
||||
"when CraftBook's remove minecart/boat on eject setting is enabled", false),
|
||||
|
||||
/**
|
||||
* Whether to enable economy support for taking payment from players creating/destroying/using stargates
|
||||
*/
|
||||
|
@ -125,6 +125,17 @@ public final class StargateGateConfig {
|
||||
return (boolean) configOptions.get(ConfigOption.HANDLE_LEASHED_CREATURES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the CraftBook vehicle removal fix is enabled
|
||||
*
|
||||
* <p>If enabled, minecarts and boats should be re-created instead of teleported.</p>
|
||||
*
|
||||
* @return <p>True if the CraftBook vehicle removal fix is enabled</p>
|
||||
*/
|
||||
public boolean enableCraftBookRemoveOnEjectFix() {
|
||||
return (boolean) configOptions.get(ConfigOption.ENABLE_CRAFT_BOOK_REMOVE_ON_EJECT_FIX);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the list of destinations within a network should be sorted
|
||||
*
|
||||
|
@ -81,12 +81,13 @@ public class VehicleTeleporter extends EntityTeleporter {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(teleportingVehicle instanceof LivingEntity)) {
|
||||
if (!(teleportingVehicle instanceof LivingEntity) &&
|
||||
Stargate.getGateConfig().enableCraftBookRemoveOnEjectFix()) {
|
||||
//Teleport a normal vehicle with passengers (minecart or boat)
|
||||
putPassengersInNewVehicle(passengers, exit, newVelocity, origin);
|
||||
} else {
|
||||
//Teleport a living vehicle with passengers (pig, horse, donkey, strider)
|
||||
teleportLivingVehicle(exit, passengers, origin);
|
||||
teleportVehicle(passengers, exit, newVelocity, origin);
|
||||
}
|
||||
} else {
|
||||
//Check if teleportation of empty vehicles is enabled
|
||||
@ -120,15 +121,18 @@ public class VehicleTeleporter extends EntityTeleporter {
|
||||
/**
|
||||
* Teleport a vehicle which is not a minecart or a boat
|
||||
*
|
||||
* @param exit <p>The location the vehicle will exit</p>
|
||||
* @param passengers <p>The passengers of the vehicle</p>
|
||||
* @param origin <p>The portal the vehicle teleported from</p>
|
||||
* @param passengers <p>The passengers of the vehicle</p>
|
||||
* @param exit <p>The location the vehicle will exit</p>
|
||||
* @param newVelocity <p>The new velocity of the teleported vehicle</p>
|
||||
* @param origin <p>The portal the vehicle teleported from</p>
|
||||
*/
|
||||
private void teleportLivingVehicle(Location exit, List<Entity> passengers, Portal origin) {
|
||||
private void teleportVehicle(List<Entity> passengers, Location exit, Vector newVelocity, Portal origin) {
|
||||
if (teleportingVehicle.eject()) {
|
||||
TeleportHelper.handleEntityPassengers(passengers, teleportingVehicle, origin, portal, exit.getDirection());
|
||||
}
|
||||
teleportingVehicle.teleport(exit);
|
||||
scheduler.scheduleSyncDelayedTask(Stargate.getInstance(),
|
||||
() -> teleportingVehicle.setVelocity(newVelocity), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,6 +54,8 @@ gates:
|
||||
handleNonPlayerVehicles: true
|
||||
# handleLeashedCreatures - Whether to allow creatures lead by a player to teleport with the player
|
||||
handleLeashedCreatures: true
|
||||
# enableCraftBookRemoveOnEjectFix - Whether to enable a fix that causes loss of NBT data, but allows vehicle teleportation to work when CraftBook's remove minecart/boat on eject setting is enabled
|
||||
enableCraftBookRemoveOnEjectFix: false
|
||||
|
||||
# I------------I-------------I #
|
||||
# stargate economy options #
|
||||
|
Loading…
Reference in New Issue
Block a user