Paste #36373: Untitled Paste

Date: 2016/09/20 18:29:05 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


noplotsme:
    type: world
    events:
      on system time 19:06:
      #When it's midnight
      - foreach <server.list_players.filter[in_group[player]]>
      #Runs this command to all online players (Group)  
        {
        - if !<player.has_flag[chunkreset]>
          {
          - if <server.has_file[/database/NPMchunks/<player.uuid>.yml]>
            {
            - if !<yaml.list.contains[<player.uuid>]>
              {
              - yaml "load:/database/playerusers/<player.uuid>.yml" id:<player.uuid>
              }
            - define yamlbridgeone <yaml[<player.uuid>].read[chunkxy]>
            - adjust server delete_file:/database/playerusers/<player.uuid>.yml
            - adjust server delete_file:/database/NPMchunks/<def[yamlbridgeone]>.yml
            }
          }
        }
      - foreach <server.list_files[/database/playerusers/]>
      #Deletes the player (group) data for higher ranks 
        {
        - if !<player[<def[value.before[.yml>].in_group[player]>
          {
          - adjust server delete_file:/database/playerusers/<def[value]>
          }
        }
      - announce "<&4>THE SERVER IS RESTARTING"
      - wait 2s
      - announce "<&c>THE SERVER IS RESTARTING"
      - wait 2s
      - announce "<&d>THE SERVER IS RESTARTING"
      - wait 2s
      - announce "<&5>THE SERVER IS RESTARTING"
      - wait 2s
      - announce "<&1>THE SERVER IS RESTARTING"
      - wait 2s
      - announce "<&9>THE SERVER IS RESTARTING"
      - wait 2s
      - announce "<&3>THE SERVER IS RESTARTING"
      - wait 2s
      - announce "<&2>THE SERVER IS RESTARTING"
      - wait 2s
      - announce "<&a>THE SERVER IS RESTARTING"
      - wait 2s
      - announce "<&e>THE SERVER IS RESTARTING"
      - wait 2s
      - announce "<&6>THE SERVER IS RESTARTING"
      - execute as_server "save-all"
      - execute as_server "stop"
      on player places block:
      - if <server.has_file[/database/NPMchunks/<context.location.chunk.x>,<context.location.chunk.z>.yml]>
        {
        - yaml "load:/database/NPMchunks/<context.location.chunk.x>,<context.location.chunk.z>.yml" id:<context.location.chunk.x>,<context.location.chunk.z>
        }
      - define chunkxy <context.location.chunk.x>,<context.location.chunk.z>
      - if <player.in_group[player]>
      #Player
        {
        - if <yaml.list.contains[%chunkxy%]>
          {
          - define uuid <yaml[%chunkxy%].read[chunkxy]>
          - if !<def[uuid].contains[<player.uuid>]>
            {
            - determine passively cancelled
            - narrate "<&5><&lt>NoPlotsMe<&gt>You cannot build here, find some free land instead."
            }
          else
            {
            - flag <player> chunkreset duration:1w
            }
          }
        else if <server.has_file[/database/playerusers/<player.uuid>.yml]>
          {
          - determine passively cancelled
          - narrate "<&5><&lt>NoPlotsMe<&gt>You already own a chunk, rank up for more land."
          }
        else
          {
          - yaml create id:<context.location.chunk.x>,<context.location.chunk.z>
          - yaml id:<context.location.chunk.x>,<context.location.chunk.z> set chunkxy:->:<player.uuid>
          - yaml create id:<player.uuid>
          - yaml "savefile:/database/playerusers/<player.uuid>.yml" id:<player.uuid>
          - yaml "savefile:/database/NPMchunks/<context.location.chunk.x>,<context.location.chunk.z>" id:<context.location.chunk.x>,<context.location.chunk.z>
          - yaml id:<player.uuid> set chunkxy:->:<context.location.chunk.x>,<context.location.chunk.z>
          - narrate "<&5><&lt>NoPlotsMe<&gt>This chunk is now yours, make some cool junk for the next rank!"
          - narrate "<&5>-If your land is found too close to others it can be reset."
          - narrate "<&5>-If you don't build in your land for a week it can be reset."
          - narrate "<&5>-If your build is found to not be in effort for promotion it can be reset."
          - flag <player> chunkreset duration:1w
          }
        }
      - if <player.in_group[player+]> || <player.in_group[builder]>
      #Player+, Builder  
        {
        - if <yaml.list.contains[%chunkxy%]>
          {
          - yaml "load:/database/playerusers/<context.location.chunk.x>,<context.location.chunk.z>.yml" id:<context.location.chunk.x>,<context.location.chunk.z>
          - define uuid <yaml[%chunkxy%].read[chunkxy]>
          - if <def[uuid].as_player.in_group[player]>
            {
            - determine passively cancelled
            - narrate "<&5><&lt>NoPlotsMe<&gt>This is a PLAYER chunk, use public land."
            }
          }
        else
          {
          - yaml create id:<context.location.chunk.x>,<context.location.chunk.z>
          - yaml id:<context.location.chunk.x>,<context.location.chunk.z> set chunkxy:->:<player.uuid>
          - yaml "savefile:/database/NPMchunks/<context.location.chunk.x>,<context.location.chunk.z>" id:<context.location.chunk.x>,<context.location.chunk.z>
          - narrate "<&5><&lt>NoPlotsMe<&gt>Chunk added to public domain."
          }
        }
      - if <player.in_group[architect]> || <player.in_group[pro]> || <player.in_group[champion]> || <player.in_group[1htb38vn28v8vn10b8al]> || <player.in_group[4mv8b0vm18bv03m8vm10bjene8gi]>
      #Architect, Pro, Champion, Staff, Wizard
        {
        - if !<yaml.list.contains[%chunkxy%]>
          {
          - yaml create id:<context.location.chunk.x>,<context.location.chunk.z>
          - yaml id:<context.location.chunk.x>,<context.location.chunk.z> set chunkxy:->:<player.uuid>
          - yaml "savefile:/database/NPMchunks/<context.location.chunk.x>,<context.location.chunk.z>" id:<context.location.chunk.x>,<context.location.chunk.z>
          - narrate "<&5><&lt>NoPlotsMe<&gt>Chunk added to public domain."
          }
        }
      - if <player.in_group[dumbass]>
        {
        - determine passively cancelled
        }
      on player breaks block:
      - if <server.has_file[/database/NPMchunks/<context.location.chunk.x>,<context.location.chunk.z>.yml]>
        {
        - yaml "load:/scripts/NPMchunks/<context.location.chunk.x>,<context.location.chunk.z>.yml" id:<context.location.chunk.x>,<context.location.chunk.z>
        }
      - define chunkxy <context.location.chunk.x>,<context.location.chunk.z>
      - if <player.in_group[player]>
        {
        - if <yaml.list.contains[%chunkxy%]>
          {
          - define uuid <yaml[%chunkxy%].read[chunkxy]>
          - if !<def[uuid].contains[<player.uuid>]>
            {
            - determine passively cancelled
            - narrate "<&5><&lt>NoPlotsMe<&gt>You cannot build here, find some free land instead."
            }
          else
            {
            - flag <player> chunkreset duration:1w
            }
          }
        else if <server.has_file[/database/playerusers/<player.uuid>.yml]>
          {
          - determine passively cancelled
          - narrate "<&5><&lt>NoPlotsMe<&gt>You already own a chunk, rank up for more land."
          }
        else
          {
          - yaml create id:<context.location.chunk.x>,<context.location.chunk.z>
          - yaml id:<context.location.chunk.x>,<context.location.chunk.z> set chunkxy:->:<player.uuid>
          - yaml create id:<player.uuid>
          - yaml "savefile:/database/playerusers/<player.uuid>.yml" id:<player.uuid>
          - yaml "savefile:/database/NPMchunks/<context.location.chunk.x>,<context.location.chunk.z>" id:<context.location.chunk.x>,<context.location.chunk.z>
          - yaml id:<player.uuid> set chunkxy:->:<context.location.chunk.x>,<context.location.chunk.z>
          - narrate "<&5><&lt>NoPlotsMe<&gt>This chunk is now yours, make some cool junk for the next rank!"
          - narrate "<&5>-If your land is found too close to others it can be reset."
          - narrate "<&5>-If you don't build in your land for a week it can be reset."
          - narrate "<&5>-If your build is found to not be in effort for promotion it can be reset."
          - flag <player> chunkreset duration:1w
          }
        }
      - if <player.in_group[player+]> || <player.in_group[builder]>
        {
        - if <yaml.list.contains[%chunkxy%]>
          {
          - yaml "load:/database/playerusers/<context.location.chunk.x>,<context.location.chunk.z>.yml" id:<context.location.chunk.x>,<context.location.chunk.z>
          - define uuid <yaml[%chunkxy%].read[chunkxy]>
          - if <def[uuid].as_player.in_group[player]>
            {
            - determine passively cancelled
            - narrate "<&5><&lt>NoPlotsMe<&gt>This is a PLAYER chunk, use public land."
            }
          }
        else
          {
          - yaml create id:<context.location.chunk.x>,<context.location.chunk.y>
          - yaml id:<context.location.chunk.x>,<context.location.chunk.z> set chunkxy:->:<player.uuid>
          - yaml "savefile:/database/NPMchunks/<context.location.chunk.x>,<context.location.chunk.z>" id:<context.location.chunk.x>,<context.location.chunk.z>
          - narrate "<&5><&lt>NoPlotsMe<&gt>Chunk added to public domain."
          }
        }
      - if <player.in_group[architect]> || <player.in_group[pro]> || <player.in_group[champion]> || <player.in_group[1htb38vn28v8vn10b8al]> || <player.in_group[4mv8b0vm18bv03m8vm10bjene8gi]>
        {
        - if !<yaml.list.contains[%chunkxy%]>
          {
          - yaml create id:<context.location.chunk.x>,<context.location.chunk.z>
          - yaml id:<context.location.chunk.x>,<context.location.chunk.z> set chunkxy:->:<player.uuid>
          - yaml "savefile:/database/NPMchunks/<context.location.chunk.x>,<context.location.chunk.z>" id:<context.location.chunk.x>,<context.location.chunk.z>
          - narrate "<&5><&lt>NoPlotsMe<&gt>Chunk added to public domain."
          }
        }
      - if <player.in_group[dumbass]>
        {
        - determine passively cancelled
        }