Paste #35945: Untitled Paste

Date: 2016/09/10 19:04:29 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


noplotsme:
    type: world
    events:
      on player places block:
      - if <server.has_file[/database/NPMchunks/<context.location.chunk.x>,<context.location.chunk.y>.yml]>
        {
        - yaml "load:/scripts/NPMchunks/<context.location.chunk.x>,<context.location.chunk.y>.yml" id:<context.location.chunk.x>,<context.location.chunk.y>
        }
      #This area loads chunk yaml if it should exist
      - define id <context.location.chunk.x>,<context.location.chunk.y>
      #This area defines the name of the chunk as ID
      - if <player.in_group[player]>
      #If in player
        {
        - if <yaml.list.contains[%id%]>
        #If the chunk contains a yaml
          {
          - define uuid <yaml[%id%].read[uuid]>
          - if <def[uuid]> =! <player.uuid>
          #Area determines the uuid of the owner to this area, if the owner is the player affecting it, permission is granted
            {
            - determine passively cancelled
            - narrate "<&c><&lt>NoPlotsMe<&gt>You cannot build here, find some free land instead."
            #If the area has a yaml, but isn't yours, you cannot build there
            }
          else
            {
            - flag <player> chunkreset duration:1w
            #If you built to your area, your week timer gets reset
            }
          }
        else if <server.has_file[/database/playerusers/<player.uuid>
          {
          - determine passively cancelled
          - narrate "<&c><&lt>NoPlotsMe<&gt>You already own a chunk, rank up for more land."
          }
        else
          {
          - yaml create id:<context.location.chunk.x>,<context.location.chunk.y>
          - yaml id:<context.location.chunk.x>,<context.location.chunk.y> set <player.uuid>
          - yaml create id:<player.uuid>
          - yaml "savefile:/database/playerusers/<player.uuid>.yml" id:<player.uuid>
          - yaml id:<context.location.chunk.x>,<context.location.chunk.y> set <player.uuid>
          - 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 the land is free, you are given it and a file made under your name