Paste #44300: Untitled Paste

Date: 2017/09/10 14:51:41 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


Plot_Config_Events:
    type: world
    events:
        on gm command:
        - inject Plot_Config_Gamemode_Command_Check

        on gamemode command:
        - inject Plot_Config_Gamemode_Command_Check

        on survival command:
        - inject Plot_Config_Gamemode_Command_Check

        on creative command:
        - inject Plot_Config_Gamemode_Command_Check

        on gm1 command:
        - inject Plot_Config_Gamemode_Command_Check

        on gm0 command:
        - inject Plot_Config_Gamemode_Command_Check

        on gms command:
        - inject Plot_Config_Gamemode_Command_Check

        on gmc command:
        - inject Plot_Config_Gamemode_Command_Check

        # on player changes gamemode:
        # - inject Plot_Config_Gamemode_Command_Check

        on plotsquared player enters plotsquaredplot:
        - announce "<&7>Test Enter <player.name> <context.plot>" to_ops
        - define plot <context.plot>
        - if <server.has_flag[Plots.<def[plot]>.Config.lock_gamemode]> {
            - inject Plot_Config_Ignore_OwnerTrust_Task
            - define gm <server.flag[Plots.<def[plot]>.Config.lock_gamemode]>
            - if <player.gamemode> != <def[gm]> {
                - flag player Last_Gamemode:<player.gamemode>
                - narrate format:util_ff "<&7>Dette plot-gamemode er låst til<&co> <&6><def[gm]>"
                - adjust <player> gamemode:Spectator
            }
            # Deny Gamemode commands
        }

        on plotsquared player leaves plotsquaredplot:
        - announce "<&7>Test Exit <player.name> <context.plot>" to_ops
        - if <player.has_flag[Last_Gamemode]> {
            - define gm <player.flag[Last_Gamemode]>
            - narrate format:util_ff "<&7>Du er blevet sat tilbage til <player.flag[Last_Gamemode]>"
            - adjust <player> gamemode:<player.flag[Last_Gamemode]>
            - flag player Last_Gamemode:!
        }


        on player clicks Plot_Config_Item_LockGamemode in Plot_Config_MainMenu:
        - determine cancelled passively
        # - inventory close d:<context.inventory>
        # - execute as_server "plotmines give <player.name> lvl7"
        - define plot <player.flag[Plot_Config_Target].as_plotsquared_plot>
        - narrate "<server.flag[Plots.<def[plot]>.Config.lock_gamemode]||null>"
        - if <server.flag[Plots.<def[plot]>.Config.lock_gamemode]||null> == Survival {
            - flag server Plots.<def[plot]>.Config.lock_gamemode:Adventure
        }
        else if <server.flag[Plots.<def[plot]>.Config.lock_gamemode]||null> == Adventure {
            - flag server Plots.<def[plot]>.Config.lock_gamemode:Spectator
        }
        else if <server.flag[Plots.<def[plot]>.Config.lock_gamemode]||null> == Spectator {
            - flag server Plots.<def[plot]>.Config.lock_gamemode:!
        }
        else {
            - flag server Plots.<def[plot]>.Config.lock_gamemode:Survival
        }
        - flag server Plot_Config_Target:<def[plot]>
        - inventory open d:in@Plot_Config_MainMenu

        on player drags in Plot_Config_MainMenu:
        - determine cancelled passively

Plot_Config_Ignore_OwnerTrust_Task:
    type: task
    script:
    # - define plot 
    - if <def[plot]> == null {
        - queue clear
    }
    - if <def[plot].owners.include[<def[plot].trusted>].contains[<player>]||true> {
        - queue clear
    }

Plot_Config_Gamemode_Command_Check:
    type: task
    script:
    - define plot <player.location.plotsquared_plot||null>
    - inject Plot_Config_Ignore_OwnerTrust_Task
    - if <server.has_flag[Plots.<def[plot]>.Config.lock_gamemode]> {
        - determine cancelled passively
        - narrate format:util_ff "<&c>Dette plot har gamemode låst til <&e><server.flag[Plots.<def[plot]>.Config.lock_gamemode]>"
        - narrate format:util_ff "<&7>Hvis du gerne vil ud,  brug <&b>/spawn"
        - queue clear
    }

Plot_Config_Command:
    type: command
    name: plotconfig
    aliases:
    - pconfig
    - pmeconfig
    - plotcon
    - pcon
    script:
    - inject Plot_Config_OpenMenu

Plot_Config_OpenMenu:
    type: task
    script:
    - define plot <player.location.plotsquared_plot||null>
    - if <def[plot]> == null {
        - narrate format:util_ff "<&c>Du er ikke  noget plot!"
        - queue clear
    }
    - if <def[plot].owners.include[<def[plot].trusted>].deduplicate.contains[<player>].not||true> {
        - narrate format:util_ff "<&c>Du er ikke ejer eller trusted  dette plot!"
        - queue clear
    }
    - flag player Plot_Config_Target:<def[plot]>
    - flag server Plot_Config_Target:<def[plot]>
    - inventory open d:in@Plot_Config_MainMenu



Plot_Config_MainMenu: 
  type: inventory 
  inventory: CHEST
  title: <&3>Plot Config
  size: 27
  definitions: 
    GM: Plot_Config_Item_LockGamemode
    # Cmds: Plot_Config_Item_LockCommands
    # Time: Plot_Config_Item_Time
    # Weather: Plot_Config_Item_Weather
    # NoteBlock: Plot_Config_Item_Music
  slots: 
    - "[] [GM] [] [] [] [] [] [] []"
    - "[] [] [] [] [] [] [] [] []"
    - "[] [] [] [] [] [] [] [] []"

## Lock Gamemode
# Gamemode 0 (Sætter en til spectator hvis gm 1)
# Block /gm

## Lock Commandoer
# Kan ikke bruge kommandoer undtagen whitelisted
# /gm (Gamemode Kommandoer)
# /god
# /fly
# /tpyes/tpa/back/home/thru/top(Teleport Kommandoer) (Compass) 
# /item/kit (Spawn item/kits)
# /eec/craft/enderchest (Kister/Craft Kommandoer)
# /ast
# /mines
# /speed (default sat til 1 hvis slået fra)
# /


## Time
# 

## Block Perm

Plot_Config_Item_Toggle_Proc:
    type: procedure
    definitions: type
    script:
    - define plot <server.flag[Plot_Config_Target].as_plotsquared_plot>
    - if <server.has_flag[Plots.<def[plot]>.Config.<def[type]>]> {
        - determine "<&a><server.flag[Plots.<def[plot]>.Config.<def[type]>]>"
    }
    - determine "<&c>Slået Fra"

Plot_Config_Item_LockGamemode:
    type: item
    material: LOG
    display name: <&b><&l>Force Gamemode
    lore:
    - "<&3>Status<&co> <proc[Plot_Config_Item_Toggle_Proc].context[lock_gamemode]>"
    - "<&3>Låser dit gamemode  dit plot"
    - "<&3> gæster ikke kan ændre deres."
    - "<&3>Hvis en spiller ikke er i den korrekte gamemode,"
    - "<&3>bliver de istedet sat til spectator."
    # - "<&3>En spiller skal ændre sit gamemode før de joiner plottet."