Commit 263f632f authored by Linus K.'s avatar Linus K.
Browse files

Fix teleport fail bug

parent f5ab8495
Pipeline #126 passed with stage
in 38 seconds
......@@ -128,7 +128,7 @@ data class TeleportingPlayer(val player: Player, val startLocation: Location,
}
if(teleportTicks > 0 && !tp.player.hasPotionEffect(PotionEffectType.INVISIBILITY))
displayOneWarpRing(tp.startLocation.add(.0, 2.0 * (tp.ticksPassed * 1.0 / teleportTicks), .0))
displayOneWarpRing(tp.startLocation.clone().add(.0, 2.0 * (tp.ticksPassed * 1.0 / teleportTicks), .0))
// Teleport player
......@@ -137,13 +137,14 @@ data class TeleportingPlayer(val player: Player, val startLocation: Location,
if (tp.player.teleport(tp.targetLocation)) {
if(tp.startLocation.world != tp.targetLocation.world || tp.startLocation.distance(tp.targetLocation) > 15.0) {
if (teleportTicks == 0L && !tp.player.hasPotionEffect(PotionEffectType.INVISIBILITY))
displayWarpEffect(tp.startLocation)
displayWarpEffect(tp.startLocation.clone())
if(!tp.player.hasPotionEffect(PotionEffectType.INVISIBILITY))
displayWarpEffect(tp.targetLocation)
displayWarpEffect(tp.targetLocation.clone())
}
tp.onSuccess()
} else {
tp.onFail()
Plugin.instance.logger.warning("Teleporting ${tp.player.name} was not allowed.")
}
TELEPORTING_PLAYERS.remove(tp)
}
......
......@@ -18,7 +18,7 @@
<revision>0.1.0-SNAPSHOT</revision>
<mcplugins.autosyston.version>0.3.0</mcplugins.autosyston.version>
<mcplugins.kotlin.version>1.0.0</mcplugins.kotlin.version>
<mcplugins.teleportastic.version>0.4.1</mcplugins.teleportastic.version>
<mcplugins.teleportastic.version>0.4.2</mcplugins.teleportastic.version>
<spigot-api.version>1.16.3-R0.1-SNAPSHOT</spigot-api.version>
<mcplugins.author>LinusCDE</mcplugins.author>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment