Commit f5ab8495 authored by Linus K.'s avatar Linus K.
Browse files

Hide teleport effects when invisible

parent 1c0a73e6
......@@ -5,6 +5,7 @@ import me.linuscde.mcplugins.teleportastic.listeners.FightListener
import me.linuscde.mcplugins.teleportastic.listeners.FightListener.Companion.isInFight
import org.bukkit.*
import org.bukkit.entity.Player
import org.bukkit.potion.PotionEffectType
import kotlin.math.abs
import kotlin.math.cos
import kotlin.math.sin
......@@ -126,7 +127,7 @@ data class TeleportingPlayer(val player: Player, val startLocation: Location,
tp.player.sendTitle("", "§6Teleporting in §e$remainSecs second${if (remainSecs != 1L) "s" else " "}", 0, 20, 0)
}
if(teleportTicks > 0)
if(teleportTicks > 0 && !tp.player.hasPotionEffect(PotionEffectType.INVISIBILITY))
displayOneWarpRing(tp.startLocation.add(.0, 2.0 * (tp.ticksPassed * 1.0 / teleportTicks), .0))
......@@ -135,9 +136,10 @@ data class TeleportingPlayer(val player: Player, val startLocation: Location,
tp.player.sendTitle("", " ", 0, 1, 0)
if (tp.player.teleport(tp.targetLocation)) {
if(tp.startLocation.world != tp.targetLocation.world || tp.startLocation.distance(tp.targetLocation) > 15.0) {
if (teleportTicks == 0L)
if (teleportTicks == 0L && !tp.player.hasPotionEffect(PotionEffectType.INVISIBILITY))
displayWarpEffect(tp.startLocation)
displayWarpEffect(tp.targetLocation)
if(!tp.player.hasPotionEffect(PotionEffectType.INVISIBILITY))
displayWarpEffect(tp.targetLocation)
}
tp.onSuccess()
} else {
......
......@@ -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.0</mcplugins.teleportastic.version>
<mcplugins.teleportastic.version>0.4.1</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