Files
spawn.sk
Code
1 49
spawn.sk
options:
prefix: &6[SpawnManager]&r
# Command for operators to set the global spawn point
command /set-spawn:
permission: op
trigger:
set {spawn} to location of player
send "{@prefix} Global spawn set to your current location!" to player
# Handle first join: teleport to admin spawn if set
on join:
if {joined::%player%} is not set:
set {joined::%player%} to true
if {spawn} is set:
teleport player to {spawn}
# Handle respawn: respect bed/respawn anchor if set, else use admin spawn
on respawn:
if bed location of player is set:
# Let default behavior handle it (spawn at bed/anchor)
stop
else:
if {spawn} is set:
set respawn location to {spawn}
# Combat detection: set combat flag on damage, clear after 10 seconds
on damage:
if victim is a player:
set {combat::%victim%} to true
wait 10 seconds
set {combat::%victim%} to false
# /spawn command for all players with 5-second countdown and combat check
command /spawn:
trigger:
if {spawn} is not set:
send "{@prefix} Spawn location is not set!" to player
stop
if {combat::%player%} is true:
send "{@prefix} You cannot teleport while in combat!" to player
stop
set {_count} to 5
loop 5 times:
send action bar "&eTeleporting to spawn in %{_count}% seconds..." to player
wait 1 second
subtract 1 from {_count}
teleport player to {spawn}
send "{@prefix} Teleported to spawn!" to player