mirror of
https://github.com/songoda/UltimateKits.git
synced 2024-11-08 11:41:28 +01:00
More fixes for the kit editor losing your items.
This commit is contained in:
parent
9f1eadced7
commit
84e3f947fb
@ -52,9 +52,8 @@ public class KitEditorGui extends DoubleGui {
|
|||||||
|
|
||||||
setInvItems();
|
setInvItems();
|
||||||
setOnClose((event) -> {
|
setOnClose((event) -> {
|
||||||
this.saveKit(player, inventory, false);
|
|
||||||
if (!isInInventory)
|
|
||||||
restoreItemsInstance();
|
restoreItemsInstance();
|
||||||
|
this.saveKit(player, inventory, false);
|
||||||
CompatibleSound.ENTITY_VILLAGER_YES.play(player);
|
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),
|
setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR),
|
||||||
plugin.getLocale().getMessage("interface.button.exit").getMessage()),
|
plugin.getLocale().getMessage("interface.button.exit").getMessage()),
|
||||||
ClickType.LEFT,
|
ClickType.LEFT,
|
||||||
event -> exit());
|
event -> player.closeInventory());
|
||||||
|
|
||||||
// back button
|
// back button
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
@ -197,6 +196,8 @@ public class KitEditorGui extends DoubleGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void restoreItemsInstance() {
|
private void restoreItemsInstance() {
|
||||||
|
if (!isInInventory)
|
||||||
|
player.getInventory().clear();
|
||||||
setPlayerUnlockedRange(0, 0, 3, 8);
|
setPlayerUnlockedRange(0, 0, 3, 8);
|
||||||
if (stash != null)
|
if (stash != null)
|
||||||
player.getInventory().setContents(stash);
|
player.getInventory().setContents(stash);
|
||||||
|
Loading…
Reference in New Issue
Block a user