on join:
if {tradetoggle.%uuid of player%} is not set:
set {tradetoggle.%uuid of player%} to true
function loadConfig():
load yaml "plugins/trades/config.yml" as "Trades"
load yaml "plugins/trades/blacklist.yml" as "TradesBlacklist"
set the header of "Trades" to "WARNING: DO NOT SET A GUI ITEM TO AIR! IT WILL CAUSE THE TRADING TO BREAK!"
set the header of "TradesBlacklist" to "This is the item blacklist for trading." and "Use /tblacklist for managing the item blacklist." and " " and "Detection Types:" and " 'Name' = Detect blacklisted item by name (For DetectionType Option)" and " 'Lore' = Detect blacklisted item by lore (For DetectionType Option)" and " 'Both' = Detect blacklisted item by name and lore (For DetectionType Option)" and " 'id' = Detect blacklisted item by item id (For DetectionType Option)" and " 'ExactItem' = Detect blacklisted item by exact item (For DetectionType Option)" and " " and "Text Detection Types:" and " 'Contains' = If name or lore of blacklisted item CONTAINS certain text (For TextDetectionType Option)" or " 'Is' = If name or lore of blacklisted item IS certain text (For TextDetectionType Option)" and " " and "ItemName = The text to find in the name of a item (Applies when DetectionType is set to 'Name' or 'Both')" and "ItemLore = The text to find in the lore of a item (Applies when DetectionType is set to 'Lore' or 'Both'" and "ItemID = The item id of the item you want to blacklist (Applies when DetectionType is set to 'ID')" and "ExactItem = Detection for an exact item (Applies when DetectionType is set to 'ExactItem'. To set an exact item, use /tblacklist set )"
if yaml node "Messages.Prefix" in "Trades" doesn't have value:
set yaml value "Messages.Prefix" in "Trades" to "&8&l[&e&lTRADING&8&l]"
if yaml node "Messages.TradeNoPermission" in "Trades" doesn't have value:
set yaml value "Messages.TradeNoPermission" in "Trades" to "{prefix} &cYou do not have permission to trade."
if yaml node "Messages.TradeToggleDisabled" in "Trades" doesn't have value:
set yaml value "Messages.TradeToggleDisabled" in "Trades" to "{prefix} &cYou disabled trading..."
if yaml node "Messages.TradeToggleEnabled" in "Trades" doesn't have value:
set yaml value "Messages.TradeToggleEnabled" in "Trades" to "{prefix} &aYou enabled trading..."
if yaml node "Messages.BlacklistedIDExists" in "Trades" doesn't have value:
set yaml value "Messages.BlacklistedIDExists" in "Trades" to "{prefix} &cThe blacklisted item id you specified already exists."
if yaml node "Messages.BlacklistedIDDoesNotExist" in "Trades" doesn't have value:
set yaml value "Messages.BlacklistedIDDoesNotExist" in "Trades" to "{prefix} &cThe blacklisted item id you specified does not exist."
if yaml node "Messages.BlacklistedItem" in "Trades" doesn't have value:
set yaml value "Messages.BlacklistedItem" in "Trades" to "{prefix} &cThe item you clicked is a blacklisted item."
if yaml node "Messages.BlacklistedIDCreated" in "Trades" doesn't have value:
set yaml value "Messages.BlacklistedIDCreated" in "Trades" to "{prefix} &7You &acreated &7a blacklist id called &6{id}&7. To edit this, you have to edit the blacklist.yml file."
if yaml node "Messages.BlacklistedIDRemoved" in "Trades" doesn't have value:
set yaml value "Messages.BlacklistedIDRemoved" in "Trades" to "{prefix} &7You &cremoved &7the blacklist id called &6{id}&7."
if yaml node "Messages.BlacklistedIDExactItem" in "Trades" doesn't have value:
set yaml value "Messages.BlacklistedIDExactItem" in "Trades" to "{prefix} &7You &3set &7the exact item of blacklist id called &6{id} &7to your held item."
if yaml node "Messages.TradeSelf" in "Trades" doesn't have value:
set yaml value "Messages.TradeSelf" in "Trades" to "{prefix} &cYeah, because I would definitely allow you to trade yourself."
if yaml node "Messages.TradeCooldown" in "Trades" doesn't have value:
set yaml value "Messages.TradeCooldown" in "Trades" to "{prefix} &cPlease wait a few seconds before using this command again."
if yaml node "Messages.PlayerHasTradingDisabled" in "Trades" doesn't have value:
set yaml value "Messages.PlayerHasTradingDisabled" in "Trades" to "{prefix} &cThe player you specified has trading disabled..."
if yaml node "Messages.NoTradeInCreative" in "Trades" doesn't have value:
set yaml value "Messages.NoTradeInCreative" in "Trades" to "{prefix} &cYou cannot trade in creative mode."
if yaml node "Messages.NoTradeInCreative2" in "Trades" doesn't have value:
set yaml value "Messages.NoTradeInCreative2" in "Trades" to "{prefix} &cThe other player is in creative mode."
if yaml node "Messages.NotSameWorld" in "Trades" doesn't have value:
set yaml value "Messages.NotSameWorld" in "Trades" to "{prefix} &cYou must be in the same world as the specified player to trade them."
if yaml node "Messages.OutOfDistance" in "Trades" doesn't have value:
set yaml value "Messages.OutOfDistance" in "Trades" to "{prefix} &cYou are too far away from the specified player to trade them."
if yaml node "Messages.AlreadyInTrade" in "Trades" doesn't have value:
set yaml value "Messages.AlreadyInTrade" in "Trades" to "{prefix} &cThe other player is already currently in a trade."
if yaml node "Messages.RequestAlreadySent" in "Trades" doesn't have value:
set yaml value "Messages.RequestAlreadySent" in "Trades" to "{prefix} &cYou already sent this player a trade request..."
if yaml node "Messages.ClickCorrection" in "Trades" doesn't have value:
set yaml value "Messages.ClickCorrection" in "Trades" to "{prefix} &6Shift click items in your inventory to put up trade offers."
if yaml node "Messages.GuiName" in "Trades" doesn't have value:
set yaml value "Messages.GuiName" in "Trades" to "&a★You★ &c★Other★"
if yaml node "Messages.RequestSent" in "Trades" doesn't have value:
set yaml value "Messages.RequestSent" in "Trades" to "{prefix} &7You sent a trade request to &6{target}&7..."
if yaml node "Messages.TradeCanceled" in "Trades" doesn't have value:
set yaml value "Messages.TradeCanceled" in "Trades" to "&8&l[&4✘&8&l] &cThe other player canceled the trade. &8&l[&4✘&8&l]"
if yaml node "Messages.TradeCanceled2" in "Trades" doesn't have value:
set yaml value "Messages.TradeCanceled2" in "Trades" to "&8&l[&4✘&8&l] &cYou canceled the trade. &8&l[&4✘&8&l]"
if yaml node "Messages.TradeAccepted" in "Trades" doesn't have value:
set yaml value "Messages.TradeAccepted" in "Trades" to "&8&l[&a✔&8&l] &bTrade complete. &7Please report any scams! &8&l[&a✔&8&l]"
if yaml node "Messages.TradeReloaded" in "Trades" doesn't have value:
set yaml value "Messages.TradeReloaded" in "Trades" to "{prefix} &aThe trade config has been reloaded."
if yaml node "Messages.RequestReceived" in "Trades" doesn't have value:
set yaml value "Messages.RequestReceived" in "Trades" to "{prefix} &6{player} &7sent you a trade request."
if yaml node "TradeCooldown.Enabled" in "Trades" doesn't have value:
set yaml value "TradeCooldown.Enabled" in "Trades" to "true"
if yaml node "TradeCooldown.Timer" in "Trades" doesn't have value:
set yaml value "TradeCooldown.Timer" in "Trades" to 5
set the comments of yaml node "TradeCooldown" from "Trades" to "Does /trade have a cooldown? Put true or false" and "Cooldown duration in seconds"
if yaml node "Trade.TimeOut" in "Trades" doesn't have value:
set yaml value "Trade.TimeOut" in "Trades" to 20
set the comments of yaml node "Trade" from "Trades" to "The timout duration of a trade offer" and "Cooldown duration in seconds"
if yaml node "Trade.CountDown" in "Trades" doesn't have value:
set yaml value "Trade.CountDown" in "Trades" to 6
set the comments of yaml node "Trade" from "Trades" to "The timout duration of a trade offer" and "The countdown of trade ending" and "Cooldown duration in seconds"
if yaml node "Trade.SameWorld" in "Trades" doesn't have value:
set yaml value "Trade.SameWorld" in "Trades" to "true"
if yaml node "Trade.Distance" in "Trades" doesn't have value:
set yaml value "Trade.Distance" in "Trades" to "Infinite"
if yaml node "Trade.TradeInCreative" in "Trades" doesn't have value:
set yaml value "Trade.TradeInCreative" in "Trades" to "false"
set the comments of yaml node "Trade" from "Trades" to "The timout duration of a trade offer" and "The countdown of trade ending" and "Cooldown duration in seconds" and "Do players have to be in same world to trade" and "Distance limit for trading (Set to Infinite for no limit)" and "Should players be able to trade in creative? true/false"
if yaml node "AddOffer.PlaySound" in "Trades" doesn't have value:
set yaml value "AddOffer.PlaySound" in "Trades" to "true"
if yaml node "AddOffer.SoundName" in "Trades" doesn't have value:
set yaml value "AddOffer.SoundName" in "Trades" to "ENTITY_EXPERIENCE_ORB_PICKUP"
if yaml node "AddOffer.Volume" in "Trades" doesn't have value:
set yaml value "AddOffer.Volume" in "Trades" to 1
if yaml node "AddOffer.Pitch" in "Trades" doesn't have value:
set yaml value "AddOffer.Pitch" in "Trades" to 1
set the comments of yaml node "AddOffer" from "Trades" to "Sound played when adding an item to a trade" and "Is this sound enabled? Put true/false" and "The name of the sound played" and "How loud the played sound is" and "The pitch of the sound played" and "Sounds found at: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html"
if yaml node "TradeComplete.PlaySound" in "Trades" doesn't have value:
set yaml value "TradeComplete.PlaySound" in "Trades" to "true"
if yaml node "TradeComplete.SoundName" in "Trades" doesn't have value:
set yaml value "TradeComplete.SoundName" in "Trades" to "ENTITY_PLAYER_LEVELUP"
if yaml node "TradeComplete.Volume" in "Trades" doesn't have value:
set yaml value "TradeComplete.Volume" in "Trades" to 1
if yaml node "TradeComplete.Pitch" in "Trades" doesn't have value:
set yaml value "TradeComplete.Pitch" in "Trades" to 1
set the comments of yaml node "TradeComplete" from "Trades" to "Sound played when the trade is successful" and "Is this sound enabled? Put true/false" and "The name of the sound played" and "How loud the played sound is" and "The pitch of the sound played" and "Sounds found at: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html"
if yaml node "TradeCanceled.PlaySound" in "Trades" doesn't have value:
set yaml value "TradeCanceled.PlaySound" in "Trades" to "true"
if yaml node "TradeCanceled.SoundName" in "Trades" doesn't have value:
set yaml value "TradeCanceled.SoundName" in "Trades" to "BLOCK_ANVIL_LAND"
if yaml node "TradeCanceled.Volume" in "Trades" doesn't have value:
set yaml value "TradeCanceled.Volume" in "Trades" to 1
if yaml node "TradeCanceled.Pitch" in "Trades" doesn't have value:
set yaml value "TradeCanceled.Pitch" in "Trades" to 0.1
set the comments of yaml node "TradeCanceled" from "Trades" to "Sound played when the trade is successful" and "Is this sound enabled? Put true/false" and "The name of the sound played" and "How loud the played sound is" and "The pitch of the sound played" and "Sounds found at: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html"
if yaml node "NotReady.ItemID" in "Trades" doesn't have value:
set yaml value "NotReady.ItemID" in "Trades" to "351:8"
if yaml node "NotReady.Name" in "Trades" doesn't have value:
set yaml value "NotReady.Name" in "Trades" to "&7Not Ready..."
if yaml node "NotReady.Lore" in "Trades" doesn't have value:
add "Empty" to {_list::*}
set yaml list "NotReady.Lore" from "Trades" to {_list::*}
delete {_list::*}
set the comments of yaml node "NotReady" from "Trades" to "The gui item for Not Ready (DO NOT SET TO AIR)"
if yaml node "Ready.ItemID" in "Trades" doesn't have value:
set yaml value "Ready.ItemID" in "Trades" to "351:10"
if yaml node "Ready.Name" in "Trades" doesn't have value:
set yaml value "Ready.Name" in "Trades" to "&a&lREADY"
if yaml node "Ready.Lore" in "Trades" doesn't have value:
add "Empty" to {_list::*}
set yaml list "Ready.Lore" from "Trades" to {_list::*}
delete {_list::*}
set the comments of yaml node "Ready" from "Trades" to "The gui item for Ready (DO NOT SET TO AIR)"
if yaml node "Accept.ItemID" in "Trades" doesn't have value:
set yaml value "Accept.ItemID" in "Trades" to "160:13"
if yaml node "Accept.Name" in "Trades" doesn't have value:
set yaml value "Accept.Name" in "Trades" to "&a&lACCEPT TRADE"
if yaml node "Accept.Lore" in "Trades" doesn't have value:
add "&7&oClick to accept trade." to {_list::*}
set yaml list "Accept.Lore" from "Trades" to {_list::*}
delete {_list::*}
set the comments of yaml node "Accept" from "Trades" to "The gui item for Accept Trade button (DO NOT SET TO AIR)"
if yaml node "Cancel.ItemID" in "Trades" doesn't have value:
set yaml value "Cancel.ItemID" in "Trades" to "160:14"
if yaml node "Cancel.Name" in "Trades" doesn't have value:
set yaml value "Cancel.Name" in "Trades" to "&4&lCANCEL TRADE"
if yaml node "Cancel.Lore" in "Trades" doesn't have value:
add "&7&oClick to cancel trade." to {_list::*}
set yaml list "Cancel.Lore" from "Trades" to {_list::*}
delete {_list::*}
set the comments of yaml node "Cancel" from "Trades" to "The gui item for Cancel Trade button (DO NOT SET TO AIR)"
if yaml node "Divider.ItemID" in "Trades" doesn't have value:
set yaml value "Divider.ItemID" in "Trades" to "101"
if yaml node "Divider.Name" in "Trades" doesn't have value:
set yaml value "Divider.Name" in "Trades" to "&4"
if yaml node "Divider.Lore" in "Trades" doesn't have value:
add "Empty" to {_list::*}
set yaml list "Divider.Lore" from "Trades" to {_list::*}
delete {_list::*}
set the comments of yaml node "Divider" from "Trades" to "The gui item for Divider line (DO NOT SET TO AIR)"
if yaml node "StopTimer.ItemID" in "Trades" doesn't have value:
set yaml value "StopTimer.ItemID" in "Trades" to "166"
if yaml node "StopTimer.Name" in "Trades" doesn't have value:
set yaml value "StopTimer.Name" in "Trades" to "&c&lSTOP TIMER"
if yaml node "StopTimer.Lore" in "Trades" doesn't have value:
add "&7&oClick to stop the timer." to {_list::*}
set yaml list "StopTimer.Lore" from "Trades" to {_list::*}
delete {_list::*}
set the comments of yaml node "StopTimer" from "Trades" to "The gui item for Stop Timer item (DO NOT SET TO AIR)"
if yaml node "BlankSlot.ItemID" in "Trades" doesn't have value:
set yaml value "BlankSlot.ItemID" in "Trades" to "160:8"
if yaml node "BlankSlot.Name" in "Trades" doesn't have value:
set yaml value "BlankSlot.Name" in "Trades" to "&4"
if yaml node "BlankSlot.Lore" in "Trades" doesn't have value:
add "Empty" to {_list::*}
set yaml list "BlankSlot.Lore" from "Trades" to {_list::*}
delete {_list::*}
set the comments of yaml node "BlankSlot" from "Trades" to "The gui item for Blank Slot item (DO NOT SET TO AIR)"
set {trades.prefix} to yaml value "Messages.Prefix" in "Trades"
save yaml "Trades"
save yaml "TradesBlacklist"
on script load:
loadConfig()
function placeholder(convert: text, player: player, target: player) :: text:
replace all "{prefix}" with "%{trades.prefix}%" in {_convert}
replace all "{player}" with "%{_player}%" in {_convert}
replace all "{target}" with "%{_target}%" in {_convert}
replace all "|nl|" with "%nl%" in {_convert}
return {_convert}
function getName(item: item) :: text:
set {_n} to name of {_item}
return {_n}
function getLore(item: item) :: text:
set {_lore} to lore of {_item}
return {_lore}
function getID(item: item) :: text:
set {_id} to "%type of {_item}%"
return {_id}
function guiItemCreate(id: text, name: text, lore: objects) :: item:
set {_item} to {_id} parsed as item type
set {_item} to {_item} named "%{_name}%"
if {_lore::*} is not set:
return {_item}
else:
set {_count} to 0
loop {_lore::*}:
if "%loop-value%" is "Empty":
return {_item}
stop
add 1 to {_count}
set {_count2} to 0
loop {_lore::*}:
if {_g} is not set:
set {_g} to "%loop-value%"
else:
if {_count} is not {_count2}:
set {_g} to "%{_g}%||%loop-value%||"
else:
set {_g} to "%{_g}%||%loop-value%"
add 1 to {_count2}
set {_item} to {_item} named "%{_name}%" with lore "%colored {_g}%"
return {_item}
on quit:
delete {traderequests.%uuid of player%::*}
loop all players:
loop {traderequests.%uuid of loop-player%::*}:
if "%loop-value-2%" is "%loop-player%":
remove loop-value-2 from {traderequests.%uuid of loop-player%::*}
command /treload:
trigger:
if executor does not have permission "trade.reload":
message "%placeholder(yaml value ""Messages.TradeNoPermission"" in ""Trades"", executor, executor)%"
stop
loadConfig()
message "%placeholder(yaml value ""Messages.TradeReloaded"" in ""Trades"", executor, executor)%"
command /tblacklist [] []:
trigger:
if executor does not have permission "trade.blacklist":
message "%placeholder(yaml value ""Messages.TradeNoPermission"" in ""Trades"", executor, executor)%"
stop
if arg 1 is set:
if arg 2 is set:
if arg 1 is not "create" or "remove" or "set":
message "&7Correct usage: &c/tblacklist "
stop
else:
if arg 1 is "create":
set {_blacklisted1::*} to all yaml nodes of "TradesBlacklist"
loop {_blacklisted1::*}:
set {_node} to "%loop-value%"
set {_nodes::*} to {_node} split by "."
{_%{_nodes::1}%} is not set
set {_%{_nodes::1}%} to true
add {_nodes::1} to {_finalblacklisted::*}
delete {_node} and {_nodes::*}
loop {_finalblacklisted::*}:
if "%loop-value%" is "%arg 2%":
message "%placeholder(yaml value ""Messages.BlacklistedIDExists"" in ""Trades"", executor, executor)%"
stop
set {_msg} to placeholder(yaml value "Messages.BlacklistedIDCreated" in "Trades", executor, executor)
replace all "{id}" with "%arg 2%" in {_msg}
message "%{_msg}%"
set yaml value "%arg 2%.DetectionType" of "TradesBlacklist" to "Name"
set yaml value "%arg 2%.TextDetectionType" of "TradesBlacklist" to "Contains"
set yaml value "%arg 2%.ItemName" of "TradesBlacklist" to "&dGod Sword"
set yaml value "%arg 2%.ItemLore" of "TradesBlacklist" to "&7&oUntradeable..."
set yaml value "%arg 2%.ItemID" of "TradesBlacklist" to 276
set yaml value "%arg 2%.ExactItem" of "TradesBlacklist" to "[]"
save yaml "TradesBlacklist"
if arg 1 is "remove":
set {_blacklisted1::*} to all yaml nodes of "TradesBlacklist"
loop {_blacklisted1::*}:
set {_node} to "%loop-value%"
set {_nodes::*} to {_node} split by "."
{_%{_nodes::1}%} is not set
set {_%{_nodes::1}%} to true
add {_nodes::1} to {_finalblacklisted::*}
delete {_node} and {_nodes::*}
loop {_finalblacklisted::*}:
if "%loop-value%" is "%arg 2%":
set {_msg} to placeholder(yaml value "Messages.BlacklistedIDRemoved" in "Trades", executor, executor)
replace all "{id}" with "%arg 2%" in {_msg}
message "%{_msg}%"
delete yaml value "%arg 2%" in "TradesBlacklist"
save yaml "TradesBlacklist"
stop
message "%placeholder(yaml value ""Messages.BlacklistedIDDoesNotExist"" in ""Trades"", executor, executor)%"
stop
if arg 1 is "set":
if player's held item is air:
message "&cHeld itemstack cannot be air."
stop
set {_blacklisted1::*} to all yaml nodes of "TradesBlacklist"
loop {_blacklisted1::*}:
set {_node} to "%loop-value%"
set {_nodes::*} to {_node} split by "."
{_%{_nodes::1}%} is not set
set {_%{_nodes::1}%} to true
add {_nodes::1} to {_finalblacklisted::*}
delete {_node} and {_nodes::*}
loop {_finalblacklisted::*}:
if "%loop-value%" is "%arg 2%":
set {_msg} to placeholder(yaml value "Messages.BlacklistedIDExactItem" in "Trades", executor, executor)
replace all "{id}" with "%arg 2%" in {_msg}
message "%{_msg}%"
set yaml value "%arg 2%.ExactItem" in "TradesBlacklist" to 1 of player's held item
set yaml value "%arg 2%.DetectionType" in "TradesBlacklist" to "ExactItem"
save yaml "TradesBlacklist"
stop
message "%placeholder(yaml value ""Messages.BlacklistedIDDoesNotExist"" in ""Trades"", executor, executor)%"
stop
else:
message "&7Correct usage: &c/tblacklist "
else:
message "&7Correct usage: &c/tblacklist "
command /trade []:
trigger:
if player does not have permission "trade.use":
message "%placeholder(yaml value ""Messages.TradeNoPermission"" in ""Trades"", player, player)%"
stop
if arg 1 is not set:
message "&fToggle trading on/off"
message "&f/tradetoggle"
if player has permission "trade.blacklist":
message "&fBlacklist a item"
message "&f/tblacklist "
message "&fSend a player a trade request."
message "&f/trade "
else:
set {_creative} to yaml value "Trade.TradeInCreative" of "Trades"
if "%{_creative}%" is "false":
if gamemode of player is creative:
message "%placeholder(yaml value ""Messages.NoTradeInCreative"" in ""Trades"", player, player)%"
stop
set {_sameworld} to yaml value "Trade.SameWorld" of "Trades"
if "%{_sameworld}%" is "true":
set {_world1} to world of player
set {_world2} to world of arg 1
if "%{_world1}%" is not "%{_world2}%":
message "%placeholder(yaml value ""Messages.NotSameWorld"" in ""Trades"", player, player)%"
stop
set {_distance} to yaml value "Trade.Distance" of "Trades"
if {_distance} is a number:
set {_distance} to {_distance} parsed as number
if distance between player and arg 1 is greater than {_distance}:
message "%placeholder(yaml value ""Messages.OutOfDistance"" in ""Trades"", player, player)%"
stop
if {tradetoggle.%uuid of player%} is false:
message "%placeholder(yaml value ""Messages.TradeDisabled"" in ""Trades"", player, player)%"
stop
if arg 1 is not player:
set {_timenow} to unix timestamp of now
set {_timenow} to {_timenow} parsed as number
set {_timenow} to floor({_timenow})
set {_enabled} to yaml value "TradeCooldown.Enabled" of "Trades"
if "%{_enabled}%" is "true":
set {_timeme} to yaml value "TradeCooldown.Timer" of "Trades"
set {_timeme} to {_timeme} parsed as number
if {_timenow} - {trade.%uuid of player%} is less than {_timeme}:
message "%placeholder(yaml value ""Messages.TradeCooldown"" in ""Trades"", player, player)%"
stop
if {tradetoggle.%uuid of arg 1%} is false:
message "%placeholder(yaml value ""Messages.PlayerHasTradingDisabled"" in ""Trades"", player, player)%"
stop
if "%{traderequests.%uuid of arg 1%::*}%" contains "%player%":
loop {traderequests.%uuid of arg 1%::*}:
if "%loop-value%" contains "%player%":
set {_player} to loop-value
set {_split::*} to {_player} split by "-"
set {_before} to {_split::2} parsed as number
set {_now} to unix timestamp of now
set {_now} to {_now} parsed as number
set {_now} to floor({_now})
set {_timethen} to yaml value "Trade.TimeOut" of "Trades"
set {_timethen} to {_timethen} parsed as number
if {_now} - {_before} is less than {_timethen}:
message "%placeholder(yaml value ""Messages.RequestAlreadySent"" in ""Trades"", player, player)%"
stop
else:
loop {traderequests.%uuid of arg 1%::*}:
if "%loop-value%" contains "%player%":
remove loop-value from {traderequests.%uuid of arg 1%::*}
if "%{traderequests.%uuid of player%::*}%" contains "%arg 1%":
if "%{_creative}%" is "false":
if gamemode of player is creative:
message "%placeholder(yaml value ""Messages.NoTradeInCreative"" in ""Trades"", player, player)%"
stop
if gamemode of arg 1 is creative:
message "%placeholder(yaml value ""Messages.NoTradeInCreative2"" in ""Trades"", player, player)%"
stop
if metadata value "TradingWith" of player is set:
message "%placeholder(yaml value ""Messages.AlreadyInTrade"" in ""Trades"", player, player)%"
stop
if metadata value "TradingWith" of arg 1 is set:
message "%placeholder(yaml value ""Messages.AlreadyInTrade"" in ""Trades"", player, player)%"
stop
loop {traderequests.%uuid of player%::*}:
if "%loop-value%" contains "%arg 1%":
remove loop-value from {traderequests.%uuid of player%::*}
loop {traderequests.%uuid of arg 1%::*}:
if "%loop-value%" is "%player%":
remove loop-value from {traderequests.%uuid of arg 1%::*}
set metadata value "TradingWith" of player to "%arg 1%"
set metadata value "TradingWith" of arg 1 to "%player%"
set metadata value "Ready" of player to "No"
set metadata value "Ready" of arg 1 to "No"
set {_count} to 0
loop 36 times:
set {_item} to slot {_count} of player's inventory
set {_item} to {_item} parsed as item type
set {inventory.%uuid of player%.%{_count}%} to {_item}
add 1 to {_count}
set {_count} to 0
loop 36 times:
set {_item} to slot {_count} of arg 1's inventory
set {_item} to {_item} parsed as item type
set {inventory.%uuid of arg 1%.%{_count}%} to {_item}
add 1 to {_count}
open chest with 6 rows named "%placeholder(yaml value ""Messages.GuiName"" in ""Trades"", player, player)%" to the player
open chest with 6 rows named "%placeholder(yaml value ""Messages.GuiName"" in ""Trades"", player, player)%" to arg 1
message "%placeholder(yaml value ""Messages.ClickCorrection"" in ""Trades"", player, player)%"
message "%placeholder(yaml value ""Messages.ClickCorrection"" in ""Trades"", player, player)%" to arg 1
set {_slot} to 4
loop 6 times:
set slot {_slot} of player's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot {_slot} of arg 1's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
add 9 to {_slot}
set slot 45 of player's current inventory to 1 of guiItemCreate("%yaml value ""Accept.ItemID"" in ""Trades""%", "%yaml value ""Accept.Name"" in ""Trades""%", yaml list "Accept.Lore" in "Trades")
set slot 45 of arg 1's current inventory to 1 of guiItemCreate("%yaml value ""Accept.ItemID"" in ""Trades""%", "%yaml value ""Accept.Name"" in ""Trades""%", yaml list "Accept.Lore" in "Trades")
set slot 46 of player's current inventory to 1 of guiItemCreate("%yaml value ""Cancel.ItemID"" in ""Trades""%", "%yaml value ""Cancel.Name"" in ""Trades""%", yaml list "Cancel.Lore" in "Trades")
set slot 46 of arg 1's current inventory to 1 of guiItemCreate("%yaml value ""Cancel.ItemID"" in ""Trades""%", "%yaml value ""Cancel.Name"" in ""Trades""%", yaml list "Cancel.Lore" in "Trades")
set slot 48 of player's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 48 of arg 1's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 53 of player's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 53 of arg 1's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 47 of player's current inventory to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
set slot 47 of arg 1's current inventory to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
set slots integers between 50 and 52 of player's current inventory to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
set slots integers between 50 and 52 of arg 1's current inventory to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
set {_slot} to 5
set {_count} to 0
loop 20 times:
set slot {_slot} of player's current inventory to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
set slot {_slot} of arg 1's current inventory to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
add 1 to {_count}
if {_count} is 4:
set {_count} to 0
add 6 to {_slot}
else:
add 1 to {_slot}
stop
set {trade.%uuid of player%} to unix timestamp of now
set {trade.%uuid of player%} to {trade.%uuid of player%} parsed as number
set {trade.%uuid of player%} to floor({trade.%uuid of player%})
message "%placeholder(yaml value ""Messages.RequestSent"" in ""Trades"", player, arg 1)%"
message "%placeholder(yaml value ""Messages.RequestReceived"" in ""Trades"", player, arg 1)%" to arg 1
set {_time} to unix timestamp of now
set {_time} to {_time} parsed as number
set {_time} to floor({_time})
add "%player%-%{_time}%" to {traderequests.%uuid of arg 1%::*}
else:
message "%placeholder(yaml value ""Messages.TradeSelf"" in ""Trades"", player, arg 1)%"
command /tradetoggle:
trigger:
if player does not have permission "trade.use":
message "%placeholder(yaml value ""Messages.TradeNoPermission"" in ""Trades"", player, player)%"
stop
if {tradetoggle.%uuid of player%} is not set:
set {tradetoggle.%uuid of player%} to true
message "%placeholder(yaml value ""Messages.TradeToggleEnabled"" in ""Trades"", player, player)%"
stop
if {tradetoggle.%uuid of player%} is false:
set {tradetoggle.%uuid of player%} to true
message "%placeholder(yaml value ""Messages.TradeToggleEnabled"" in ""Trades"", player, player)%"
stop
if {tradetoggle.%uuid of player%} is true:
set {tradetoggle.%uuid of player%} to false
message "%placeholder(yaml value ""Messages.TradeToggleDisabled"" in ""Trades"", player, player)%"
stop
on inventory click:
if metadata value "TradingWith" of player is set:
if "%click action%" is not "instant move":
cancel event
if clicked inventory is player's current inventory:
set {_tradingwith} to metadata value "TradingWith" of player
set {_tradingwith} to {_tradingwith} parsed as player
if clicked slot is not 0 or 1 or 2 or 3 or 9 or 10 or 11 or 12 or 18 or 19 or 20 or 21 or 27 or 28 or 29 or 30 or 36 or 37 or 38 or 39:
cancel event
if clicked slot is 46:
close player's inventory
if clicked slot is 45:
if metadata value "timer" of player is set:
stop
if metadata value "Ready" of player is "No":
set metadata value "Ready" of player to "Yes"
set slot 48 of player's current inventory to 1 of guiItemCreate("%yaml value ""Ready.ItemID"" in ""Trades""%", "%yaml value ""Ready.Name"" in ""Trades""%", yaml list "Ready.Lore" in "Trades")
set slot 53 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""Ready.ItemID"" in ""Trades""%", "%yaml value ""Ready.Name"" in ""Trades""%", yaml list "Ready.Lore" in "Trades")
set {_trigger} to true
if {_trigger} is not set:
if metadata value "Ready" of player is "Yes":
set metadata value "Ready" of player to "No"
set slot 48 of player's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 53 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
if metadata value "Ready" of player is "Yes":
if metadata value "Ready" of {_tradingwith} is "Yes":
set metadata value "timer" of player to "true"
set metadata value "timer" of {_tradingwith} to "true"
wait 1 second
set slot 47 of player's current inventory to 1 of guiItemCreate("%yaml value ""StopTimer.ItemID"" in ""Trades""%", "%yaml value ""StopTimer.Name"" in ""Trades""%", yaml list "StopTimer.Lore" in "Trades")
set slot 47 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""StopTimer.ItemID"" in ""Trades""%", "%yaml value ""StopTimer.Name"" in ""Trades""%", yaml list "StopTimer.Lore" in "Trades")
set {_timer} to yaml value "Trade.CountDown" of "Trades"
set {_timer} to {_timer} parsed as a number
while {_timer} is not less than or equal to 0:
if metadata value "timer" of player is set:
if metadata value "timer" of {_tradingwith} is set:
set slot 4 of player's current inventory to {_timer} of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 4 of {_tradingwith}'s current inventory to {_timer} of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 13 of player's current inventory to {_timer} of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 13 of {_tradingwith}'s current inventory to {_timer} of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 22 of player's current inventory to {_timer} of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 22 of {_tradingwith}'s current inventory to {_timer} of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 31 of player's current inventory to {_timer} of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 31 of {_tradingwith}'s current inventory to {_timer} of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 40 of player's current inventory to {_timer} of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 40 of {_tradingwith}'s current inventory to {_timer} of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 49 of player's current inventory to {_timer} of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 49 of {_tradingwith}'s current inventory to {_timer} of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
remove 1 from {_timer}
else:
set {_cancel} to true
exit loop
else:
set {_cancel} to true
exit loop
wait 1 second
if {_cancel} is true:
metadata value "TradingWith" of player is set
metadata value "TradingWith" of {_tradingwith} is set
set slot 47 of player's current inventory to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
set slot 47 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
clear metadata value "timer" of player
clear metadata value "timer" of {_tradingwith}
set metadata value "Ready" of player to "No"
set metadata value "Ready" of {_tradingwith} to "No"
set slot 48 of player's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 53 of player's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
wait 1 ticks
set slot 53 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 48 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 4 of player's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 13 of player's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 22 of player's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 31 of player's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 40 of player's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 49 of player's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 4 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 13 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 22 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 31 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 40 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 49 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
else:
set {_slot} to 0
set {_count} to 0
loop 20 times:
set {_inv} to slot {_slot} of player's current inventory
set {_inv} to {_inv} parsed as item type
add {_inv} to {_reward2::*}
add 1 to {_count}
if {_count} is 4:
set {_count} to 0
add 6 to {_slot}
else:
add 1 to {_slot}
set {_slot} to 0
set {_count} to 0
loop 20 times:
set {_inv} to slot {_slot} of {_tradingwith}'s current inventory
set {_inv} to {_inv} parsed as item type
add {_inv} to {_reward1::*}
add 1 to {_count}
if {_count} is 4:
set {_count} to 0
add 6 to {_slot}
else:
add 1 to {_slot}
set {_count} to 0
loop 36 times:
set {_item} to slot {_count} of player's inventory
set {_item} to {_item} parsed as item type
set {_spacechecker1.%{_count}%} to {_item}
add 1 to {_count}
set {_count} to 0
loop 36 times:
set {_item} to slot {_count} of {_tradingwith}'s inventory
set {_item} to {_item} parsed as item type
set {_spacechecker2.%{_count}%} to {_item}
add 1 to {_count}
loop {_reward1::*}:
if player has enough space for loop-value:
add loop-value to player's inventory
else:
set {_nospace} to true
set {_nospace.%player%} to "%player%"
loop {_reward2::*}:
if {_tradingwith} has enough space for loop-value:
add loop-value to {_tradingwith}'s inventory
else:
set {_nospace} to true
set {_nospace.%{_tradingwith}%} to "%{_tradingwith}%"
if {_nospace} is set:
if {_nospace.%player%} is set:
message "&c%{_nospace.%player%}% doesn't have enough space to accept the trade."
message "&c%{_nospace.%player%}% doesn't have enough space to accept the trade." to {_tradingwith}
if {_nospace.%{_tradingwith}%} is set:
message "&c%{_nospace.%{_tradingwith}%}% does not have enough space to accept the trade."
message "&c%{_nospace.%{_tradingwith}%}% doesn't have enough space to accept the trade." to {_tradingwith}
set {_count} to 0
loop 36 times:
set slot {_count} of player's inventory to {_spacechecker1.%{_count}%}
add 1 to {_count}
set {_count} to 0
loop 36 times:
set slot {_count} of {_p}'s inventory to {_spacechecker2.%{_count}%}
add 1 to {_count}
set metadata value "Ready" of player to "No"
set metadata value "Ready" of {_tradingwith} to "No"
clear metadata value "timer" of player
clear metadata value "timer" of {_tradingwith}
set slot 53 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 48 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
wait 1 ticks
set slot 48 of player's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 53 of player's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
else:
set metadata value "TradeSuccess" of player to "true"
set metadata value "TradeSuccess" of player to "true"
close player's inventory
if clicked slot is 47:
metadata value "timer" of player is set
metadata value "timer" of {_tradingwith} is set
set slot 47 of player's current inventory to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
set slot 47 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
clear metadata value "timer" of player
clear metadata value "timer" of {_tradingwith}
set metadata value "Ready" of player to "No"
set metadata value "Ready" of {_tradingwith} to "No"
set slot 48 of player's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 53 of player's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
wait 1 ticks
set slot 53 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 48 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 4 of player's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 13 of player's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 22 of player's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 31 of player's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 40 of player's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 49 of player's current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 4 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 13 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 22 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 31 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 40 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
set slot 49 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""Divider.ItemID"" in ""Trades""%", "%yaml value ""Divider.Name"" in ""Trades""%", yaml list "Divider.Lore" in "Trades")
else:
if "%click action%" is "instant move":
if metadata value "timer" of player is set:
cancel event
stop
clicked item is not air
set {_p} to metadata value "TradingWith" of player
set {_tradingwith} to {_p} parsed as player
set metadata value "Ready" of player to "No"
set metadata value "Ready" of {_tradingwith} to "No"
set {_573} to yaml value "AddOffer.PlaySound" of "Trades"
if "%{_573}%" is "true":
set {_sound} to yaml value "AddOffer.SoundName" of "Trades"
set {_volume} to yaml value "AddOffer.Volume" of "Trades"
set {_pitch} to yaml value "AddOffer.Pitch" of "Trades"
set {_volume} to {_volume} parsed as number
set {_pitch} to {_pitch} parsed as number
play sound "%{_sound}%" with volume {_volume} with pitch {_pitch} at player's location for player
set slot 53 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 48 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
wait 1 ticks
set slot 48 of player's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 53 of player's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set {_slot} to 0
set {_count} to 0
set {_i} to 0
loop 20 times:
set {_inv.%{_i}%} to slot {_slot} of player's current inventory
set {_inv.%{_i}%} to {_inv.%{_i}%} parsed as item type
if {_inv.%{_i}%} is air:
set {_inv.%{_i}%} to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
add 1 to {_count}
add 1 to {_i}
if {_count} is 4:
set {_count} to 0
add 6 to {_slot}
else:
add 1 to {_slot}
set {_slot} to 5
set {_count} to 0
set {_i} to 0
loop 20 times:
set slot {_slot} of {_tradingwith}'s current inventory to {_inv.%{_i}%}
add 1 to {_count}
add 1 to {_i}
if {_count} is 4:
set {_count} to 0
add 6 to {_slot}
else:
add 1 to {_slot}
else:
clicked item is not air
message "%placeholder(yaml value ""Messages.ClickCorrection"" in ""Trades"", player, player)%"
if clicked inventory is player's inventory:
if "%click action%" is "instant move":
if metadata value "timer" of player is set:
cancel event
stop
clicked item is not air
set {_clickeditem} to 1 of clicked item
set {_name} to getName(clicked item)
set {_lore} to getLore(clicked item)
set {_id} to getID(clicked item)
set {_blacklisted1::*} to all yaml nodes of "TradesBlacklist"
loop {_blacklisted1::*}:
set {_node} to "%loop-value%"
set {_nodes::*} to {_node} split by "."
{_%{_nodes::1}%} is not set
set {_%{_nodes::1}%} to true
add {_nodes::1} to {_finalblacklisted::*}
delete {_node} and {_nodes::*}
loop {_finalblacklisted::*}:
set {_value} to yaml value "%loop-value%.DetectionType" of "TradesBlacklist"
set {_textype} to yaml value "%loop-value%.TextDetectionType" of "TradesBlacklist"
if {_value} is "Name":
if {_textype} is "is":
if {_name} is yaml value "%loop-value%.ItemName" of "TradesBlacklist":
set {_blacklisted} to true
else:
if {_name} contains yaml value "%loop-value%.ItemName" of "TradesBlacklist":
set {_blacklisted} to true
if {_value} is "Lore":
if {_textype} is "is":
if {_lore} is yaml value "%loop-value%.ItemLore" of "TradesBlacklist":
set {_blacklisted} to true
else:
if {_lore} contains yaml value "%loop-value%.ItemLore" of "TradesBlacklist":
set {_blacklisted} to true
if {_value} is "Both":
if {_textype} is "is":
if {_lore} is yaml value "%loop-value%.ItemLore" of "TradesBlacklist":
if {_name} is yaml value "%loop-value%.ItemName" of "TradesBlacklist":
set {_blacklisted} to true
else:
if {_name} contains yaml value "%loop-value%.ItemName" of "TradesBlacklist":
if {_lore} contains yaml value "%loop-value%.ItemLore" of "TradesBlacklist":
set {_blacklisted} to true
if {_value} is "id":
set {_type} to yaml value "%loop-value%.ItemID" of "TradesBlacklist"
set {_type} to {_type} parsed as item
if "%{_clickeditem}%" is "%{_id}%":
set {_blacklisted} to true
if {_value} is "exactitem":
if {_clickeditem} is yaml value "%loop-value%.ExactItem" of "TradesBlacklist":
set {_blacklisted} to true
delete {_value} and {_textype} and {_type}
if {_blacklisted} is set:
message "%placeholder(yaml value ""Messages.BlacklistedItem"" in ""Trades"", player, player)%"
cancel event
stop
set {_slot} to 5
set {_count} to 0
loop 20 times:
set slot {_slot} of player's current inventory to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
set slot {_slot} of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
add 1 to {_count}
if {_count} is 4:
set {_count} to 0
add 6 to {_slot}
else:
add 1 to {_slot}
set {_it} to clicked item
add {_it} to player's current inventory
set clicked item to air
set {_p} to metadata value "TradingWith" of player
set {_tradingwith} to {_p} parsed as player
set metadata value "Ready" of player to "No"
set metadata value "Ready" of {_tradingwith} to "No"
set {_573} to yaml value "AddOffer.PlaySound" of "Trades"
if "%{_573}%" is "true":
set {_sound} to yaml value "AddOffer.SoundName" of "Trades"
set {_volume} to yaml value "AddOffer.Volume" of "Trades"
set {_pitch} to yaml value "AddOffer.Pitch" of "Trades"
set {_volume} to {_volume} parsed as number
set {_pitch} to {_pitch} parsed as number
play sound "%{_sound}%" with volume {_volume} with pitch {_pitch} at player's location for player
set slot 53 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 48 of {_tradingwith}'s current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
wait 1 ticks
set slot 48 of player's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set slot 53 of player's current inventory to 1 of guiItemCreate("%yaml value ""NotReady.ItemID"" in ""Trades""%", "%yaml value ""NotReady.Name"" in ""Trades""%", yaml list "NotReady.Lore" in "Trades")
set {_slot} to 0
set {_count} to 0
set {_i} to 0
loop 20 times:
set {_inv.%{_i}%} to slot {_slot} of player's current inventory
set {_inv.%{_i}%} to {_inv.%{_i}%} parsed as item type
if {_inv.%{_i}%} is air:
set {_inv.%{_i}%} to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
add 1 to {_count}
add 1 to {_i}
if {_count} is 4:
set {_count} to 0
add 6 to {_slot}
else:
add 1 to {_slot}
set {_slot} to 5
set {_count} to 0
set {_i} to 0
loop 20 times:
set slot {_slot} of {_tradingwith}'s current inventory to {_inv.%{_i}%}
add 1 to {_count}
add 1 to {_i}
if {_count} is 4:
set {_count} to 0
add 6 to {_slot}
else:
add 1 to {_slot}
set {_slot} to 0
set {_count} to 0
set {_i} to 0
loop 20 times:
set {_inv.%{_i}%} to slot {_slot} of {_tradingwith}'s current inventory
set {_inv.%{_i}%} to {_inv.%{_i}%} parsed as item type
if {_inv.%{_i}%} is air:
set {_inv.%{_i}%} to 1 of guiItemCreate("%yaml value ""BlankSlot.ItemID"" in ""Trades""%", "%yaml value ""BlankSlot.Name"" in ""Trades""%", yaml list "BlankSlot.Lore" in "Trades")
add 1 to {_count}
add 1 to {_i}
if {_count} is 4:
set {_count} to 0
add 6 to {_slot}
else:
add 1 to {_slot}
set {_slot} to 5
set {_count} to 0
set {_i} to 0
loop 20 times:
set slot {_slot} of player's current inventory to {_inv.%{_i}%}
add 1 to {_count}
add 1 to {_i}
if {_count} is 4:
set {_count} to 0
add 6 to {_slot}
else:
add 1 to {_slot}
wait 1 ticks
set slot 0 of player's inventory to slot 0 of player's inventory
else:
clicked item is not air
message "%placeholder(yaml value ""Messages.ClickCorrection"" in ""Trades"", player, player)%"
on quit:
if metadata value "TradingWith" of player is set:
clear metadata value "TradingWith" of player
clear metadata value "Ready" of player
clear metadata value "timer" of player
set {_count} to 0
loop 36 times:
set slot {_count} of player's inventory to {inventory.%uuid of player%.%{_count}%}
delete {inventory.%uuid of player%.%{_count}%}
add 1 to {_count}
on inventory close:
if metadata value "TradingWith" of player is set:
if metadata value "TradeSuccess" of player is not set:
set {_p} to metadata value "TradingWith" of player
set {_p} to {_p} parsed as player
set {_uuid} to uuid of {_p}
set {_573} to yaml value "TradeCanceled.PlaySound" of "Trades"
if "%{_573}%" is "true":
set {_sound} to yaml value "TradeCanceled.SoundName" of "Trades"
set {_volume} to yaml value "TradeCanceled.Volume" of "Trades"
set {_pitch} to yaml value "TradeCanceled.Pitch" of "Trades"
set {_volume} to {_volume} parsed as number
set {_pitch} to {_pitch} parsed as number
play sound "%{_sound}%" with volume {_volume} with pitch {_pitch} at player's location for player
play sound "%{_sound}%" with volume {_volume} with pitch {_pitch} at {_p}'s location for player
clear metadata value "TradingWith" of {_p}
clear metadata value "TradingWith" of player
clear metadata value "Ready" of {_p}
clear metadata value "Ready" of player
clear metadata value "timer" of {_p}
clear metadata value "timer" of player
close {_p}'s inventory
set {_count} to 0
loop 36 times:
set slot {_count} of player's inventory to {inventory.%uuid of player%.%{_count}%}
delete {inventory.%uuid of player%.%{_count}%}
add 1 to {_count}
set {_count} to 0
loop 36 times:
set slot {_count} of {_p}'s inventory to {inventory.%{_uuid}%.%{_count}%}
delete {inventory.%{_uuid}%.%{_count}%}
add 1 to {_count}
message "%placeholder(yaml value ""Messages.TradeCanceled"" in ""Trades"", player, player)%" to {_p}
message "%placeholder(yaml value ""Messages.TradeCanceled2"" in ""Trades"", player, player)%" to player
else:
set {_p} to metadata value "TradingWith" of player
set {_p} to {_p} parsed as player
set {_uuid} to uuid of {_p}
set {_573} to yaml value "TradeComplete.PlaySound" of "Trades"
if "%{_573}%" is "true":
set {_sound} to yaml value "TradeComplete.SoundName" of "Trades"
set {_volume} to yaml value "TradeComplete.Volume" of "Trades"
set {_pitch} to yaml value "TradeComplete.Pitch" of "Trades"
set {_volume} to {_volume} parsed as number
set {_pitch} to {_pitch} parsed as number
play sound "%{_sound}%" with volume {_volume} with pitch {_pitch} at player's location for player
play sound "%{_sound}%" with volume {_volume} with pitch {_pitch} at {_p}'s location for player
clear metadata value "TradingWith" of {_p}
clear metadata value "TradingWith" of player
clear metadata value "Ready" of {_p}
clear metadata value "Ready" of player
clear metadata value "timer" of {_p}
clear metadata value "timer" of player
clear metadata value "TradeSuccess" of {_p}
clear metadata value "TradeSuccess" of player
close {_p}'s inventory
message "%placeholder(yaml value ""Messages.TradeAccepted"" in ""Trades"", player, player)%" to {_p}
message "%placeholder(yaml value ""Messages.TradeAccepted"" in ""Trades"", player, player)%" to player