Makes the delay to prevent client errors configurable
This commit is contained in:
		@@ -112,6 +112,13 @@ public enum ConfigOption {
 | 
			
		||||
            "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),
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The delay between teleporting a vehicle and adding the player as passenger
 | 
			
		||||
     */
 | 
			
		||||
    WAIT_FOR_PLAYER_AFTER_TELEPORT_DELAY("advanced.waitForPlayerAfterTeleportDelay",
 | 
			
		||||
            "The amount of ticks to wait before adding a player as passenger of a vehicle. On slow servers, " +
 | 
			
		||||
                    "a value of 6 is required to avoid client glitches after teleporting on a vehicle.", 1),
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Whether to enable economy support for taking payment from players creating/destroying/using stargates
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -136,6 +136,15 @@ public final class StargateGateConfig {
 | 
			
		||||
        return (boolean) configOptions.get(ConfigOption.ENABLE_CRAFT_BOOK_REMOVE_ON_EJECT_FIX);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the delay to use before adding a player as passenger of a teleported vehicle
 | 
			
		||||
     *
 | 
			
		||||
     * @return <p>The delay to use before adding a player as passenger of a teleported vehicle</p>
 | 
			
		||||
     */
 | 
			
		||||
    public int waitForPlayerAfterTeleportDelay() {
 | 
			
		||||
        return (int) configOptions.get(ConfigOption.WAIT_FOR_PLAYER_AFTER_TELEPORT_DELAY);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets whether the list of destinations within a network should be sorted
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -115,7 +115,7 @@ public final class TeleportHelper {
 | 
			
		||||
                    teleportLeashedCreatures(player, origin, target);
 | 
			
		||||
                }
 | 
			
		||||
                TeleportHelper.teleportAndAddPassenger(entity, passenger, exitRotation);
 | 
			
		||||
            }, passenger instanceof Player ? 6 : 0);
 | 
			
		||||
            }, passenger instanceof Player ? Stargate.getGateConfig().waitForPlayerAfterTeleportDelay() : 0);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -144,7 +144,8 @@ public final class TeleportHelper {
 | 
			
		||||
            creature.setLeashHolder(null);
 | 
			
		||||
            scheduler.scheduleSyncDelayedTask(Stargate.getInstance(), () -> {
 | 
			
		||||
                new EntityTeleporter(target, creature).teleportEntity(origin);
 | 
			
		||||
                scheduler.scheduleSyncDelayedTask(Stargate.getInstance(), () -> creature.setLeashHolder(player), 6);
 | 
			
		||||
                scheduler.scheduleSyncDelayedTask(Stargate.getInstance(), () -> creature.setLeashHolder(player),
 | 
			
		||||
                        Stargate.getGateConfig().waitForPlayerAfterTeleportDelay());
 | 
			
		||||
            }, 2);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -85,4 +85,7 @@ debugging:
 | 
			
		||||
  # debug - Debug -- Only enable if you have issues, massive console output
 | 
			
		||||
  debug: false
 | 
			
		||||
  # permissionDebug - This will output any and all Permissions checks to console, used for permissions debugging (Requires debug: true)
 | 
			
		||||
  permissionDebug: false
 | 
			
		||||
  permissionDebug: false
 | 
			
		||||
advanced:
 | 
			
		||||
  # waitForPlayerAfterTeleportDelay - The amount of ticks to wait before adding a player as passenger of a vehicle. On slow servers, a value of 6 is required to avoid client glitches after teleporting on a vehicle.
 | 
			
		||||
  waitForPlayerAfterTeleportDelay: 6
 | 
			
		||||
		Reference in New Issue
	
	Block a user