Paste #36647: Untitled Paste

Date: 2016/10/06 22:43:34 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


noplotsme:
    type: world
    events:
        on player breaks block:
        - define chunkspot <context.location.chunk.x>,<context.location.chunk.z>,<context.location.world>
#Names the chunk location for reference later ^  
        - if <server.has_file[/database/NPMchunks/<def[chunkspot]>.yml]>
        {
        - yaml "load:/database/NPMchunks/<def[chunkspot]>.yml" id:<def[chunkspot]>
        - define uuid <yaml[<def[chunkspot]>].read[uuid]>
        }
#Loads the chunk data if it exists ^
#vaporwave v  if the chunk is already defined v      
        - if <player.has_permission[NPM.vaporwave]>
            {
            - if <yaml.list.contains[<def[chunkspot]>]>
                {
                - if !<def[uuid]> == <player.uuid>
                    {
                    - determine passively cancelled
                    - if <server.has_file[/database/NPMbasics/<player.uuid>]>
                        {
                        - narrate "<&5><&lt>NoPlotsMe<&gt>You cannot build here, please use your own chunk."
                        }
                    else
                        {
                        - narrate "<&5><&lt>NoPlotsMe<&gt>You cannot build here, find some free land."
                        }
                    }
                }
#if the chunk isn't defined v            
            else 
                {
                - if <server.has_file[/database/NPMbasics/<player.uuid>]>
                    {
                    - determine passively cancelled
                    }
                else
                    {
                    - yaml create id:<def[chunkspot]>
                    - yaml id:<def[chunkspot]> set uuid:<player.uuid>
                    - yaml "savefile:/database/NPMchunks/<def[chunkspot]>" id:<def[chunkspot]>
                    - yaml create id:<player.uuid>
                    - yaml id:<player.uuid> set chunkspot:<def[chunkspot]>
                    - yaml "savefile:/database/NPMbasics/<player.uuid>" id:<player.uuid>
                    - narrate "<&5><&l><&lt>NoPlotsMe<&gt>This chunk is now yours, /NPM help for help."
                    - flag player chunkreset duration:1w
                    }
                }
            }
#midwave v if the chunk is already defined v       
        - if <player.has_permission[NPM.midwave]>
            {
            - if <yaml.list.contains[<def[chunkspot]>]>
                {
                - if <<def[uuid]>.has_permission[NPM.vaporwave].global>
                    {
                    - determine passively cancelled
                    - narrate "<&5><&lt>NoPlotsMe<&gt>You cannot build here,this is a PLAYER chunk."
                    }
                 }
#If the chunk isn't defined v             
             else
                {
                - yaml create id:<def[chunkspot]>
                - yaml id:<def[chunkspot]> set uuid:<player.uuid>
                - yaml "savefile:/database/NPMchunks/<def[chunkspot]>" id:<def[chunkspot]>
                - narrate "<&5><&lt>NoPlotsMe<&gt>This chunk is now in PUBLIC domain."
                }
            }
#highwave v if the chunk is defined v        
        - if <player.has_permission[NPM.highwave]>
            {
            - if <yaml.list.contains[<def[chunkspot]>]>
                {
                - if <<def[uuid]>.has_permission[NPM.vaporwave].global>
                    {
                    - if !<player.has_flag[highvaportimer]>
                        {
                        - narrate "<&5><&lt>NoPlotsMe<&gt>You are building in a PLAYER chunk."
                        - flag <player> highvaportimer duration:10m
                        }
                    }
                }
            else
                {
                - yaml create id:<def[chunkspot]>
                - yaml id:<def[chunkspot]> set uuid:<player.uuid>
                - yaml "savefile:/database/NPMchunks/<def[chunkspot]>" id:<def[chunkspot]>
                - narrate "<&5><&lt>NoPlotsMe<&gt>This chunk is now in PUBLIC domain."
                }
            }