Paste #21345: Untitled Paste

Date: 2015/10/21 23:12:45 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


########################
#
# Commands to set and go to a spawn point
#
# LAST:
#   Carisus (2015/10/21) - Initial creation of script
#
#   TODO:   Make a better description
#           Add multiple/named spawns
#
#   Permissions added: (currently escaped)
#       yeticraft.cmd.setspawn
#       yeticraft.cmd.spawn
#
########################

setting_spawn:
    Type: command
    debug: true
    name: SetSpawn
    description: <&9>Sets the world Spawn Point to the location you are at
    usage: /setspawn <&lt>world<&gt>
#    permission: yeticraft.cmd.setspawn
    script:
        - if <context.server> {
            - narrate "<&c> WHAO<&co> <&e>You must be a player in-game to run this command"
            - queue clear
        }
#        - if <player.has_permission[yeticraft.cmd.setspawn].not> {
#            - narrate "<&c>You do not have permission to set the world spawn"
#            - queue clear
#        }
        - define here l@<player.location.block.x.add[.5]>,<player.location.block.y.add[.5]>,<player.location.block.z.add[.5]>,<player.location.pitch>,<player.location.yaw>,<player.world>
        - define world <context.args.get[1]||null>
        - if <def[world]> == null {
            - define world <player.world>
        }
        - if <def[world]> == <server.list_worlds> {
            - narrate "<&c>Could not find <&6>%world%<&c>, are you sure it loaded?"
            - queue clear
        }
        - flag server %world%_spawnpoint:%here%
        - narrate "<&6>Spawn Point set"

going_to_spawn:
    type: command
    debug: true
    name: Spawn
    usage: /spawn
    description: Send you to the worlds Spawn Point
#    permission: yeticraft.cmd.spawn
    script:
        - if <context.server> {
            - narrate "<&c> WHAO<&co> <&e>You must be a player in-game to run this command"
            - queue clear
        }
#        - if <player.has_permission[yeticraft.cmd.spawn].not> {
#            - narrate "<&c>You do not have permission to teleport to this worlds SpawnPoint"
#            - queue clear
#        }
        - define world <player.world>
        - if <server.has_flag[<def[world]>_spawnpoint].not> {
            - narrate "<&6>Spawn Point for %world% has not been set"
            - queue clear
        }
#        - teleport <player> <%world%.spawn_location>
        - teleport <player> <server.flag[<def[world]>_spawnpoint]>