Paste #31811: Block Protection & Resource Harvesting

Date: 2016/03/21 16:05:05 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


##############################################
##  Block Protection & Resource Harvesting  ##
##############################################
Player_Breaks:
  type: world
  debug: false
  resources:
    - gold_ore
    - iron_ore
    - coal_ore
    - lapis_ore
    - diamond_ore
    - redstone_ore
    - emerald_ore
    - quartz_ore
  events:
    on player changes soil into dirt:
      - determine cancelled
    on player breaks block:
      - if <pl.flag[owner]> determine fulfilled
      - if <script.yaml_key[resources].contains[<context.location.material.name>].not> {
        - narrate "<&c>You cannot break this."
        - determine cancelled
      }
      - choose <context.location.material.name>:
        - case gold_ore:
          - if <pl.flag[miner].is[MORE].than[2]> {
            - define harvest "<util.random.int[1].to[3]>"
            - narrate "<&a>You have successfully harvested <&6>%harvest% <&a>gold ore."
            - give gold_ore quantity:%harvest%
            - narrate "<&e>This resource will respawn in 15 minutes."
            # COUNTDOWN AND RESPAWN HERE
          } else {
            - narrate "<&c>You must have a mining level of 3 or higher to harvest this."
            - determine cancelled
          }
        - case iron_ore:
        - case coal_ore:
        - case lapis_ore:
        - case diamond_ore:
        - case redstone_ore:
        - case emerald_ore:
        - case quartz_ore: