Skip to content

Commit 8573add

Browse files
committed
- 다른 메뉴에서 바로 넘어가면 오류 뜨는거 해결
- 사운드 추가
1 parent 46f3e88 commit 8573add

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/main/kotlin/strictpvp/virtualStorage/command/OpenCommand.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import org.bukkit.Bukkit
44
import org.bukkit.ChatColor
55
import org.bukkit.Material
66
import org.bukkit.NamespacedKey
7+
import org.bukkit.Sound
78
import org.bukkit.command.Command
89
import org.bukkit.command.CommandExecutor
910
import org.bukkit.command.CommandSender
@@ -68,10 +69,12 @@ class OpenCommand : CommandExecutor, TabCompleter {
6869

6970
if (number == null || number < 1) {
7071
sender.sendMessage("올바른 자연수를 입력해주세요")
72+
player.playSound(player.location, Sound.BLOCK_CHEST_LOCKED, 1.0f, 1.0f)
7173
return true
7274
}
7375
if (StorageLimit.getLimit(player) < number) {
7476
sender.sendMessage("입력하신 숫자가 보유중인 창고의 수보다 큽니다")
77+
player.playSound(player.location, Sound.BLOCK_CHEST_LOCKED, 1.0f, 1.0f)
7578
return true
7679
}
7780

@@ -82,7 +85,9 @@ class OpenCommand : CommandExecutor, TabCompleter {
8285
val items = Save.load(player.uniqueId.toString(), number)
8386
val gui: Inventory = Bukkit.createInventory(null, 54, "${number}번 창고")
8487
items.forEach(gui::setItem)
88+
player.closeInventory()
8589
player.openInventory(gui)
90+
player.playSound(player.location, Sound.BLOCK_ENDER_CHEST_OPEN, 1.0f, 1.0f)
8691
InventoryCloseListener.openPlayerList.add(player)
8792

8893
return true

src/main/kotlin/strictpvp/virtualStorage/listener/InventoryCloseListener.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package strictpvp.virtualStorage.listener
22

3+
import org.bukkit.Sound
34
import org.bukkit.entity.Player
45
import org.bukkit.event.EventHandler
56
import org.bukkit.event.Listener
@@ -17,6 +18,8 @@ class InventoryCloseListener : Listener {
1718
if (!openPlayerList.contains(event.player))
1819
return
1920

21+
(event.player as Player).playSound(event.player.location, Sound.BLOCK_ENDER_CHEST_CLOSE, 1.0f, 1.0f)
22+
2023
val list: MutableMap<Int, ItemStack> = mutableMapOf()
2124

2225
for (slot in 0..53) {

0 commit comments

Comments
 (0)