Paste #36718: Untitled Paste

Date: 2016/10/07 15:27:54 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
                        }
                    }
                }
#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."
                }
            }
#------------------------------------------------------------------------------------------------------------------------------------------------------------
        on player places 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
                        }
                    }
                }
#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."
                }
            }
#------------------------------------------------------------------------------------------------------------------------------------------------------------
        on system time 12:00:
#initiate reboot ^ reboot v
        - announce "<&4>THE SERVER IS RESTARTING"
        - wait 2s
        - foreach <server.list.players.filter[has_permission[NPM.vaporwave]]>
            {
            - if !<player.has_flag[chunkreset]>
                {
                - if <server.has_file[database/NPMbasics/<player.uuid>]>
                    {
                    - yaml "load:/database/NPMbasics/<player.uuid>" id:<player.uuid>
                    - adjust server delete_file:/database/NPMbasics/<player.uuid>.yml
                    - adjust server delete_file:/database/NPMchunks/<yaml[<player.uuid>].read[chunkspot]>.yml
                    - adjust <yaml[<player.uuid>].read[chunkspot]> regenerate
                    }
                }
            }
        - announce "<&c>THE SERVER IS RESTARTING"
        - wait 2s
        - execute as_server "save-all"
        - announce "<&d>THE SERVER IS RESTARTING"
        - wait 2s
        - foreach <server.list.players.filter[has_permission[NPM.vaporwave]].not>
            {
            - if <server.has_file[/database/NPMbasics/<player.uuid>]>
                {
                - adjust server delete_file:/database/NPMbasics/<player.uuid>.yml
                }
            }
        - 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"
        - kick <server.list.players> reason:<&d><&l><&o>Average reboot time: ~25 seconds
        - execute as_server "stop"
#------------------------------------------------------------------------------------------------------------------------------------------------------------
        on chunk unloads:
        - define chunkspot <context.chunk.x>,<context.chunk.z>,<context.chunk.world>
        - if <server.has_file[/database/NPMchunks/<def[chunkspot]>]>
            {
            - define uuid <yaml[<def[chunkspot]>].read[uuid]>
            - if <def[uuid].as_player.has_permission[NPM.vaporwave]>
                {
                - yaml unload id:<def[chunkspot]>
                - yaml unload id:<def[uuid]>
                }
            else
                {
                - yaml unload id:<def[chunkspot]>
                }
            }
#------------------------------------------------------------------------------------------------------------------------------------------------------------      
#------------------------------------------------------------------------------------------------------------------------------------------------------------           
noplotsmecmd1:
    type: command
    name: domain
    description: Gives the domain of the chunk you're in
    usage: /domain
    script:
    - define chunkspot <context.location.chunk.x>,<context.location.chunk.z>,<context.location.world>
    - if <server.has_file[database/NPMchunks/<def[chunkspot]>>
        {
        - define uuid <yaml[<def[chunkspot]>].read[uuid]>
        - if <def[uuid].as_player.has_permission[NPM.vaporwave]>
            {
            - narrate "<&5><&lt>NoPlotsMe<&gt>This is a PLAYER chunk owned by <def[uuid]>.as_player>."
            }
        else
            {
            - narrate "<&5><&lt>NoPlotsMe<&gt>This is a PUBLIC chunk."
            }
        }
    else
        {
        - narrate "<&5><&lt>NoPlotsMe<&gt>This chunk is unowned."
        }