cb458b8
Branches > main > cb458b8 > files
Teleport player to spawn on death
Commit: cb458b80d1d68dbdfa674632bff9d5cc8c369d03
Parent: 216fc17
2 changed files:
src/main/kotlin/net/bowmap/handlers/Death.kt view file
@@ -17,6 +17,7 @@ import org.bukkit.event.entity.EntityDeathEvent import org.bukkit.inventory.ItemStack import org.bukkit.damage.DamageSource+import org.bukkit.Location // Doesn't use attacker but how the player died does contribute to the death event // This should probably be the damage source?@@ -31,7 +32,11 @@ fun register() { handler<PlayerDied> { // TODO tp to 0, 0- effects(Cancel(), Broadcast(message = deathMessage(player, cause)))+ effects(+ Cancel(),+ Broadcast(message = deathMessage(player, cause)),+ Teleport(entity = player, location = Location(player.world, 0.5, 57.0, 0.5))+ ) } handler<PlayerKilledEntity> {src/main/kotlin/net/bowmap/stormbow/effect/Effects.kt view file
@@ -5,7 +5,9 @@ import net.bowmap.stormbow.effect.* import org.bukkit.inventory.ItemStack import org.bukkit.Bukkit+import org.bukkit.Location import org.bukkit.entity.Player+import org.bukkit.entity.Entity import net.bowmap.server.item.* // TODO you can send a message to more than one audience@@ -35,3 +37,8 @@ /// Events will generally call .setCancelled(true), but this is a logical action, and they could do something else. class Cancel() : Effect data class SetFishTime(val ticks: Int) : Effect+data class Teleport(val entity: Entity, val location: Location) : DefaultEffect {+ override fun execute() {+ entity.teleport(location)+ }+}