More fixes for the kit editor losing your items.

This commit is contained in:
Brianna 2020-03-24 10:58:55 -04:00
parent 9f1eadced7
commit 84e3f947fb

View File

@ -52,9 +52,8 @@ public class KitEditorGui extends DoubleGui {
setInvItems();
setOnClose((event) -> {
this.saveKit(player, inventory, false);
if (!isInInventory)
restoreItemsInstance();
this.saveKit(player, inventory, false);
CompatibleSound.ENTITY_VILLAGER_YES.play(player);
});
@ -72,7 +71,7 @@ public class KitEditorGui extends DoubleGui {
setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR),
plugin.getLocale().getMessage("interface.button.exit").getMessage()),
ClickType.LEFT,
event -> exit());
event -> player.closeInventory());
// back button
if (parent != null)
@ -197,6 +196,8 @@ public class KitEditorGui extends DoubleGui {
}
private void restoreItemsInstance() {
if (!isInInventory)
player.getInventory().clear();
setPlayerUnlockedRange(0, 0, 3, 8);
if (stash != null)
player.getInventory().setContents(stash);