Skip to content
This repository was archived by the owner on Feb 16, 2022. It is now read-only.

Commit ebe43db

Browse files
committed
api(inventory): CustomInventory::close, closeAll を追加
1 parent f673924 commit ebe43db

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ repositories {
265265
}
266266
267267
dependencies {
268-
api('com.github.sya-ri:EasySpigotAPI:2.3.1') {
268+
api('com.github.sya-ri:EasySpigotAPI:2.3.2') {
269269
exclude group: 'org.spigotmc', module: 'spigot-api'
270270
}
271271
}
@@ -279,7 +279,7 @@ repositories {
279279
}
280280

281281
dependencies {
282-
api("com.github.sya-ri:EasySpigotAPI:2.3.1") {
282+
api("com.github.sya-ri:EasySpigotAPI:2.3.2") {
283283
exclude(group = "org.spigotmc", module = "spigot-api")
284284
}
285285
}
@@ -305,7 +305,7 @@ configurations {
305305
}
306306
307307
dependencies {
308-
shadowApi('com.github.sya-ri:EasySpigotAPI:2.3.1') {
308+
shadowApi('com.github.sya-ri:EasySpigotAPI:2.3.2') {
309309
exclude group: 'org.spigotmc', module: 'spigot-api'
310310
}
311311
}
@@ -330,7 +330,7 @@ repositories {
330330
}
331331

332332
dependencies {
333-
shadowApi("com.github.sya-ri:EasySpigotAPI:2.3.1") {
333+
shadowApi("com.github.sya-ri:EasySpigotAPI:2.3.2") {
334334
exclude(group = "org.spigotmc", module = "spigot-api")
335335
}
336336
}

api/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77
}
88

99
group = "com.github.sya-ri.spigot.api"
10-
version = "2.3.1"
10+
version = "2.3.2"
1111

1212
bukkit {
1313
name = "EasySpigotAPI"

api/src/main/kotlin/com/github/syari/spigot/api/inventory/CustomInventory.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.github.syari.spigot.api.item.itemStack
77
import com.github.syari.spigot.api.scheduler.runTaskLater
88
import com.github.syari.spigot.api.uuid.UUIDPlayer
99
import org.bukkit.Material
10+
import org.bukkit.entity.HumanEntity
1011
import org.bukkit.entity.Player
1112
import org.bukkit.event.inventory.InventoryClickEvent
1213
import org.bukkit.event.inventory.InventoryCloseEvent
@@ -215,4 +216,21 @@ class CustomInventory internal constructor(
215216
player.openInventory(inventory)
216217
player.inventoryPlayerData = InventoryPlayerData(id, isCancel, onClick, onClose, clickEvents)
217218
}
219+
220+
/**
221+
* プレイヤーのインベントリを閉じる。
222+
* @param player 対象プレイヤー
223+
* @since 2.3.2
224+
*/
225+
fun close(player: Player) {
226+
player.closeInventory()
227+
}
228+
229+
/**
230+
* このインベントリを開いている全プレイヤーのインベントリを閉じる。
231+
* @since 2.3.2
232+
*/
233+
fun closeAll() {
234+
inventory.viewers.toList().forEach(HumanEntity::closeInventory)
235+
}
218236
}

0 commit comments

Comments
 (0)