Advertisement
lNockl

PrivateChests

Apr 7th, 2017
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. options:
  3.     Inventory-Name: &6PrivateBau
  4.    
  5.     Diretorio: plugins/PrivateChest/players/%player%/
  6.    
  7.     Sem-Permissao: &6[PrivateChest] &cVoce nao tem permissao para isso
  8.     Inventory-Saved: &6[PrivateChest] &aInventario %{_int-chest}% foi Salvo
  9.    
  10. on load:
  11.     if file "plugins/PrivateChest/config.yml" doesn't exists:
  12.         create file "plugins/PrivateChest/config.yml"
  13.         set "Version" to "1.0.0" in yaml file "plugins/PrivateChest/config.yml"
  14.  
  15. command /chest [<integer>]:
  16.     trigger:
  17.         if arg 1 is not set:
  18.             set {_baus::*} to all files in "plugins/PrivateChest/players/%player%"
  19.             replace all ".yml" with "" in {_baus::*}
  20.             replace all " and " with ", " in {_baus::*}
  21.             if size of {_baus::*} = 0:
  22.                 send "&cVoce nao tem Baus!"
  23.             else:
  24.                 send "&6/chest <bau>"
  25.                 send "&6Seus Baus: &f%{_baus::*}%"
  26.            
  27.         if player has permission "privatechest.open.%arg-1%" or "privatechest.open.*":
  28.             if arg 1 is set:
  29.                 open chest with 6 rows named "{@Inventory-Name} - &7%arg-1%" to player
  30.                 wait a tick
  31.                 set {_chestitems::*} to configuration section "Serializable-Items" get of "plugins/PrivateChest/players/%player%/%arg-1%.yml"
  32.                 loop {_chestitems::*}:
  33.                     set {_x} to loop-value parsed as integer
  34.                     set {_item} to value "Serializable-Items.%loop-value%.Item" get of "plugins/PrivateChest/players/%player%/%arg-1%.yml"
  35.                     set {_nbt} to value "Serializable-Items.%loop-value%.NBT" get of "plugins/PrivateChest/players/%player%/%arg-1%.yml"
  36.                     set {_separeted::*} to {_item} split at " named "
  37.                     set {_item} to {_separeted::1} parsed as itemtype
  38.                     set slot {_x} of player's current inventory to {_item} with nbt "%{_nbt}%"
  39.         else:
  40.             send "{@Sem-Permissao}"
  41.                
  42. on inventory close:
  43.     set {_name} to inventory name of player's current inventory
  44.     set {_split::*} to {_name} split at " - "
  45.     set {_int-chest} to "%uncoloured {_split::2}%"
  46.     replace all "&a", "&b", "&c", "&d", "&e", "&f", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9", "&0" and "&r" with "" in {_int-chest}
  47.     if {_split::1} contains "{@Inventory-Name}":
  48.         delete file "plugins/PrivateChest/players/%player%/%{_int-chest}%.yml"
  49.         if file "plugins/PrivateChest/players/%player%/%{_int-chest}%.yml" doesn't exists:
  50.             create file "plugins/PrivateChest/players/%player%/%{_int-chest}%.yml"
  51.             set {_count} to 0
  52.             loop 53 times:
  53.                 set {_item} to slot {_count} of player's current inventory
  54.                 if {_item} is not air:
  55.                     set "Serializable-Items.%{_count}%.Item" to "%{_item}%" in yaml file "plugins/PrivateChest/players/%player%/%{_int-chest}%.yml"
  56.                     set "Serializable-Items.%{_count}%.NBT" to "%nbt of {_item}%" in yaml file "plugins/PrivateChest/players/%player%/%{_int-chest}%.yml"
  57.                 add 1 to {_count}  
  58.             send "{@Inventory-Saved}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement