Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- drop: "plugins/Drop/drop.yml"
- on pickup:
- if player's gamemode is creative:
- if player has permission "wirus":
- stop
- cancel event
- function createDefaultDrop(t: text = ""):
- if yaml value "guiName" from {@drop} is not set:
- set yaml value "guiName" from {@drop} to "&1Menu Drop"
- if yaml nodes "drop" from {@drop} is not set:
- set yaml value "drop.example.item" from {@drop} to "diamond ore"
- set yaml value "drop.example.chanceFortune0" from {@drop} to 0.5
- set yaml value "drop.example.chanceFortune1" from {@drop} to 1
- set yaml value "drop.example.chanceFortune2" from {@drop} to 1.3
- set yaml value "drop.example.chanceFortune3" from {@drop} to 1.6
- set yaml value "drop.example2.item" from {@drop} to "1 iron ingot named ""&bAluminum Ingot"""
- set yaml value "drop.example2.chanceFortune0" from {@drop} to 0.5
- set yaml value "drop.example2.chanceFortune1" from {@drop} to 1
- set yaml value "drop.example2.chanceFortune2" from {@drop} to 1.3
- set yaml value "drop.example2.chanceFortune3" from {@drop} to 1.6
- on script load:
- createDefaultDrop()
- set {DROP.guiName} to yaml value "guiName" from {@drop}
- function DROP_getItemByText(t: text) :: item:
- if "%{_t}%" contains "named":
- set {_item} to subtext of {_t} between index 0 to index of "named" in {_t} - 2
- set {_item} to {_item} parsed as item type
- if {_item} is not item type:
- return air
- if "%{_t}%" contains "with lore":
- set {_name} to subtext of {_t} between index index of "named" in {_t} + 7 to index of "with lore" in {_t} - 3
- set {_lore} to subtext of {_t} between index index of "with lore" in {_t} + 11 to length of {_t} - 1
- return ("%{_item}%" parsed as item) named coloured {_name} with lore coloured {_lore}
- else:
- set {_name} to subtext of {_t} between index index of "named" in {_t} + 7 to length of {_t} - 1
- return ("%{_item}%" parsed as item) named coloured {_name}
- if "%{_t}%" contains "with lore":
- set {_item} to subtext of {_t} between index 0 to index of "with lore" in {_t} - 2
- set {_lore} to subtext of {_t} between index length of "%{_item}%" + 13 to index length of {_t} - 1
- set {_item} to {_item} parsed as item type
- if {_item} is item type:
- return {_item} with lore coloured {_lore}
- return air
- set {_item} to {_t} parsed as item type
- if {_item} is item type:
- return {_item}
- return air
- function DROP_getInventory(p: player) :: inventory:
- set {_drops::*} to yaml nodes "drop" from {@drop}
- if {_drops::*} is not set:
- createDefaultDrop()
- set {_drops::*} to yaml nodes "drop" from {@drop}
- set {_x} to chest with 3 rows named "%{DROP.guiName}%"
- loop {_drops::*}:
- clear {_lore::*} and {_y}
- set {_y} to yaml value "drop.%loop-value%.item" from {@drop}
- set {_item} to DROP_getItemByText({_y})
- loop 4 times:
- set {_lore} to yaml value "drop.%loop-value-1%.chanceFortune%loop-number - 1%" from {@drop}
- if loop-number is 1:
- add "&eBez fortunki: &c%{_lore}%%%" to {_lore::*}
- else:
- add "&eFortune %loop-number%: &c%{_lore}%%%" to {_lore::*}
- add "&7" to {_lore::*}
- if {DROP::%{_p}%::status::%loop-value%} is not set:
- add "&eStatus: &aWlaczony." to {_lore::*}
- else:
- add "&eStatus: &cWylaczony." to {_lore::*}
- #send "%loop-index parsed as integer - 1% -> %{_item}% -> %{_y}% -> %loop-value%" to {_p}
- set slot (loop-index parsed as integer) - 1 of {_x} to {_item} with lore "%join {_lore::*} with ""||""%"
- if {DROP::%{_p}%::cobble} is not set:
- set slot 26 of {_x} to 4 with lore "&7Wypadanie bruku:||&c*&a Wlaczone"
- else:
- set slot 26 of {_x} to 4 with lore "&7Wypadanie bruku:||&a*&c Wylaczone"
- add "{DropId:[""%loop-value%""]}" to nbt of slot (loop-index parsed as integer) - 1 of {_x}
- return {_x}
- on inventory click:
- if inventory name of player's current inventory is "%{DROP.guiName}%":
- cancel event
- if clicked slot is 26:
- if lore of player's current inventory's slot clicked slot contains "Wylaczone":
- set player's current inventory's slot clicked slot to 4 with lore "&7Wypadanie bruku:||&4*&a Wlaczone"
- clear {DROP::%player%::cobble}
- stop
- else:
- set player's current inventory's slot clicked slot to 4 with lore "&7Wypadanie bruku:||&a*&4 Wylaczone"
- set {DROP::%player%::cobble} to false
- stop
- if "%nbt of player's current inventory's slot clicked slot%" contains "DropId:[""":
- set {_item} to player's current inventory's slot clicked slot
- set {_nbt} to tag "DropId" of nbt of {_item}
- set {_nbt} to "%{_nbt}%"
- replace all "[" and "]" and """" with "" in {_nbt}
- set {_lore::*} to lore of {_item} split by "||"
- loop {_lore::*}:
- if "%loop-value%" contains "Status":
- if {DROP::%player%::status::%{_nbt}%} is not set:
- set {DROP::%player%::status::%{_nbt}%} to false
- set {_lore::%loop-index%} to "&eStatus: &cWylaczony"
- exit loop
- clear {DROP::%player%::status::%{_nbt}%}
- set {_lore::%loop-index%} to "&eStatus: &aWlaczony"
- exit loop
- set player's current inventory's slot clicked slot to {_item} with lore join {_lore::*} with "||"
- on script load:
- import "org.bukkit.event.block.BlockBreakEvent"
- on "org.bukkit.event.block.BlockBreakEvent":
- if event.getBlock() is not stone:
- stop
- if event.getPlayer()'s gamemode is not survival:
- stop
- if event.getPlayer() cannot build at event.getBlock():
- stop
- set {_p} to event.getPlayer()
- if {DROP::%{_p}%::cobble} is false:
- set {_x} to event.setDropItems(false)
- set {_drops::*} to yaml nodes "drop" from {@drop}
- loop {_drops::*}:
- if {DROP::%{_p}%::status::%loop-value%} is not set:
- set {_x} to enchant level of fortune of {_p}'s tool
- set {_chance} to yaml value "drop.%loop-value%.chanceFortune%{_x}%" from {@drop}
- #set {_chance} to {_chance} parsed as integer
- #send "%{_Chance}%" to {_p}
- chance of {_chance}%:
- set {_y} to yaml value "drop.%loop-value%.item" from {@drop}
- set {_item} to DROP_getItemByText("%{_y}%")
- drop {_item} at event.getBlock()
- command /drop [<text>]:
- trigger:
- open DROP_getInventory(player) to player
Advertisement
Add Comment
Please, Sign In to add comment