Fix unregistering the wrong GUI on InventoryCloseEvent (#69)
* fix unregistering the wrong gui * removed unused import * fix indentation
This commit is contained in:
@@ -3,7 +3,6 @@ package net.axay.kspigot.chat;
|
|||||||
import net.kyori.adventure.text.format.TextColor;
|
import net.kyori.adventure.text.format.TextColor;
|
||||||
import net.kyori.adventure.text.format.TextDecoration;
|
import net.kyori.adventure.text.format.TextDecoration;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@@ -99,7 +99,9 @@ class GUIIndividual<T : ForInventory>(
|
|||||||
init {
|
init {
|
||||||
if (resetOnClose || data.onClose != null) {
|
if (resetOnClose || data.onClose != null) {
|
||||||
listen<InventoryCloseEvent> {
|
listen<InventoryCloseEvent> {
|
||||||
if (data.onClose != null && playerInstances[it.player]?.bukkitInventory == it.inventory) {
|
if (playerInstances[it.player]?.bukkitInventory != it.inventory) return@listen
|
||||||
|
|
||||||
|
if (data.onClose != null) {
|
||||||
data.onClose.invoke(GUICloseEvent(it, playerInstances[it.player]!!, it.player as Player))
|
data.onClose.invoke(GUICloseEvent(it, playerInstances[it.player]!!, it.player as Player))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user