mirror of
https://github.com/songoda/UltimateKits.git
synced 2024-11-25 19:55:22 +01:00
Fixed an issue regarding editing menu navigation.
This commit is contained in:
parent
ca8dbc5fb2
commit
a899ccf426
@ -32,6 +32,7 @@ public class KitEditorGui extends DoubleGui {
|
||||
private final UltimateKits plugin;
|
||||
private final Kit kit;
|
||||
private final Player player;
|
||||
private final Gui back;
|
||||
|
||||
private boolean isInFunction = false;
|
||||
private boolean isInInventory = false;
|
||||
@ -39,13 +40,13 @@ public class KitEditorGui extends DoubleGui {
|
||||
private ItemStack[] stash;
|
||||
|
||||
public KitEditorGui(UltimateKits plugin, Player player, Kit kit, Gui back) {
|
||||
super(back);
|
||||
super(6);
|
||||
this.plugin = plugin;
|
||||
this.kit = kit;
|
||||
this.player = player;
|
||||
this.back = back;
|
||||
|
||||
setDefaultItem(null);
|
||||
setRows(6);
|
||||
setTitle(plugin.getLocale().getMessage("interface.kiteditor.title")
|
||||
.processPlaceholder("name", kit.getName())
|
||||
.getMessage());
|
||||
@ -77,7 +78,10 @@ public class KitEditorGui extends DoubleGui {
|
||||
setButton(0, 0, GuiUtils.createButtonItem(ItemUtils.getCustomHead("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"),
|
||||
plugin.getLocale().getMessage("interface.button.back").getMessage()),
|
||||
ClickType.LEFT,
|
||||
event -> event.player.closeInventory());
|
||||
event -> {
|
||||
player.closeInventory();
|
||||
guiManager.showGUI(player, back);
|
||||
});
|
||||
|
||||
// info icon
|
||||
setItem(0, 4, GuiUtils.createButtonItem(CompatibleMaterial.CHEST,
|
||||
@ -212,7 +216,7 @@ public class KitEditorGui extends DoubleGui {
|
||||
plugin.getLocale().getMessage("interface.kiteditor.generaloptionslore").getMessage().split("\\|")),
|
||||
(event) -> {
|
||||
player.closeInventory();
|
||||
guiManager.showGUI(player, new KitGeneralOptionsGui(plugin, player, kit, this));
|
||||
guiManager.showGUI(player, new KitGeneralOptionsGui(plugin, player, kit, back));
|
||||
});
|
||||
|
||||
setPlayerButton(1, GuiUtils.createButtonItem(CompatibleMaterial.EMERALD,
|
||||
@ -220,7 +224,7 @@ public class KitEditorGui extends DoubleGui {
|
||||
plugin.getLocale().getMessage("interface.kiteditor.sellingoptionslore").getMessage().split("\\|")),
|
||||
(event) -> {
|
||||
player.closeInventory();
|
||||
guiManager.showGUI(player, new KitSellingOptionsGui(plugin, player, kit, this));
|
||||
guiManager.showGUI(player, new KitSellingOptionsGui(plugin, player, kit, back));
|
||||
});
|
||||
|
||||
setPlayerButton(3, GuiUtils.createButtonItem(CompatibleMaterial.ITEM_FRAME,
|
||||
@ -228,7 +232,7 @@ public class KitEditorGui extends DoubleGui {
|
||||
plugin.getLocale().getMessage("interface.kiteditor.guioptionslore").getMessage().split("\\|")),
|
||||
(event) -> {
|
||||
player.closeInventory();
|
||||
guiManager.showGUI(player, new KitGuiOptionsGui(plugin, player, kit, this));
|
||||
guiManager.showGUI(player, new KitGuiOptionsGui(plugin, player, kit, back));
|
||||
});
|
||||
|
||||
setPlayerButton(4, GuiUtils.createButtonItem(CompatibleMaterial.PAPER,
|
||||
@ -314,6 +318,23 @@ public class KitEditorGui extends DoubleGui {
|
||||
}
|
||||
setInvItems();
|
||||
});
|
||||
|
||||
setPlayerButton(8, GuiUtils.createButtonItem(CompatibleMaterial.CHEST,
|
||||
plugin.getLocale().getMessage("interface.kiteditor.animation").getMessage(),
|
||||
plugin.getLocale().getMessage("interface.kiteditor.animationlore")
|
||||
.getMessage().split("\\|")),
|
||||
(event) -> {
|
||||
AnvilGui gui = new AnvilGui(player, this);
|
||||
gui.setTitle("Enter a name for the new kit");
|
||||
gui.setAction(evnt -> {
|
||||
Kit newKit = kit.clone(gui.getInputText());
|
||||
plugin.getKitManager().addKit(newKit);
|
||||
player.closeInventory();
|
||||
guiManager.showGUI(player, new KitEditorGui(plugin, player, newKit, null));
|
||||
paint();
|
||||
});
|
||||
guiManager.showGUI(player, gui);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,8 +16,7 @@ import org.bukkit.event.inventory.ClickType;
|
||||
public class KitGeneralOptionsGui extends Gui {
|
||||
|
||||
public KitGeneralOptionsGui(UltimateKits plugin, Player player, Kit kit, Gui back) {
|
||||
super(back);
|
||||
setRows(3);
|
||||
super(3);
|
||||
setTitle(plugin.getLocale().getMessage("interface.kitoptions.title")
|
||||
.processPlaceholder("kit", kit.getName())
|
||||
.getMessage());
|
||||
@ -35,7 +34,7 @@ public class KitGeneralOptionsGui extends Gui {
|
||||
setButton(0, 0, GuiUtils.createButtonItem(ItemUtils.getCustomHead("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"),
|
||||
plugin.getLocale().getMessage("interface.button.back").getMessage()),
|
||||
ClickType.LEFT,
|
||||
event -> event.player.closeInventory());
|
||||
event -> guiManager.showGUI(player, new KitEditorGui(plugin, player, kit, back)));
|
||||
|
||||
// edit delay
|
||||
setButton(1, 2, GuiUtils.createButtonItem(CompatibleMaterial.CLOCK,
|
||||
|
@ -21,11 +21,10 @@ public class KitGuiOptionsGui extends Gui {
|
||||
private final Player player;
|
||||
|
||||
public KitGuiOptionsGui(UltimateKits plugin, Player player, Kit kit, Gui back) {
|
||||
super(back);
|
||||
super(3);
|
||||
this.plugin = plugin;
|
||||
this.kit = kit;
|
||||
this.player = player;
|
||||
setRows(3);
|
||||
setTitle(plugin.getLocale().getMessage("interface.kitblock.title")
|
||||
.processPlaceholder("kit", kit.getName())
|
||||
.getMessage());
|
||||
@ -44,7 +43,7 @@ public class KitGuiOptionsGui extends Gui {
|
||||
setButton(0, 0, GuiUtils.createButtonItem(ItemUtils.getCustomHead("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"),
|
||||
plugin.getLocale().getMessage("interface.button.back").getMessage()),
|
||||
ClickType.LEFT,
|
||||
event -> event.player.closeInventory());
|
||||
event -> guiManager.showGUI(player, new KitEditorGui(plugin, player, kit, back)));
|
||||
paint();
|
||||
}
|
||||
|
||||
|
@ -20,11 +20,10 @@ public class KitSellingOptionsGui extends Gui {
|
||||
private final Kit kit;
|
||||
|
||||
public KitSellingOptionsGui(UltimateKits plugin, Player player, Kit kit, Gui back) {
|
||||
super(back);
|
||||
super(3);
|
||||
this.plugin = plugin;
|
||||
this.player = player;
|
||||
this.kit = kit;
|
||||
setRows(3);
|
||||
setTitle(plugin.getLocale().getMessage("interface.kitblock.title")
|
||||
.processPlaceholder("kit", kit.getName())
|
||||
.getMessage());
|
||||
@ -42,7 +41,7 @@ public class KitSellingOptionsGui extends Gui {
|
||||
setButton(0, 0, GuiUtils.createButtonItem(ItemUtils.getCustomHead("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"),
|
||||
plugin.getLocale().getMessage("interface.button.back").getMessage()),
|
||||
ClickType.LEFT,
|
||||
event -> event.player.closeInventory());
|
||||
event -> guiManager.showGUI(player, new KitEditorGui(plugin, player, kit, back)));
|
||||
paint();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user