Paste #44512: Untitled Paste

Date: 2017/09/18 13:55:02 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


gpa_com_skularr_trash_landfill_inv_1:
  type: inventory
  debug: false
  inventory: CHEST
  title: '<&3><&l>Landfill<&r> <&8>Page 1'
  size: 54
  definitions:
    n: 'i@slime_ball[display_name=&ssa&sslNext Page;lore=&ss0|&ss7Click to go to the next page;enchantments=DAMAGE_ALL,1;flags=HIDE_ENCHANTS]'
    x: 'i@black_stained_glass_pane[display_name=&ss0]'
    b: 'i@white_stained_glass_pane[display_name=&sscNo more pages!]'
  procedural items:
  - define litems <server.flag[gpa.com.skularr.trash.landfill].as_list.reverse||li@>
  - determine '<def[litems].get[1].to[45]||li@>'
  slots:
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[x] [x] [b] [x] [x] [x] [n] [x] [x]'

gpa_com_skularr_trash_landfill_inv_2:
  type: inventory
  debug: false
  inventory: CHEST
  title: '<&3><&l>Landfill<&r> <&8>Page 2'
  size: 54
  definitions:
    n: 'i@slime_ball[display_name=&ssa&sslNext Page;lore=&ss0|&ss7Click to go to the next page;enchantments=DAMAGE_ALL,1;flags=HIDE_ENCHANTS]'
    p: 'i@slime_ball[display_name=&ssa&sslPrevious Page;lore=&ss0|&ss7Click to go to the previous page;enchantments=DAMAGE_ALL,1;flags=HIDE_ENCHANTS]'
    x: 'i@black_stained_glass_pane[display_name=&ss0]'
  procedural items:
  - define litems <server.flag[gpa.com.skularr.trash.landfill].as_list.reverse||li@>
  - determine '<def[litems].get[46].to[90]||li@>'
  slots:
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[x] [x] [p] [x] [x] [x] [n] [x] [x]'

gpa_com_skularr_trash_landfill_inv_3:
  type: inventory
  debug: false
  inventory: CHEST
  title: '<&3><&l>Landfill<&r> <&8>Page 3'
  size: 54
  definitions:
    n: 'i@slime_ball[display_name=&ssa&sslNext Page;lore=&ss0|&ss7Click to go to the next page;enchantments=DAMAGE_ALL,1;flags=HIDE_ENCHANTS]'
    p: 'i@slime_ball[display_name=&ssa&sslPrevious Page;lore=&ss0|&ss7Click to go to the previous page;enchantments=DAMAGE_ALL,1;flags=HIDE_ENCHANTS]'
    x: 'i@black_stained_glass_pane[display_name=&ss0]'
  procedural items:
  - define litems <server.flag[gpa.com.skularr.trash.landfill].as_list.reverse||li@>
  - determine '<def[litems].get[91].to[135]||li@>'
  slots:
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[x] [x] [p] [x] [x] [x] [n] [x] [x]'

gpa_com_skularr_trash_landfill_inv_4:
  type: inventory
  debug: false
  inventory: CHEST
  title: '<&3><&l>Landfill<&r> <&8>Page 4'
  size: 54
  definitions:
    n: 'i@slime_ball[display_name=&ssa&sslNext Page;lore=&ss0|&ss7Click to go to the next page;enchantments=DAMAGE_ALL,1;flags=HIDE_ENCHANTS]'
    p: 'i@slime_ball[display_name=&ssa&sslPrevious Page;lore=&ss0|&ss7Click to go to the previous page;enchantments=DAMAGE_ALL,1;flags=HIDE_ENCHANTS]'
    x: 'i@black_stained_glass_pane[display_name=&ss0]'
  procedural items:
  - define litems <server.flag[gpa.com.skularr.trash.landfill].as_list.reverse||li@>
  - determine '<def[litems].get[136].to[180]||li@>'
  slots:
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[x] [x] [p] [x] [x] [x] [n] [x] [x]'

gpa_com_skularr_trash_landfill_inv_5:
  type: inventory
  debug: false
  inventory: CHEST
  title: '<&3><&l>Landfill<&r> <&8>Page 5'
  size: 54
  definitions:
    n: 'i@slime_ball[display_name=&ssa&sslNext Page;lore=&ss0|&ss7Click to go to the next page;enchantments=DAMAGE_ALL,1;flags=HIDE_ENCHANTS]'
    p: 'i@slime_ball[display_name=&ssa&sslPrevious Page;lore=&ss0|&ss7Click to go to the previous page;enchantments=DAMAGE_ALL,1;flags=HIDE_ENCHANTS]'
    x: 'i@black_stained_glass_pane[display_name=&ss0]'
  procedural items:
  - define litems <server.flag[gpa.com.skularr.trash.landfill].as_list.reverse||li@>
  - determine '<def[litems].get[181].to[225]||li@>'
  slots:
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[x] [x] [p] [x] [x] [x] [n] [x] [x]'

gpa_com_skularr_trash_landfill_inv_6:
  type: inventory
  debug: false
  inventory: CHEST
  title: '<&3><&l>Landfill<&r> <&8>Page 6'
  size: 54
  definitions:
    p: 'i@slime_ball[display_name=&ssa&sslPrevious Page;lore=&ss0|&ss7Click to go to the previous page;enchantments=DAMAGE_ALL,1;flags=HIDE_ENCHANTS]'
    x: 'i@black_stained_glass_pane[display_name=&ss0]'
    b: 'i@white_stained_glass_pane[display_name=&sscNo more pages!]'
  procedural items:
  - define litems <server.flag[gpa.com.skularr.trash.landfill].as_list.reverse||li@>
  - determine '<def[litems].get[226].to[270]||li@>'
  slots:
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[] [] [] [] [] [] [] [] []'
  - '[x] [x] [p] [x] [x] [x] [b] [x] [x]'

gpa_com_skularr_trash_cmd:
  type: command
  debug: false
  name: trash
  description: 'Sends items to the landfill. See /landfill (#)'
  aliases:
  - skutrash
  - strash
  - skularrtrash
  usage: /trash
  allowed help:
  - determine <player.has_permission[sku.trash.use]||<player.is_op||<context.server>>>
  script:
  - if <context.server> {
    - narrate '<&c>This is an in-game command!' format:gpa_com_skularr_trash_chat_format
    - queue clear
  }
  - if !<player.has_permission[sku.trash.trash]||<player.is_op||true>> {
    - narrate '<&c>Sorry! You can<&sq>t use this command!' format:gpa_com_skularr_trash_chat_format
    - queue clear
  }
  - if <player.has_flag[gpa.com.skularr.trash.trash_cmd_cool]||false> {
    - narrate '<&c>You need to wait <player.flag[gpa.com.skularr.trash.trash_cmd_cool].expiration.in_seconds.round_up>s before reusing this command!' format:gpa_com_skularr_trash_chat_format
    - queue clear
  }
  - inventory open 'd:in@generic[title=<&3><&l>Trash Bin;size=18]'
  - if !<player.has_permission[sku.trash.cooldown]||<player.is_op||true>> {
    - flag <player>
  }

gpa_com_skularr_trash_landfill_cmd:
  type: command
  debug: false
  name: landfill
  description: 'Lists all trashed items. Use the number argument to open a specific landfill page.'
  aliases:
  - skulandfill
  - slandfill
  - skularrlandfill
  usage: /landfill (number)
  allowed help:
  - determine <player.has_permission[sku.trash.landfill]||<player.is_op||<context.server>>>
  script:
  - if <context.server> {
    - narrate '<&c>This is an in-game command!' format:gpa_com_skularr_trash_chat_format
    - queue clear
  }
  - if !<player.has_permission[sku.trash.landfill]||<player.is_op>> {
    - narrate '<&c>Sorry! You can<&sq>t use this command!' format:gpa_com_skularr_trash_chat_format
    - queue clear
  }
  - if <context.args.size||0> > 1 {
    - narrate '<&c>Too many arguments. There is only one argument for this command, which is an integer from 1 to 6.' format:gpa_com_skularr_trash_chat_format
    - queue clear
  }
  - if <context.args.get[1].is[MATCHES].to[number].not||false> {
    - narrate '<&c>You must specify an integer.' format:gpa_com_skularr_trash_chat_format
    - queue clear
  }
  - inventory open 'd:in@gpa_com_skularr_trash_landfill_inv_<context.args.get[1].as_decimal.max[1].min[6].round_down||1>'
  - flag player 'gpa.com.skularr.trash.in_landfill'

gpa_com_skularr_trash_landfill_evt:
  type: world
  debug: false
  events:
    on player closes inventory:
    - if <context.inventory.title> == '<&3><&l>Trash Bin' {
      - if <context.inventory.list_contents.filter[is[EQUALS].to[i@air].not].is_empty> {
        - queue clear
      }
      - define t '<context.inventory.list_contents.filter[is[EQUALS].to[i@air].not]>'
      - define ta 'li@'
      - foreach <def[t]> {
        - define l '<def[value].lore||li@>'
        - adjust <def[value]> 'lore:<def[l].include[&sp|&ss7Trashed by <player.name>|&ss7Click to claim]>' save:n
        - define ta '<def[ta].include[<entry[n].result>]>'
      }
      - flag server 'gpa.com.skularr.trash.landfill:|:<def[ta]>'
      - define s '<server.flag[gpa.com.skularr.trash.landfill].as_list.size||0>'
      - if <def[s]> > 270 {
        - flag server 'gpa.com.skularr.trash.landfill:<server.flag[gpa.com.skularr.trash.landfill].as_list.get[<def[s].sub[270]>].to[<def[s]>].separated_by[|].as_list>'
      }
      - foreach <server.get_online_players_flagged[gpa.com.skularr.trash.in_landfill]> {
        - inventory open d:<def[value].open_inventory> player:<def[value]>
      }
      - narrate '<&f>Successfully sent trash to the landfill!' format:gpa_com_skularr_trash_chat_format
    }
    - wait 1t
    - if <context.inventory.starts_with[in@gpa_com_skularr_trash_landfill_inv_]> && !<player.open_inventory.starts_with[in@gpa_com_skularr_trash_landfill_inv_]> {
      - flag player 'gpa.com.skularr.trash.in_landfill:!'
      - queue clear
    }
    on player clicks in inventory:
    - if !<context.inventory.starts_with[in@gpa_com_skularr_trash_landfill_inv_]> {
      - queue clear
    }
    - determine passively 'CANCELLED'
    - define n '<context.inventory.after_last[_]>'
    - if <context.item.material> == m@slime_ball {
      - if <context.raw_slot> == 48 {
        - inventory open d:in@gpa_com_skularr_trash_landfill_inv_<def[n].sub_int[1]>
        - queue clear
      }
      else if <context.raw_slot> == 52 {
        - inventory open d:in@gpa_com_skularr_trash_landfill_inv_<def[n].add_int[1]>
        - queue clear
      }
    }
    - if <context.raw_slot> <= 45 && <context.item> != i@air {
      #### REORDER NOT WORKING
      ##########
      ##########
      - define fs '<server.flag[gpa.com.skularr.trash.landfill].as_list.size>'
      - define rem_num '<context.slot.add[<el@45.mul[<def[n].sub[1]>]>].round_down>'
      - define new_li '<server.flag[gpa.com.skularr.trash.landfill].as_list.reverse.remove[<def[rem_num]>]>'
      - define new_li '<def[new_li].reverse>'
      - flag server 'gpa.com.skularr.trash.landfill:<def[new_li].as_element.replace[firstregex:li@]>'
      - narrate '<def[new_li].as_list>'
      - adjust <context.item> lore:<context.item.lore.remove[last].remove[last].remove[last]> save:i
      - give <entry[i].result>
      - inventory open d:<context.inventory>
      - queue clear
    }
    - wait 1t
    - inventory update

gpa_com_skularr_trash_chat_format:
  type: format
  debug: false
  format: <&3><&l>Sku<&sq>s Trash Bin<&r><&7><&co> <text>