Paste #38074: Untitled Paste

Date: 2016/11/30 20:05:01 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


#NoPlotsMe v7 by Brennan
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 ^
#lowwave v any scenario v
        - if <player.in_group[tourist].world[global]> || <player.in_group[dumbass].world[global]>
            {
            - determine passively cancelled
            }
#vaporwave v  if the chunk is already defined v      
        - if <player.in_group[player].world[global]>
            {
            - if <yaml.list.contains[<def[chunkspot]>]>
                {
                - if <def[uuid]> != <player.uuid>
                    {
                    - determine passively cancelled
                    - if <server.has_file[database/NPMbasics/<player.uuid>.yml]>
                        {
                        - 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>.yml]>
                    {
                    - narrate "<&5><&lt>NoPlotsMe<&gt>You cannot build here, please use your own chunk."
                    - determine passively cancelled
                    }
                else
                    {
                    - yaml create id:<def[chunkspot]>
                    - yaml id:<def[chunkspot]> set uuid:<player.uuid>
                    - yaml "savefile:database/NPMchunks/<def[chunkspot]>.yml" id:<def[chunkspot]>
                    - yaml create id:<player.uuid>
                    - yaml id:<player.uuid> set chunkspot:<def[chunkspot]>
                    - yaml "savefile:database/NPMbasics/<player.uuid>.yml" id:<player.uuid>
                    - narrate "<&5><&l><&lt>NoPlotsMe<&gt>This chunk is now yours, /NPM help for help."
                    - flag player chunkreset duration:1w
                    - execute as_op "speed fly <player> 1"
                    }
                }
            }
#midwave v if the chunk is already defined v       
        - if <player.in_group[player+].world[global]> || <player.in_group[builder].world[global]>
            {
            - if <yaml.list.contains[<def[chunkspot]>]>
                {
                - if <def[uuid].as_player.in_group[player].world[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]>.yml" id:<def[chunkspot]>
                }
            }
#highwave v if the chunk is defined v        
        - if <player.in_group[architect].world[global]> || <player.in_group[pro].world[global]> || <player.in_group[champion].world[global]> || <player.in_group[1htb38vn28v8vn10b8al].world[global]> || <player.in_group[4mv8b0vm18bv03m8vm10bjene8gi].world[global]>
            {
            - if <yaml.list.contains[<def[chunkspot]>]>
                {
                - if <def[uuid].as_player.in_group[player].world[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]>.yml" id:<def[chunkspot]>
                }
            }
#------------------------------------------------------------------------------------------------------------------------------------------------------------
        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 ^
#lowwave v any scenario v
        - if <player.in_group[tourist].world[global]> || <player.in_group[dumbass].world[global]>
            {
            - determine passively cancelled
            }
#vaporwave v  if the chunk is already defined v      
        - if <player.in_group[player].world[global]>
            {
            - 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>.yml]>
                    {
                    - narrate "<&5><&lt>NoPlotsMe<&gt>You cannot build here, please use your own chunk."
                    - determine passively cancelled
                    }
                else
                    {
                    - yaml create id:<def[chunkspot]>
                    - yaml id:<def[chunkspot]> set uuid:<player.uuid>
                    - yaml "savefile:database/NPMchunks/<def[chunkspot]>.yml" id:<def[chunkspot]>
                    - yaml create id:<player.uuid>
                    - yaml id:<player.uuid> set chunkspot:<def[chunkspot]>
                    - yaml "savefile:database/NPMbasics/<player.uuid>.yml" 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.in_group[player+].world[global]> || <player.in_group[builder].world[global]>
            {
            - if <yaml.list.contains[<def[chunkspot]>]>
                {
                - if <def[uuid].as_player.in_group[player].world[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]>.yml" id:<def[chunkspot]>
                }
            }
#highwave v if the chunk is defined v        
        - if <player.in_group[architect].world[global]> || <player.in_group[pro].world[global]> || <player.in_group[champion].world[global]> || <player.in_group[1htb38vn28v8vn10b8al].world[global]> || <player.in_group[4mv8b0vm18bv03m8vm10bjene8gi].world[global]>
            {
            - if <yaml.list.contains[<def[chunkspot]>]>
                {
                - if <def[uuid].as_player.in_group[player].world[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]>.yml" id:<def[chunkspot]>
                }
            }
#------------------------------------------------------------------------------------------------------------------------------------------------------------
        on system time 12:00:
#initiate reboot ^ reboot v
        - announce "<&4>THE SERVER IS RESTARTING"
        - wait 2s
        - foreach <server.list_players.filter[in_group[player]]>
            {
            - 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[in_group[player].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
        - define chunkspot <context.chunk.x>,<context.chunk.z>,<context.chunk.world>
        - foreach <server.list_worlds>
            {
            - define world <def[value]>
            - foreach <def[value].loaded_chunks>
                {
                - define chunkspot <def[value].x>,<def[value].y>,<def[world]>
                - if <yaml.list.contains[<def[chunkspot]>]>
                {
                - define uuid <yaml[<def[chunkspot]>].read[uuid]>
                - yaml "savefile:database/NPMchunks/<def[chunkspot]>.yml" id:<def[chunkspot]>
                - yaml unload id:<def[chunkspot]>
                - if <def[uuid].as_player.in_group[player]>
                    {
                    - yaml "savefile:database/NPMbasics/<def[uuid]>.yml" id:<def[uuid]>
                    - yaml unload id:<def[uuid]>
                    }
                }
            }
        - 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]>.yml]>
            {
            - if <yaml.list.contains[<def[chunkspot]>]>
                {
                - define uuid <yaml[<def[chunkspot]>].read[uuid]>
                - yaml "savefile:database/NPMchunks/<def[chunkspot]>" id:<def[chunkspot]>
                - yaml unload id:<def[chunkspot]>
                - if <def[uuid].as_player.in_group[player]>
                    {
                    - yaml "savefile:database/NPMbasics/<def[uuid]>" id:<def[uuid]>
                    - yaml unload id:<def[uuid]>
                    }
                }
            }
#------------------------------------------------------------------------------------------------------------------------------------------------------------      
#------------------------------------------------------------------------------------------------------------------------------------------------------------           
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]>.yml>
        {
        - define uuid <yaml[<def[chunkspot]>].read[uuid]>
        - if <def[uuid].as_player.in_group[player].world[global]>
            {
            - 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."
        }
#------------------------------------------------------------------------------------------------------------------------------------------------------------
noplotsmecmd2:
    type: command
    name: 123
    description: Starting up, the shield!
    usage: /123
    script:
    - if <player.in_group[tourist].world[global]>
        {
        - execute as_op "promote <player>"
        - execute as_op "speed fly <player> 10"
        - 

#------------------------------------------------------------------------------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------------------------------------------------------------------------------
noplotsmewehook:
    type: command
    name: domain
    description: WorldEdit hook
    usage: /setdomain
    script:
    - if <player.in_group[builder].world[global]> || <player.in_group[architect].world[global]> || <player.in_group[pro].world[global]> || <player.in_group[champion].world[global]> || <player.in_group[1htb38vn28v8vn10b8al].world[global]> || <player.in_group[4mv8b0vm18bv03m8vm10bjene8gi].world[global]>
        {
        - define selection <player.selected_region.list_partial_chunks>
        - define selectionsize <player.selected_region.list_partial_chunks.list>
        - define player <player.uuid>
        - if <player.in_group[builder].world[global]>
            {
            - if <def[selectionsize]> >= 50
                {
                - foreach <def[selection]>
                    {
                    - define chunkspot <context.location.chunk.x>,<context.location.chunk.z>,<context.location.world>
                    - yaml create id:<def[chunkspot]>
                    - yaml id:<def[chunkspot]> set uuid:<player.uuid>
                    - yaml "savefile:database/NPMchunks/<def[chunkspot]>.yml" id:<def[chunkspot]>
                    }
                }
            else
                {
                - narrate "<&5><&lt>NoPlotsMe<&gt>Your selection is too large."
                }
            }
        - if <player.in_group[architect].world[global]>
            {
            - if <def[selectionsize]> >= 50
                {
                - foreach <def[selection]>
                    {
                    - define chunkspot <context.location.chunk.x>,<context.location.chunk.z>,<context.location.world>
                    - yaml create id:<def[chunkspot]>
                    - yaml id:<def[chunkspot]> set uuid:<player.uuid>
                    - yaml "savefile:database/NPMchunks/<def[chunkspot]>.yml" id:<def[chunkspot]>
                    }
                }
            else
                {
                - narrate "<&5><&lt>NoPlotsMe<&gt>Your selection is too large."
                }
            }
        - if <player.in_group[pro].world[global]>
            {
            - if <def[selectionsize]> >= 50
                {
                - foreach <def[selection]>
                    {
                    - define chunkspot <context.location.chunk.x>,<context.location.chunk.z>,<context.location.world>
                    - yaml create id:<def[chunkspot]>
                    - yaml id:<def[chunkspot]> set uuid:<player.uuid>
                    - yaml "savefile:database/NPMchunks/<def[chunkspot]>.yml" id:<def[chunkspot]>
                    }
                }
            else
                {
                - narrate "<&5><&lt>NoPlotsMe<&gt>Your selection is too large."
                }
            }
        - if <player.in_group[champion].world[global]> || <player.in_group[1htb38vn28v8vn10b8al].world[global]> || <player.in_group[4mv8b0vm18bv03m8vm10bjene8gi].world[global]>
            {
            - foreach <def[selection]>
                {
                - define chunkspot <context.location.chunk.x>,<context.location.chunk.z>,<context.location.world>
                - yaml create id:<def[chunkspot]>
                - yaml id:<def[chunkspot]> set uuid:<player.uuid>
                - yaml "savefile:database/NPMchunks/<def[chunkspot]>.yml" id:<def[chunkspot]>
                }
            }
        }