Paste #77637: GraveSpawn - Questercraft

Date: 2020/11/16 11:54:15 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


# +---------------------- 
# | GraveSpawn 
# | 
# | Spawn in the nearest predefined location(s) (Graveyard)! 
# +---------------------- 
# 
# 
# Usage: /gravespawn
# When a player dies in of the defined worlds
# and one/multiple graveyards exist in this
# world, he will respawn in the nearest one
# to him. 
# +---------------------- 
#
GraveSpawn:
    type: world
    events:
###Die Event
        on player dies bukkit_priority:HIGHEST:
#Define Player Location
        - define player_location "<player.flag[gravespawn.location].as_location>"
#Flag Player location when die        
        - flag player "gravespawn.location:<player.location>"
#Keep Inventory       
        - determine passively KEEP_INV
#Keep Level        
        - determine KEEP_LEVEL 
        - title "title:<red>You have perished!" fade_in:4/{1s} stay:4/{3s} fade_out:3/{1s} targets:<player>|...        
###
###        
###Respawn Event  
###
        on player respawns:
#Define returned Death Location
        - define player_location "<player.flag[gravespawn.location].as_location>"
#Define Location of Graveyards on map
        - define location_list <s@graveyard_list.yaml_key[WORLD_NAME]>    
#Define Respawn Location Chosen       
        - define respawn_location "<def[location_list].sort_by_number[distance_squared[<player.location>]].get[1]>" 
#Sends Respawn Message        
        - narrate "You have respawned in a safe location."
#Determine which Graveyard is closest and send player  
        - title "title:<red>You have perished!" fade_in:1s stay:3s fade_out:1s targets:<player>|...
        - title "title:<red>Server Restarting" "subtitle:<red>In 1 minute!" stay:1m targets:<server.online_players>
        - wait 1t
        - teleport <player> <def[respawn_location]>  
        - wait 50t        
        - title "title:<red>You awoke in the Cemetery..." "subtitle:<white>Your soul has weakend..." fade_in:4/{1s} stay:4/{3s} fade_out:3/{1s} targets:<player>|...        
#       
###Graveyard Coords###
graveyard_list:
    type: yaml data
    WORLD_NAME:
    - l@-1758,61,-1621,QCX1
    - l@-1676,89,-775,QCX1
    - l@1319,52,1962,QCX1  
    - l@667,67,-1528,QCX1     
    - l@535,46,-10,QCX1    
    - l@-344,99,471,QCX1   
    - l@-360,42,1464,QCX1
    - l@-90,55,-2239,QCX1    
#Dont forget to add ShadowPool cemetry....