Paste #41074: ShiftEvents

Date: 2017/03/30 16:57:51 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


ShiftEvents:
  type: world
  debug: true
  events:
    on server start:
    - yaml 'load:scripts/config.yml' 'id:config'
    on weather rains:
    - determine cancelled
    on player changes food level:
    - determine cancelled
    on player walks:
    - if <queue.list.contains_any_text[Starting$]> {
      - determine cancelled
      }
    - if !<player.location.sub[0,0.1,0].material.is_solid> && !<player.location.sub[0,0.1,0].material.contains_text[water]> {
      - flag <player> falling:!
      }
    on player damaged:
    - if !<queue.list.contains_any_text[Ingame$]> {
      - determine cancelled
      }
    on player steps on air:
    - if !<player.has_flag[falling]> {
      - flag <player> falling:<context.previous_location.add[0,1.1,0]>
      }
    on block set on fire:
    - determine cancelled
    on entity explodes:
    - determine li@
    on player clicks with NightcrawlerTear:
    - if <queue.list.contains_any_text[Waiting$|Pregame$|Starting$]> {
      - queue clear
      }
    - take i@NightcrawlerTear quantity:1 from:<player.inventory>
    - teleport <player> <player.flag[falling].as_location>
    - flag <player> falling:!
    on player clicks with Berserker1Bud:
    - if <queue.list.contains_any_text[Waiting$|Pregame$|Starting$]> {
      - queue clear
      }
    - if <player.has_flag[Berserkercooldown]> {
      - narrate "<&c>This item is on cooldown and can be used in <player.flag[Berserkercooldown].expiration> seconds!"
      - queue clear
      }
    - define damage <s@Config.yaml_key[kitvariables.Berserker.Lvl1Damage]>
    - if <player.health.is[OR_LESS].than[<def[damage]>]> {
      - narrate "<&c>You don<&sq>t have enough health to activate this item!"
      - queue clear
      }
    - hurt <def[damage]> <player>
    - cast strength d:<s@Config.yaml_key[kitvariables.Berserker.Lvl1StrengthTime]> p:2
    - take i@Berserker1Bud quantity:1 from:<player.inventory>
    - flag <player> Berserkercooldown duration:30s
    on player clicks with Berserker2Bud:
    - if <queue.list.contains_any_text[Waiting$|Pregame$|Starting$]> {
      - queue clear
      }
    - if <player.has_flag[Berserkercooldown]> {
      - narrate "<&c>This item is on cooldown and can be used in <player.flag[Berserkercooldown].expiration> seconds!"
      - queue clear
      }
    - define damage <s@Config.yaml_key[kitvariables.Berserker.Lvl2Damage]>
    - if <player.health.is[OR_LESS].than[<def[damage]>]> {
      - narrate "<&c>You don<&sq>t have enough health to activate this item!"
      - queue clear
      }
    - hurt <def[damage]> <player>
    - cast strength d:<s@Config.yaml_key[kitvariables.Berserker.Lvl2StrengthTime]> p:2
    - take i@Berserker2Bud quantity:1 from:<player.inventory>
    - flag <player> Berserkercooldown duration:30s
    on player clicks with Berserker3Bud:
    - if <queue.list.contains_any_text[Waiting$|Pregame$|Starting$]> {
      - queue clear
      }
    - if <player.has_flag[Berserkercooldown]> {
      - narrate "<&c>This item is on cooldown and can be used in <player.flag[Berserkercooldown].expiration> seconds!"
      - queue clear
      }
    - define damage <s@Config.yaml_key[kitvariables.Berserker.Lvl3Damage]>
    - if <player.health.is[OR_LESS].than[<def[damage]>]> {
      - narrate "<&c>You don<&sq>t have enough health to activate this item!"
      - queue clear
      }
    - hurt <def[damage]> <player>
    - cast strength d:<s@Config.yaml_key[kitvariables.Berserker.Lvl3StrengthTime]> p:2
    - take i@Berserker3Bud quantity:1 from:<player.inventory>
    - flag <player> Berserkercooldown duration:30s
    on player left clicks block with AngelBeacon:
    - if <queue.list.contains_any_text[Waiting$|Pregame$|Starting$]> {
      - queue clear
      }
    - if !<s@Config.list_keys.contains[materials.<context.material.bukkit_enum>]> { 
      - narrate "<&c>You can<&sq>t place a beacon there!"
      - queue clear
      }
    - modifyblock <context.location> beacon
    - take i@AngelBeacon quantity:1 from:<player.inventory>
    - flag <player> placedbeacons:+:1
### NOTE A CUBOID OF RADIUS 3 AROUND THAT BLOCK!!! ###
    on player clicks with AngelFlower:
    - if <queue.list.contains_any_text[Waiting$|Pregame$|Starting$]> {
      - queue clear
      }
    - if <player.health.is[EQUALS].to[<player.health.max>]> {
      - narrate "<&c>Your health is already full!"
      }
    - heal <player>
    - take i@AngelFlower quantity:1 from:<player.inventory>
    on player damaged by void:
    - determine passively cancelled
    - teleport <player> <s@Config.yaml_key[spawns.<server.flag[spawns].as_list.find[<player.name>]>]>
    - heal <player>
    - announce "<&c><player.name> <&6>was knocked into the void by <&c><KILLER PLAYER><&6>!"
### DETERMINE KILLER ###
    on player killed:
    - determine passively cancelled
    - teleport <player> <s@Config.yaml_key[spawns.<server.flag[spawns].as_list.find[<player.name>]>]>
    - heal <player>
    - announce "<&c><player.name> <&6>was killed by <&c><KILLER PLAYER><&6>!"
### DETERMINE KILLER ###
    on player clicks KitSelector in inventory:
    - determine passively cancelled
    - inventory open d:in@KitSelectorGUI
    on player clicks with KitSelector:
    - inventory open d:in@KitSelectorGUI
    on player clicks Filler in KitSelectorGUI:
    - determine cancelled
    on player clicks in KitSelectorGUI:
    - determine passively cancelled
    - choose <context.item.material.name>:
      - case "stone_sword":
        - flag player GUIItem:Swordsman
        - inventory open d:in@LevelGUI
      - case "iron_pickaxe":
        - flag player GUIItem:Miner 
        - inventory open d:in@LevelGUI
      - case "bow":
        - flag player GUIItem:Archer
        - inventory open d:in@LevelGUI
      - case "splash_potion":
        - flag player GUIItem:Rogue
        - inventory open d:in@LevelGUI
      - case "gold_ingot":
        - flag player GUIItem:Capitalist 
        - inventory open d:in@LevelGUI
      - case "ghast_tear":
        - flag player GUIItem:Nightcrawler  
        - inventory open d:in@LevelGUI
      - case "beacon":
        - flag player GUIItem:Angel 
        - inventory open d:in@LevelGUI
      - case "red_dye":
        - flag player GUIItem:Berserker
        - inventory open d:in@LevelGUI
      - case "firework":
        - flag player GUIItem:Demoman 
        - inventory open d:in@LevelGUI 
    on player breaks block: 
    - if <context.location.is_within[gardenspawn]> {
      - determine cancelled
      }
    - if !<s@Config.list_keys.contains[materials.<context.material.bukkit_enum>]> { 
      - determine cancelled
      } 
    - determine passively cancelled 
    - modifyblock <context.location> bedrock 
    - define bonus '<player.item_in_hand.enchantments.level[LOOT_BONUS_BLOCKS]||0>' 
    - define quantity '<util.random.int[<s@Config.yaml_key[materials.<context.material>.minq>]>].to[<s@Config.yaml_key[materials.<context.material>.maxq>].add_int[<def[bonus]>]>' 
    - give <s@Config.yaml_key[materials.<context.material.bukkit_enum>.reward]> quantity:<def[quantity]> 
    - if !<s@Config.list_keys.contains[materials.<context.material>.bonus]> { 
      - give <s@Config.yaml_key[materials.<context.material.bukkit_enum>.bonus]> quantity:1 
      }
    - flag <player> alltimeoresmined:+:1
    - dait <s@Config.yaml_key[BlockRegen.<context.material>]> 
    - modifyblock <context.location> <context.material>
    on player breaks quartz_ore: 
    - determine passively cancelled 
    - flag player score:+:1 
    - playsound <server.list_online_players> sound:BLOCK_NOTE_PLING volume:1.2 pitch:2
    on player changes soil into dirt:
    - determine cancelled
    on player clicks in LevelGUI:
    - determine passively cancelled
    - choose <context.slot>:
      - case "1":
        - if !<player.flag[<player.flag[GUIItem]>].is[OR_MORE].than[1]> {
          - narrate "<&c>You do not have this kit unlocked!"
          - inventory close d:in@LevelGUI
          - queue clear
          }
        - inventory clear
        - foreach <s@Config.list_keys[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>]> {
          - give <s@Config.yaml_key[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>.<def[loop_index]>.item]> quantity:<s@Config.yaml_key[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>.<def[loop_index]>.quantity]> to:<player.inventory> slot:<def[loop_index]> unlimit_stack_size
          }
        - give i@KitSelector quantity:1 to:<player.inventory> slot:9
        - inventory close d:in@LevelGUI
      - case "2":
        - if !<player.flag[<player.flag[GUIItem]>].is[OR_MORE].than[1]> {
          - narrate "<&c>You do not have this kit unlocked!"
          - inventory close d:in@LevelGUI
          - queue clear
          }
        - inventory clear
        - foreach <s@Config.list_keys[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>]> {
          - give <s@Config.yaml_key[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>.<def[loop_index]>.item]> quantity:<s@Config.yaml_key[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>.<def[loop_index]>.quantity]> to:<player.inventory> slot:<def[loop_index]> unlimit_stack_size
          }
        - give i@KitSelector quantity:1 to:<player.inventory> slot:9
        - inventory close d:in@LevelGUI
      - case "10":
        - if !<player.flag[<player.flag[GUIItem]>].is[OR_MORE].than[1]> {
          - narrate "<&c>You do not have this kit unlocked!"
          - inventory close d:in@LevelGUI
          - queue clear
          }
        - inventory clear
        - foreach <s@Config.list_keys[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>]> {
          - give <s@Config.yaml_key[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>.<def[loop_index]>.item]> quantity:<s@Config.yaml_key[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>.<def[loop_index]>.quantity]> to:<player.inventory> slot:<def[loop_index]> unlimit_stack_size
          }
        - give i@KitSelector quantity:1 to:<player.inventory> slot:9
        - inventory close d:in@LevelGUI
      - case "11":
        - if !<player.flag[<player.flag[GUIItem]>].is[OR_MORE].than[1]> {
          - narrate "<&c>You do not have this kit unlocked!"
          - inventory close d:in@LevelGUI
          - queue clear
          }
        - inventory clear
        - foreach <s@Config.list_keys[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>]> {
          - give <s@Config.yaml_key[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>.<def[loop_index]>.item]> quantity:<s@Config.yaml_key[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>.<def[loop_index]>.quantity]> to:<player.inventory> slot:<def[loop_index]> unlimit_stack_size
          }
        - give i@KitSelector quantity:1 to:<player.inventory> slot:9
        - inventory close d:in@LevelGUI
      - case "19":
        - if !<player.flag[<player.flag[GUIItem]>].is[OR_MORE].than[1]> {
          - narrate "<&c>You do not have this kit unlocked!"
          - inventory close d:in@LevelGUI
          - queue clear
          }
        - inventory clear
        - foreach <s@Config.list_keys[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>]> {
          - give <s@Config.yaml_key[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>.<def[loop_index]>.item]> quantity:<s@Config.yaml_key[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>.<def[loop_index]>.quantity]> to:<player.inventory> slot:<def[loop_index]> unlimit_stack_size
          }
        - give i@KitSelector quantity:1 to:<player.inventory> slot:9
        - inventory close d:in@LevelGUI
      - case "20":
        - if !<player.flag[<player.flag[GUIItem]>].is[OR_MORE].than[1]> {
          - narrate "<&c>You do not have this kit unlocked!"
          - inventory close d:in@LevelGUI
          - queue clear
          }
        - inventory clear
        - foreach <s@Config.list_keys[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>]> {
          - give <s@Config.yaml_key[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>.<def[loop_index]>.item]> quantity:<s@Config.yaml_key[kititems.<player.flag[GUIItem]>.<player.flag[<player.flag[GUIItem]>]>.<def[loop_index]>.quantity]> to:<player.inventory> slot:<def[loop_index]> unlimit_stack_size
          }
        - give i@KitSelector quantity:1 to:<player.inventory> slot:9
        - inventory close d:in@LevelGUI
      - case "8":
        - inventory open d:in@KitSelectorGUI
      - case "9":
        - inventory open d:in@KitSelectorGUI
      - case "17":
        - inventory open d:in@KitSelectorGUI
      - case "18":
        - inventory open d:in@KitSelectorGUI
      - case "26":
        - inventory open d:in@KitSelectorGUI
      - case "27":
        - inventory open d:in@KitSelectorGUI
      - case "5":
      - case "14":
      - case "23":
    on player join:
    - if <server.flag[spawns].as_list.size.is[OR_MORE].than[<s@Config.yaml_key[maxplayers].as_int>]> {
      - narrate "<&c>This server is currently full. Please try another one!"
      - adjust <player> send_to:server@lobby
      }
    - if <server.flag[spawns].as_list.size.is[OR_MORE].than[<s@Config.yaml_key[premiumplayers].as_int>]> && !<player.has_flag[premium]> {
      - narrate "<&c>This server is currently full. Purchase a rank to gain premium access to full servers!"
      - adjust <player> send_to:server@lobby
      }
    - if <server.has_flag[nonewjoins]> && !<server.flag[rejoin].as_list.contains_text[<player.name>]> {
      - narrate "<&c>The game has progressed too far. To prevent Play Point abuse no new players may join.<&nl><&c><&l>Please try another server!"
      - adjust <player> send_to:server@lobby
      }
    - announce "<&e>[<&a>+<&e>] <&b><&l><player.name><&r> <&7>joined."
    - if !<queue.list.contains_any_text[Waiting$|Pregame$|Starting$|Ingame$|Postgame$]> {
      - run s@Waiting$ instantly
      }
    - if <queue.list.contains_any_text[Waiting$|Pregame$]> || !<server.flag[spawns].as_list.contains_text[<player.name>]> {
      - sidebar add "values:<&e>   <player.flag[score]><&c>        <player.flag[kills]><&b>   <player.name>" "players:<player>" per_player
      - flag server spawns:->:<player.name>
      - teleport <player> <s@Config.yaml_key[spawns.pregame]>
      - inventory clear
      - give i@KitSelector to:<player.inventory> slot:1
      - flag player kills:0
      - flag player score:0
      - queue clear
      }
    - inventory set d:<player.inventory> o:<s@Config.yaml_key[rejoininventories.<player.name>].as_list>
    - teleport <player> <s@Config.yaml_key[spawns.<server.flag[spawns].as_list.find[<def[player]>]>]>
    on player quit:
    - announce "<&e>[<&c>-<&e>] <&b><&l><player.name><&r> <&7>left."
    - if <player.has_flag[premium]> {
      - flag server rejoin:->:<player.name> duration:5m
      - yaml 'id:config' set 'rejoininventories.<player.name>:<player.inventory.list_contents>'
      }
    - if !<server.flag[rejoin].as_list.contains_text[<player.name>]> || null {
      - flag server spawns:<-:<player.name>
      - sidebar remove "lines:<sidebar.lines.as_list.find[<player.name>]>
      }
    - if <queue.list.contains_any_text[Ingame$]> && <server.list_online_players.size.is[EQUALS].to[0]> {
      - ^run s@Postgame$ instantly
      }
    on player logs in for the first time:
    - flag <player> alltimekills:0
    - flag <player> alltimeswordkills:0
    - flag <player> alltimebowkills:0
    - flag <player> alltimeoresmined:0
    - flag <player> alltimedeaths:0
    - flag <player> alltimepoints:0
    - flag <player> alltimewins:0
    - flag <player> alltimelosses:0
    - flag <player> solokills:0
    - flag <player> solodeaths:0
    - flag <player> solopoints:0
    - flag <player> solowins:0
    - flag <player> sololosses:0
    - flag <player> Swordsman:1
    - flag <player> Miner:0
    - flag <player> Archer:0
    - flag <player> Rogue:0
    - flag <player> Capitalist:0
    - flag <player> Nightcrawler:0
    - flag <player> Angel:0
    - flag <player> Berserker:0
    - flag <player> Demoman:0
  cuboids:
  - note cu@14,146,23,world|-19,120,-15,world as:gardenspawn