Update ShopItem.kt
This commit is contained in:
@@ -21,6 +21,7 @@ import com.willfp.ecoshop.shop.gui.BuyMenu
|
||||
import com.willfp.ecoshop.shop.gui.SellMenu
|
||||
import com.willfp.ecoshop.shop.gui.ShopItemSlot
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.ChatColor
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.OfflinePlayer
|
||||
import org.bukkit.entity.Player
|
||||
@@ -43,6 +44,10 @@ class ShopItem(
|
||||
|
||||
val commands = config.getStringsOrNull("command")
|
||||
|
||||
val sellCommand = config.getStringsOrNull("sell.sell-commands")
|
||||
|
||||
val sellItemMessage = config.getStringsOrNull("sell.sell-message")
|
||||
|
||||
val item = if (config.has("item")) Items.lookup(config.getString("item")) else null
|
||||
|
||||
val buyAmount = config.getIntOrNull("buy.amount") ?: 1
|
||||
@@ -256,6 +261,7 @@ class ShopItem(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
player.profile.write(timesBoughtKey, player.profile.read(timesBoughtKey) + 1)
|
||||
|
||||
if (shop?.isBroadcasting == true) {
|
||||
@@ -337,6 +343,25 @@ class ShopItem(
|
||||
|
||||
shop?.sellSound?.playTo(player)
|
||||
|
||||
if (sellCommand != null) {
|
||||
for (command in sellCommand) {
|
||||
Bukkit.dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
command.replace("%player%", player.name)
|
||||
.replace("%amount%", amountSold.toString())
|
||||
)
|
||||
}
|
||||
}
|
||||
if (sellItemMessage != null) {
|
||||
for (message in sellItemMessage) {
|
||||
player.sendMessage(
|
||||
message.formatEco()
|
||||
.replace("%player%", player.name)
|
||||
.replace("%amount%", amountSold.toString())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return amountSold
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user