Skip to content

Commit

Permalink
fix: call addToStashIfEnabled asynchronously
Browse files Browse the repository at this point in the history
  • Loading branch information
acrylic-style committed Oct 12, 2023
1 parent 16277e4 commit f473f11
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "net.azisaba"
version = "6.7.6"
version = "6.7.7"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
Expand Down
20 changes: 12 additions & 8 deletions src/main/java/com/github/mori01231/lifecore/vote/VoteReward.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ data class MythicItemReward(
plugin.logger.warning("Mythic Item $id not found.")
} else {
player.inventory.addItem(item).values.apply {
if (isNotEmpty() && all { ItemUtil.addToStashIfEnabled(player.uniqueId, it) }) {
player.sendMessage("${ChatColor.RED}インベントリがいっぱいのため、Stashに入りました。")
player.sendMessage("${ChatColor.AQUA}/pickupstash${ChatColor.RED}で回収できます。")
}
Bukkit.getScheduler().runTaskAsynchronously(plugin, Runnable {
if (isNotEmpty() && all { ItemUtil.addToStashIfEnabled(player.uniqueId, it) }) {
player.sendMessage("${ChatColor.RED}インベントリがいっぱいのため、Stashに入りました。")
player.sendMessage("${ChatColor.AQUA}/pickupstash${ChatColor.RED}で回収できます。")
}
})
}
}
}
Expand All @@ -69,10 +71,12 @@ data class ItemReward(
) : VoteReward {
override fun execute(plugin: LifeCore, player: Player) {
player.inventory.addItem(ItemStack(id, amount)).values.apply {
if (isNotEmpty() && all { ItemUtil.addToStashIfEnabled(player.uniqueId, it) }) {
player.sendMessage("${ChatColor.RED}インベントリがいっぱいのため、Stashに入りました。")
player.sendMessage("${ChatColor.AQUA}/pickupstash${ChatColor.RED}で回収できます。")
}
Bukkit.getScheduler().runTaskAsynchronously(plugin, Runnable {
if (isNotEmpty() && all { ItemUtil.addToStashIfEnabled(player.uniqueId, it) }) {
player.sendMessage("${ChatColor.RED}インベントリがいっぱいのため、Stashに入りました。")
player.sendMessage("${ChatColor.AQUA}/pickupstash${ChatColor.RED}で回収できます。")
}
})
}
}
}
Expand Down

0 comments on commit f473f11

Please sign in to comment.