Paste #22134: Untitled Paste

Date: 2015/11/01 19:03:43 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


prepareplot:
  type: task
  debug: false
  script:
    - if <yaml.list> !contains GUILDSAVES {
      - yaml id:GUILDSAVES create
      }
    - yaml id:GUILDSAVES set guilds.<player>.A_chunk:<yaml[GUILDSAVES].read[chunk_counter]||0>
    - yaml id:GUILDSAVES set chunk_counter:<yaml[GUILDSAVES].read[chunk_counter].add[32]||32>
    - flag <player> plot_is_preparing:true
    - if <yaml[GUILDSAVES].contains[guilds.<player>.A_chunk]> {
      - define start <yaml[GUILDSAVES].read[guilds.<player>.A_chunk]>
      } else {
      - announce to_ops "<&c>Could not find secure location to paste plot for <player.name>!"
      - narrate "<&c>Something went wrong! Please contact an administrator."
      - flag "error:->:ran prepareplot with no A_chunk"
      - queue clear
      }
    - if <def[2]||none> != force {
      - define begincheck l@<yaml[GUILDSAVES].read[guilds.<player>.A_chunk].mul[16]>,0,0,guildworld
      - if <def[begincheck].highest.y> == 209 {
        - announce to_ops "SUSPICIOUS BLOCK HEIGHT DETECTED! maybe we tried pasting a new plot on an existing one?"
        - flag "error:->:A_chunk highest block coordinate matched that of a plot"
        - narrate "<&c>Something went wrong! Please contact an administrator."
        - queue clear
        }
      }
    - announce to_ops "preparing plot for <player.name> at %start%"
    - narrate "<&c>Your guild plot is being prepared."
    - flag is_preparing
    - repeat 32 {
      - define x %value%
      - repeat 32 {
        - define z %value%
        - schematic load name:%x%_%z%
        - schematic paste name:%x%_%z% l@<def[start].add[%x%].sub[1].mul[16]||0>,0,<def[z].sub[1].mul[16]||0>,guildworld delayed
        - schematic unload name:%x%_%z%
        - wait 2t
        }
      - while <server.recent_tps.get[1].is[LESS].than[18]> {
        - wait 2s
        }
      - if <def[x].mul[3]> == 24 {
        - if <player.is_online> narrate "<&a>Your guild plot is at 25%."
        - announce to_ops "<&a><player.name>'s guild plot is at 25%."
        } else if <def[x].mul[3]> == 51 {
        - if <player.is_online> narrate "<&a>Your guild plot is at 50%."
        - announce to_ops "<&a><player.name>'s guild plot is at 50%."
        } else if <def[x].mul[3]> == 75 {
        - if <player.is_online> narrate "<&a>Your guild plot is at 75%."
        - announce to_ops "<&a><player.name>'s guild plot is at 75%."
        }
      }
    - narrate "<&c>Your guild plot is now ready for use!"
    - flag <player> plot_is_preparing:!