Add back button to GUI
This commit is contained in:
parent
10a057bab5
commit
f4b67c93c3
|
|
@ -20,7 +20,7 @@ public class ChallengesGUI extends GUIInventory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decorate(Player player) {
|
public void decorate(Player player) {
|
||||||
makeMenuBar();
|
makeMenuBar(player);
|
||||||
super.decorate(player);
|
super.decorate(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.alttd.cometskyblock.gui;
|
package com.alttd.cometskyblock.gui;
|
||||||
|
|
||||||
import com.alttd.cometskyblock.island.Island;
|
import com.alttd.cometskyblock.island.Island;
|
||||||
|
import com.alttd.cometskyblock.island.gui.IslandGUI;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
|
|
@ -97,10 +98,11 @@ public abstract class GUIInventory implements GUI, InventoryHolder {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void makeMenuBar() {
|
protected void makeMenuBar(Player player) {
|
||||||
for (int i = inventory.getSize() - 9; i < inventory.getSize(); ++i) {
|
for (int i = inventory.getSize() - 9; i < inventory.getSize(); ++i) {
|
||||||
addButton(i, createMenuButton(Material.BLACK_STAINED_GLASS_PANE, "", new ArrayList<>(), event -> {}));
|
addButton(i, createMenuButton(Material.BLACK_STAINED_GLASS_PANE, "", new ArrayList<>(), event -> {}));
|
||||||
}
|
}
|
||||||
|
createMainMenuButton(player, inventory.getSize() - 9);
|
||||||
makeTopBar();
|
makeTopBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,6 +146,13 @@ public abstract class GUIInventory implements GUI, InventoryHolder {
|
||||||
addButton(slot, createMenuButton(Material.BARRIER, "<yellow>Exit Menu", new ArrayList<>(), event -> player.closeInventory()));
|
addButton(slot, createMenuButton(Material.BARRIER, "<yellow>Exit Menu", new ArrayList<>(), event -> player.closeInventory()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void createMainMenuButton(Player player, int slot) {
|
||||||
|
addButton(slot, createMenuButton(Material.BARRIER, "<yellow>Island Menu", new ArrayList<>(), event -> {
|
||||||
|
player.closeInventory();
|
||||||
|
new IslandGUI(island).open(player);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
protected GUIButton createPlayerHeadMenuButton(UUID uuid, Consumer<InventoryClickEvent> eventConsumer) {
|
protected GUIButton createPlayerHeadMenuButton(UUID uuid, Consumer<InventoryClickEvent> eventConsumer) {
|
||||||
return new GUIButton()
|
return new GUIButton()
|
||||||
.creator(player -> createPlayerHead(uuid))
|
.creator(player -> createPlayerHead(uuid))
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public class IslandGUI extends GUIInventory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decorate(Player player) {
|
public void decorate(Player player) {
|
||||||
makeMenuBar();
|
makeMenuBar(player);
|
||||||
|
|
||||||
// Island GO
|
// Island GO
|
||||||
addButton(10, createMenuButton(Material.GRASS_BLOCK, "Visit your island!", new ArrayList<>(), event -> {
|
addButton(10, createMenuButton(Material.GRASS_BLOCK, "Visit your island!", new ArrayList<>(), event -> {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public class MembersGUI extends GUIInventory {
|
||||||
@Override
|
@Override
|
||||||
public void decorate(Player player) {
|
public void decorate(Player player) {
|
||||||
currentSlot = 9;
|
currentSlot = 9;
|
||||||
makeMenuBar();
|
makeMenuBar(player);
|
||||||
|
|
||||||
int startIndex = pageIndex * 45;
|
int startIndex = pageIndex * 45;
|
||||||
for (int i = startIndex; i < island.members().size(); i++) {
|
for (int i = startIndex; i < island.members().size(); i++) {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public class SettingsGUI extends GUIInventory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decorate(Player player) {
|
public void decorate(Player player) {
|
||||||
makeMenuBar();
|
makeMenuBar(player);
|
||||||
// setHome
|
// setHome
|
||||||
addButton(10, createMenuButton(Material.GRASS_BLOCK, "Set your IslandSpawn location!", List.of(
|
addButton(10, createMenuButton(Material.GRASS_BLOCK, "Set your IslandSpawn location!", List.of(
|
||||||
"<white>This sets your island spawn location to your current location."
|
"<white>This sets your island spawn location to your current location."
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public class UpgradesGUI extends GUIInventory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decorate(Player player) {
|
public void decorate(Player player) {
|
||||||
makeMenuBar();
|
makeMenuBar(player);
|
||||||
MessageConfiguration.Island islandMessages = CometSkyBlockPlugin.instance().messagesConfiguration().get().island();
|
MessageConfiguration.Island islandMessages = CometSkyBlockPlugin.instance().messagesConfiguration().get().island();
|
||||||
// Todo - move to handlers, add costs, validation ...
|
// Todo - move to handlers, add costs, validation ...
|
||||||
// WorldBorder
|
// WorldBorder
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user