feat: improved gui based on feedback
This commit is contained in:
parent
5413b7aca9
commit
5bbf4c3ab9
14 changed files with 45 additions and 95 deletions
|
@ -1,5 +1,6 @@
|
||||||
package net.artelnatif.nicko;
|
package net.artelnatif.nicko;
|
||||||
|
|
||||||
|
import net.artelnatif.nicko.gui.items.common.OptionUnavailable;
|
||||||
import xyz.xenondevs.invui.gui.structure.Structure;
|
import xyz.xenondevs.invui.gui.structure.Structure;
|
||||||
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
||||||
import xyz.xenondevs.invui.item.impl.SimpleItem;
|
import xyz.xenondevs.invui.item.impl.SimpleItem;
|
||||||
|
@ -101,6 +102,7 @@ public class NickoBukkit extends JavaPlugin {
|
||||||
|
|
||||||
Structure.addGlobalIngredient('#', new SimpleItem(new ItemBuilder(Material.BLACK_STAINED_GLASS_PANE).setDisplayName(" ")));
|
Structure.addGlobalIngredient('#', new SimpleItem(new ItemBuilder(Material.BLACK_STAINED_GLASS_PANE).setDisplayName(" ")));
|
||||||
Structure.addGlobalIngredient('%', new SimpleItem(new ItemBuilder(Material.ORANGE_STAINED_GLASS_PANE).setDisplayName(" ")));
|
Structure.addGlobalIngredient('%', new SimpleItem(new ItemBuilder(Material.ORANGE_STAINED_GLASS_PANE).setDisplayName(" ")));
|
||||||
|
Structure.addGlobalIngredient('U', new OptionUnavailable());
|
||||||
Structure.addGlobalIngredient('E', new ExitGUI());
|
Structure.addGlobalIngredient('E', new ExitGUI());
|
||||||
|
|
||||||
new PlaceHolderHook(this).hook();
|
new PlaceHolderHook(this).hook();
|
||||||
|
|
|
@ -7,6 +7,8 @@ import xyz.xenondevs.invui.gui.Gui;
|
||||||
import xyz.xenondevs.invui.window.Window;
|
import xyz.xenondevs.invui.window.Window;
|
||||||
|
|
||||||
public class AdminGUI {
|
public class AdminGUI {
|
||||||
|
public static final String TITLE = "Nicko > Administration";
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final Gui gui;
|
private final Gui gui;
|
||||||
|
|
||||||
|
@ -14,7 +16,7 @@ public class AdminGUI {
|
||||||
this.gui = Gui.normal()
|
this.gui = Gui.normal()
|
||||||
.setStructure(
|
.setStructure(
|
||||||
"# # # # # # # # #",
|
"# # # # # # # # #",
|
||||||
"# % % X X S % % #",
|
"# # # S U U # # #",
|
||||||
"B # # # # # # # #"
|
"B # # # # # # # #"
|
||||||
)
|
)
|
||||||
.addIngredient('S', new ManageCache())
|
.addIngredient('S', new ManageCache())
|
||||||
|
@ -28,6 +30,6 @@ public class AdminGUI {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open() {
|
public void open() {
|
||||||
Window.single().setGui(gui).setTitle("Nicko").open(player);
|
Window.single().setGui(gui).setTitle(TITLE).open(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
package net.artelnatif.nicko.gui;
|
|
||||||
|
|
||||||
import net.artelnatif.nicko.gui.items.common.GoBack;
|
|
||||||
import net.artelnatif.nicko.gui.items.skin.ChangeName;
|
|
||||||
import net.artelnatif.nicko.gui.items.skin.ChangeNameAndSkin;
|
|
||||||
import net.artelnatif.nicko.gui.items.skin.ChangeSkin;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import xyz.xenondevs.invui.gui.Gui;
|
|
||||||
import xyz.xenondevs.invui.window.Window;
|
|
||||||
|
|
||||||
public class AppearanceManagerGUI {
|
|
||||||
private final Player player;
|
|
||||||
private final Gui gui;
|
|
||||||
|
|
||||||
public AppearanceManagerGUI(Player player) {
|
|
||||||
this.gui = Gui.normal()
|
|
||||||
.setStructure(
|
|
||||||
"# # # # # # # # #",
|
|
||||||
"# % % % % % % % #",
|
|
||||||
"# % # N A S # % #",
|
|
||||||
"# % % % % % % % #",
|
|
||||||
"B # # # # # # # #"
|
|
||||||
)
|
|
||||||
.addIngredient('N', new ChangeName())
|
|
||||||
.addIngredient('A', new ChangeNameAndSkin())
|
|
||||||
.addIngredient('S', new ChangeSkin())
|
|
||||||
.addIngredient('B', new GoBack(new MainGUI(player).getGUI()))
|
|
||||||
.build();
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void open() {
|
|
||||||
Window.single().setGui(gui).setTitle("Nicko").open(player);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +1,11 @@
|
||||||
package net.artelnatif.nicko.gui;
|
package net.artelnatif.nicko.gui;
|
||||||
|
|
||||||
import net.artelnatif.nicko.gui.items.main.AdminSubGUI;
|
import net.artelnatif.nicko.gui.items.main.AdminSubGUI;
|
||||||
import net.artelnatif.nicko.gui.items.main.AppearanceManagerSubGUI;
|
|
||||||
import net.artelnatif.nicko.gui.items.main.ResetAppearance;
|
import net.artelnatif.nicko.gui.items.main.ResetAppearance;
|
||||||
import net.artelnatif.nicko.gui.items.main.SettingsSubGUI;
|
import net.artelnatif.nicko.gui.items.main.SettingsSubGUI;
|
||||||
|
import net.artelnatif.nicko.gui.items.skin.ChangeName;
|
||||||
|
import net.artelnatif.nicko.gui.items.skin.ChangeNameAndSkin;
|
||||||
|
import net.artelnatif.nicko.gui.items.skin.ChangeSkin;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import xyz.xenondevs.invui.gui.Gui;
|
import xyz.xenondevs.invui.gui.Gui;
|
||||||
import xyz.xenondevs.invui.window.Window;
|
import xyz.xenondevs.invui.window.Window;
|
||||||
|
@ -15,19 +17,19 @@ public class MainGUI {
|
||||||
public MainGUI(Player player) {
|
public MainGUI(Player player) {
|
||||||
final String[] dynamicStructure = new String[]{
|
final String[] dynamicStructure = new String[]{
|
||||||
"# # # # # # # # #",
|
"# # # # # # # # #",
|
||||||
"# % % % A % % % #",
|
"# # # N B S # # #",
|
||||||
"# % # R S P # % #",
|
"E P A # # # # # R"};
|
||||||
"# % % % % % % % #",
|
|
||||||
"E # # # # # # # #"};
|
|
||||||
|
|
||||||
if (!player.hasPermission("nicko.admin") || !player.isOp()) {
|
if (!player.hasPermission("nicko.admin") || !player.isOp()) {
|
||||||
dynamicStructure[3] = dynamicStructure[3].replace("A", "#");
|
dynamicStructure[2] = dynamicStructure[2].replace("A", "#");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.gui = Gui.normal()
|
this.gui = Gui.normal()
|
||||||
.setStructure(dynamicStructure)
|
.setStructure(dynamicStructure)
|
||||||
.addIngredient('R', new ResetAppearance())
|
.addIngredient('R', new ResetAppearance())
|
||||||
.addIngredient('S', new AppearanceManagerSubGUI())
|
.addIngredient('N', new ChangeName())
|
||||||
|
.addIngredient('B', new ChangeNameAndSkin())
|
||||||
|
.addIngredient('S', new ChangeSkin(player))
|
||||||
.addIngredient('P', new SettingsSubGUI())
|
.addIngredient('P', new SettingsSubGUI())
|
||||||
.addIngredient('A', new AdminSubGUI())
|
.addIngredient('A', new AdminSubGUI())
|
||||||
.build();
|
.build();
|
||||||
|
@ -39,6 +41,6 @@ public class MainGUI {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open() {
|
public void open() {
|
||||||
Window.single().setGui(gui).setTitle("Nicko").open(player);
|
Window.single().setGui(gui).setTitle("Nicko - Home").open(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,19 +3,20 @@ package net.artelnatif.nicko.gui;
|
||||||
import net.artelnatif.nicko.gui.items.common.GoBack;
|
import net.artelnatif.nicko.gui.items.common.GoBack;
|
||||||
import net.artelnatif.nicko.gui.items.settings.BungeeCordCycling;
|
import net.artelnatif.nicko.gui.items.settings.BungeeCordCycling;
|
||||||
import net.artelnatif.nicko.gui.items.settings.LanguageCycling;
|
import net.artelnatif.nicko.gui.items.settings.LanguageCycling;
|
||||||
import net.artelnatif.nicko.gui.items.settings.OptionUnavailable;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import xyz.xenondevs.invui.gui.Gui;
|
import xyz.xenondevs.invui.gui.Gui;
|
||||||
import xyz.xenondevs.invui.window.Window;
|
import xyz.xenondevs.invui.window.Window;
|
||||||
|
|
||||||
public class SettingsGUI {
|
public class SettingsGUI {
|
||||||
|
public static final String TITLE = "Nicko > Settings";
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final Gui gui;
|
private final Gui gui;
|
||||||
|
|
||||||
public SettingsGUI(Player player) {
|
public SettingsGUI(Player player) {
|
||||||
final String[] dynamicStructure = new String[]{
|
final String[] dynamicStructure = new String[]{
|
||||||
"# # # # # # # # #",
|
"# # # # # # # # #",
|
||||||
"# % % L U T % % #",
|
"# # # L T U # # #",
|
||||||
"B # # # # # # # #"
|
"B # # # # # # # #"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,12 +28,11 @@ public class SettingsGUI {
|
||||||
.addIngredient('B', new GoBack(new MainGUI(player).getGUI()))
|
.addIngredient('B', new GoBack(new MainGUI(player).getGUI()))
|
||||||
.addIngredient('L', new LanguageCycling().get(player))
|
.addIngredient('L', new LanguageCycling().get(player))
|
||||||
.addIngredient('T', new BungeeCordCycling().get(player))
|
.addIngredient('T', new BungeeCordCycling().get(player))
|
||||||
.addIngredient('U', new OptionUnavailable())
|
|
||||||
.build();
|
.build();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open() {
|
public void open() {
|
||||||
Window.single().setGui(gui).setTitle("Nicko").open(player);
|
Window.single().setGui(gui).setTitle(TITLE).open(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ import xyz.xenondevs.invui.gui.Gui;
|
||||||
import xyz.xenondevs.invui.window.Window;
|
import xyz.xenondevs.invui.window.Window;
|
||||||
|
|
||||||
public class CacheManagementGUI {
|
public class CacheManagementGUI {
|
||||||
|
public static final String TITLE = "Nicko > Admin... > Cache";
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final Gui gui;
|
private final Gui gui;
|
||||||
|
|
||||||
|
@ -29,6 +31,6 @@ public class CacheManagementGUI {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open() {
|
public void open() {
|
||||||
Window.single().setGui(gui).setTitle("Nicko").open(player);
|
Window.single().setGui(gui).setTitle(TITLE).open(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,13 @@ import java.util.Optional;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class CacheDetailledGUI {
|
public class CacheDetailedGUI {
|
||||||
|
public static final String TITLE = "... > Cache > Invalidate";
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final Gui gui;
|
private final Gui gui;
|
||||||
|
|
||||||
public CacheDetailledGUI(Player player) {
|
public CacheDetailedGUI(Player player) {
|
||||||
final ConcurrentMap<String, Optional<MojangSkin>> skins = NickoBukkit.getInstance().getMojangAPI().getCache().asMap();
|
final ConcurrentMap<String, Optional<MojangSkin>> skins = NickoBukkit.getInstance().getMojangAPI().getCache().asMap();
|
||||||
final List<String> loadedSkins = skins.entrySet().stream()
|
final List<String> loadedSkins = skins.entrySet().stream()
|
||||||
.filter(entry -> entry.getValue().isPresent())
|
.filter(entry -> entry.getValue().isPresent())
|
||||||
|
@ -36,12 +38,13 @@ public class CacheDetailledGUI {
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
gui = ScrollGui.items(guiItemBuilder -> {
|
gui = ScrollGui.items(guiItemBuilder -> {
|
||||||
guiItemBuilder.setStructure("% # # # # # # # %",
|
guiItemBuilder.setStructure(
|
||||||
|
"# # # # # # # # #",
|
||||||
"# x x x x x x U #",
|
"# x x x x x x U #",
|
||||||
"# x x x x x x # #",
|
"# x x x x x x # #",
|
||||||
"# x x x x x x D #",
|
|
||||||
"# x x x x x x # #",
|
"# x x x x x x # #",
|
||||||
"B # # # # # # # %");
|
"# x x x x x x D #",
|
||||||
|
"B # # # # # # # #");
|
||||||
guiItemBuilder.addIngredient('x', Markers.CONTENT_LIST_SLOT_HORIZONTAL);
|
guiItemBuilder.addIngredient('x', Markers.CONTENT_LIST_SLOT_HORIZONTAL);
|
||||||
guiItemBuilder.addIngredient('U', new ScrollUp());
|
guiItemBuilder.addIngredient('U', new ScrollUp());
|
||||||
guiItemBuilder.addIngredient('D', new ScrollDown());
|
guiItemBuilder.addIngredient('D', new ScrollDown());
|
||||||
|
@ -53,6 +56,6 @@ public class CacheDetailledGUI {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open() {
|
public void open() {
|
||||||
Window.single().setGui(gui).setTitle("Nicko").open(player);
|
Window.single().setGui(gui).setTitle(TITLE).open(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package net.artelnatif.nicko.gui.items.admin.cache;
|
package net.artelnatif.nicko.gui.items.admin.cache;
|
||||||
|
|
||||||
import net.artelnatif.nicko.gui.admin.cache.CacheDetailledGUI;
|
import net.artelnatif.nicko.gui.admin.cache.CacheDetailedGUI;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
||||||
|
@ -17,7 +17,7 @@ public class CacheDetailed extends SuppliedItem {
|
||||||
final ClickType clickType = click.getClickType();
|
final ClickType clickType = click.getClickType();
|
||||||
if (clickType.isLeftClick() || clickType.isRightClick()) {
|
if (clickType.isLeftClick() || clickType.isRightClick()) {
|
||||||
click.getEvent().getView().close();
|
click.getEvent().getView().close();
|
||||||
new CacheDetailledGUI(click.getPlayer()).open();
|
new CacheDetailedGUI(click.getPlayer()).open();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -15,6 +15,7 @@ public class GoBack extends SuppliedItem {
|
||||||
return builder;
|
return builder;
|
||||||
}, click -> {
|
}, click -> {
|
||||||
click.getEvent().getView().close();
|
click.getEvent().getView().close();
|
||||||
|
// TODO: 4/1/23 Get title of parent GUI
|
||||||
Window.single().setGui(gui).setTitle("Nicko").open(click.getPlayer());
|
Window.single().setGui(gui).setTitle("Nicko").open(click.getPlayer());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package net.artelnatif.nicko.gui.items.settings;
|
package net.artelnatif.nicko.gui.items.common;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
||||||
|
@ -8,9 +8,8 @@ public class OptionUnavailable extends SuppliedItem {
|
||||||
public OptionUnavailable() {
|
public OptionUnavailable() {
|
||||||
super(() -> {
|
super(() -> {
|
||||||
final ItemBuilder builder = new ItemBuilder(Material.RED_TERRACOTTA);
|
final ItemBuilder builder = new ItemBuilder(Material.RED_TERRACOTTA);
|
||||||
builder.setDisplayName("§cOption unavailable :(");
|
builder.setDisplayName("§cFeature unavailable :(");
|
||||||
builder.addLoreLines("§7This option is disabled due to the",
|
builder.addLoreLines("§7This button is disabled.");
|
||||||
"§7feature it controls being disabled.");
|
|
||||||
return builder;
|
return builder;
|
||||||
}, click -> true);
|
}, click -> true);
|
||||||
}
|
}
|
|
@ -1,26 +0,0 @@
|
||||||
package net.artelnatif.nicko.gui.items.main;
|
|
||||||
|
|
||||||
import net.artelnatif.nicko.gui.AppearanceManagerGUI;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
|
||||||
import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
|
||||||
|
|
||||||
public class AppearanceManagerSubGUI extends SuppliedItem {
|
|
||||||
public AppearanceManagerSubGUI() {
|
|
||||||
super(() -> {
|
|
||||||
final ItemBuilder builder = new ItemBuilder(Material.ENDER_EYE);
|
|
||||||
builder.setDisplayName("§fManage §6appearance§f...");
|
|
||||||
builder.addLoreLines("§7Access the appearance manager.");
|
|
||||||
return builder;
|
|
||||||
}, (click) -> {
|
|
||||||
final ClickType clickType = click.getClickType();
|
|
||||||
if (clickType.isLeftClick() || clickType.isRightClick()) {
|
|
||||||
click.getEvent().getView().close();
|
|
||||||
new AppearanceManagerGUI(click.getPlayer()).open();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -10,7 +10,7 @@ public class ChangeName extends SuppliedItem {
|
||||||
public ChangeName() {
|
public ChangeName() {
|
||||||
super(() -> {
|
super(() -> {
|
||||||
final ItemBuilder builder = new ItemBuilder(Material.NAME_TAG);
|
final ItemBuilder builder = new ItemBuilder(Material.NAME_TAG);
|
||||||
builder.setDisplayName("§6Name §fchange");
|
builder.setDisplayName("§fChange §6name");
|
||||||
builder.addLoreLines("§7Only change your name.");
|
builder.addLoreLines("§7Only change your name.");
|
||||||
return builder;
|
return builder;
|
||||||
}, click -> {
|
}, click -> {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
||||||
public class ChangeNameAndSkin extends SuppliedItem {
|
public class ChangeNameAndSkin extends SuppliedItem {
|
||||||
public ChangeNameAndSkin() {
|
public ChangeNameAndSkin() {
|
||||||
super(() -> {
|
super(() -> {
|
||||||
final ItemBuilder builder = new ItemBuilder(Material.ENDER_PEARL);
|
final ItemBuilder builder = new ItemBuilder(Material.END_PORTAL_FRAME);
|
||||||
builder.setDisplayName("§6Skin §fand §6name §fchange");
|
builder.setDisplayName("§6Skin §fand §6name §fchange");
|
||||||
builder.addLoreLines("§7Change both your skin and name.");
|
builder.addLoreLines("§7Change both your skin and name.");
|
||||||
return builder;
|
return builder;
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package net.artelnatif.nicko.gui.items.skin;
|
package net.artelnatif.nicko.gui.items.skin;
|
||||||
|
|
||||||
import net.artelnatif.nicko.anvil.AnvilManager;
|
import net.artelnatif.nicko.anvil.AnvilManager;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
import xyz.xenondevs.invui.item.builder.SkullBuilder;
|
||||||
import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
||||||
|
|
||||||
public class ChangeSkin extends SuppliedItem {
|
public class ChangeSkin extends SuppliedItem {
|
||||||
public ChangeSkin() {
|
public ChangeSkin(Player player) {
|
||||||
super(() -> {
|
super(() -> {
|
||||||
final ItemBuilder builder = new ItemBuilder(Material.ENDER_PEARL);
|
final SkullBuilder builder = new SkullBuilder(player.getName());
|
||||||
builder.setDisplayName("§6Skin §fchange");
|
builder.setDisplayName("§fChange §6skin");
|
||||||
builder.addLoreLines("§7Only change your skin.");
|
builder.addLoreLines("§7Only change your skin.");
|
||||||
return builder;
|
return builder;
|
||||||
}, click -> {
|
}, click -> {
|
||||||
|
|
Loading…
Reference in a new issue