Advertisement
Svely

Chest Refill

Apr 26th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. #-------------------------------------------#
  2. # millenniumRandomChests 1.0 #
  3. #-------------------------------------------#
  4.  
  5. #-------------------------------------------#
  6. # (c) Efnilite, MillenniumUS 2018-2019 #
  7. # You aren't allowed to: #
  8. # Copy this code #
  9. # Sell this code #
  10. # Or claim this code as your own. #
  11. #-------------------------------------------#
  12.  
  13.  
  14.  
  15. # These are the main functions. It is not recommended to edit the file further than these options, unless you know what you're doing.
  16. options:
  17. # Set the prefix of commands here.
  18. prefix: &bmChests >
  19. # Set the permission required to execute this command.
  20. perm: is.admin
  21. # Set the message if the player has not gotten that permission.
  22. noperm: &cYou don't have the permission to do that!
  23. # The least amount of items that a chest can get.
  24. minitems: 3
  25. # The maximal amount of items that a chest can get.
  26. maxitems: 3
  27.  
  28. # Don't edit the information below.
  29. author: Efnilite
  30. copyright: MillenniumUS
  31. version: 1.0
  32.  
  33. # Set all of your custom items here.
  34. on load:
  35. clear {ritem::*}
  36. # You can add as many things as you like. You just need to repeat what I am doing here multiple times.
  37. # This adds 1 diamond boots to the random item list. In the text you will atleast need the parts of the list and the add.
  38. # COPY AND PASTE THIS: add (amount of items you want) (type of item) to {cheloc::*}
  39. # NOTE :: If there is only one item in the stack then you can just type: add (type of item) to {cheloc::*}
  40. # If you don't want to edit this, then I have already made a half decent setup, for mostly SkyWars and SurvivalGames use.
  41. # If you don't want all this extra stuff, then just remove all of it.
  42. add 1 cooked porkchop to {ritem::*}
  43. add 1 cooked porkchop to {ritem::*}
  44. add 1 cooked porkchop to {ritem::*}
  45.  
  46. # Actual command. Not recommended to edit.
  47. command /mchest [<text>]:
  48. trigger:
  49. if arg 1 is "add":
  50. if player has permission "{@perm}":
  51. if target block is chest:
  52. add location of target block to {cheloc::*}
  53. message "{@prefix} Succesfully executed &3AddChest"
  54. loop {cheloc::*}:
  55. if loop-value is location of target block:
  56. message "{@prefix} This chest has already been checked as a mCHEST!"
  57. stop
  58. else:
  59. message "&b{@prefix} You need to select a chest!"
  60. else:
  61. message "{@noperm}"
  62.  
  63. if arg 1 is "remove":
  64. if player has permission "{@perm}":
  65. if target block is a chest:
  66. remove location of target block from {cheloc::*}
  67. message "{@prefix} Succesfully removed the selected chest!"
  68. clear inventory of target block
  69. stop
  70. else:
  71. message "{@prefix} You need to select a chest!"
  72. else:
  73. message "{@noperm}"
  74.  
  75. if arg 1 is "refill":
  76. if player has permission "{@perm}":
  77. loop {cheloc::*}:
  78. set {_cheslot::*} to ""
  79. loop 27 times:
  80. add loop-number to {_slotnum::*}
  81. clear inventory of block at loop-value
  82. wait 1 tick
  83. message "&b{@prefix} Succesfully executed &3ChestRefill"
  84. set {_loop} to a random integer between {@minitems} and {@maxitems}
  85. loop {_loop} times:
  86. set {_cheitem} to a random element out of {ritem::*}
  87. set {_cheslot} to a random element out of {_slotnum::*}
  88. add {_cheitem} to slot ({_cheslot} - 1) of block at loop-value-1
  89. else:
  90. message "{@noperm}"
  91.  
  92. if arg 1 is "about" OR "version":
  93. message "&3&lmChests &r&b> Currently running version &3{@version}&b, copyright &3{@copyright} &band was created by &3{@author}"
  94.  
  95. if arg 1 is not set:
  96. if player has permission "{@perm}":
  97. message "{@prefix} You need to specify a command! Usage: /mchest <add/remove/refill>"
  98. else:
  99. message "{@noperm}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement