feat: text blocks and consistent code
This commit is contained in:
parent
4d1b6c0318
commit
61727ecbe8
4 changed files with 38 additions and 31 deletions
|
@ -14,20 +14,22 @@ import org.bukkit.entity.Player;
|
|||
public class MainGUI {
|
||||
private final Player player;
|
||||
private final GUI gui;
|
||||
private final String[] structureIngredients = new String[]{
|
||||
"# # # # # # # # #",
|
||||
"# % % % % % % % #",
|
||||
"# % # R S P # % #",
|
||||
"# % % % % % % % #",
|
||||
"E A # # # # # # #"};
|
||||
private final String structure = """
|
||||
# # # # # # # # #
|
||||
# % % % % % % % #
|
||||
# % # R S P # % #
|
||||
# % % % A % % % #
|
||||
E # # # # # # # #
|
||||
""";
|
||||
|
||||
public MainGUI(Player player) {
|
||||
if (!player.hasPermission("nicko.admin") || !player.isOp()) {
|
||||
structureIngredients[3] = structureIngredients[3].replace("A", "#");
|
||||
final String[] rows = structure.split("\n");
|
||||
rows[3] = rows[3].replace("A", "#");
|
||||
}
|
||||
|
||||
this.gui = new GUIBuilder<>(GUIType.NORMAL)
|
||||
.setStructure(new Structure(structureIngredients))
|
||||
.setStructure(new Structure(structure))
|
||||
.addIngredient('R', new ResetItem())
|
||||
.addIngredient('S', new SkinItem())
|
||||
.addIngredient('P', new SettingsItem())
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
package net.artelnatif.nicko.gui;
|
||||
package net.artelnatif.nicko.gui.sub;
|
||||
|
||||
import de.studiocode.invui.gui.GUI;
|
||||
import de.studiocode.invui.gui.builder.GUIBuilder;
|
||||
import de.studiocode.invui.gui.builder.guitype.GUIType;
|
||||
import de.studiocode.invui.gui.structure.Structure;
|
||||
import de.studiocode.invui.window.impl.single.SimpleWindow;
|
||||
import net.artelnatif.nicko.gui.MainGUI;
|
||||
import net.artelnatif.nicko.gui.items.common.BackItem;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class AdminPanelGUI {
|
||||
private final Player player;
|
||||
private final GUI gui;
|
||||
private final String structure = """
|
||||
# # # # # # # # #
|
||||
# % % X X X % % #
|
||||
B # # # # # # # #
|
||||
""";
|
||||
|
||||
public AdminPanelGUI(Player player) {
|
||||
final Structure structure = new Structure("# # # # # # # # #",
|
||||
"# % % X X X % % #",
|
||||
"B # # # # # # # #");
|
||||
structure.addIngredient('B', new BackItem(new MainGUI(player).getGUI()));
|
||||
this.gui = new GUIBuilder<>(GUIType.NORMAL)
|
||||
.setStructure(structure)
|
||||
.addIngredient('B', new BackItem(new MainGUI(player).getGUI()))
|
||||
.build();
|
||||
this.player = player;
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
package net.artelnatif.nicko.gui;
|
||||
package net.artelnatif.nicko.gui.sub;
|
||||
|
||||
import de.studiocode.invui.gui.GUI;
|
||||
import de.studiocode.invui.gui.builder.GUIBuilder;
|
||||
import de.studiocode.invui.gui.builder.guitype.GUIType;
|
||||
import de.studiocode.invui.gui.structure.Structure;
|
||||
import de.studiocode.invui.window.impl.single.SimpleWindow;
|
||||
import net.artelnatif.nicko.gui.MainGUI;
|
||||
import net.artelnatif.nicko.gui.items.common.BackItem;
|
||||
import net.artelnatif.nicko.gui.items.skin.ChangeNameAndSkinItem;
|
||||
import net.artelnatif.nicko.gui.items.skin.ChangeNameItem;
|
||||
|
@ -14,16 +15,17 @@ import org.bukkit.entity.Player;
|
|||
public class AppearanceGUI {
|
||||
private final Player player;
|
||||
private final GUI gui;
|
||||
private final String[] structureIngredients = new String[]{
|
||||
"# # # # # # # # #",
|
||||
"# % % % % % % % #",
|
||||
"# % # N A S # % #",
|
||||
"# % % % % % % % #",
|
||||
"B # # # # # # # #"};
|
||||
private final String structure = """
|
||||
# # # # # # # # #
|
||||
# % % % % % % % #
|
||||
# % # N A S # % #
|
||||
# % % % % % % % #
|
||||
B # # # # # # # #
|
||||
""";
|
||||
|
||||
public AppearanceGUI(Player player) {
|
||||
this.gui = new GUIBuilder<>(GUIType.NORMAL)
|
||||
.setStructure(new Structure(structureIngredients))
|
||||
.setStructure(new Structure(structure))
|
||||
.addIngredient('N', new ChangeNameItem())
|
||||
.addIngredient('A', new ChangeNameAndSkinItem())
|
||||
.addIngredient('S', new ChangeSkinItem())
|
|
@ -1,10 +1,11 @@
|
|||
package net.artelnatif.nicko.gui;
|
||||
package net.artelnatif.nicko.gui.sub;
|
||||
|
||||
import de.studiocode.invui.gui.GUI;
|
||||
import de.studiocode.invui.gui.builder.GUIBuilder;
|
||||
import de.studiocode.invui.gui.builder.guitype.GUIType;
|
||||
import de.studiocode.invui.window.impl.single.SimpleWindow;
|
||||
import net.artelnatif.nicko.NickoBukkit;
|
||||
import net.artelnatif.nicko.gui.MainGUI;
|
||||
import net.artelnatif.nicko.gui.items.common.BackItem;
|
||||
import net.artelnatif.nicko.gui.items.settings.BungeeCordCyclingItem;
|
||||
import net.artelnatif.nicko.gui.items.settings.LanguageCyclingItem;
|
||||
|
@ -13,20 +14,20 @@ import org.bukkit.entity.Player;
|
|||
public class SettingsGUI {
|
||||
private final Player player;
|
||||
private final GUI gui;
|
||||
|
||||
private final String[] structureIngredients = new String[]{
|
||||
"# # # # # # # # #",
|
||||
"# % % L # T % % #",
|
||||
"B # # # # # # # #"
|
||||
};
|
||||
private final String structure = """
|
||||
# # # # # # # # #
|
||||
# % % L # T % % #
|
||||
B # # # # # # # #
|
||||
""";
|
||||
|
||||
public SettingsGUI(Player player) {
|
||||
if (!NickoBukkit.getInstance().getNickoConfig().isBungeecordSupport()) {
|
||||
structureIngredients[1] = structureIngredients[1].replace("T", "#");
|
||||
final String[] rows = structure.split("\n");
|
||||
rows[1] = rows[1].replace("T", "#");
|
||||
}
|
||||
|
||||
this.gui = new GUIBuilder<>(GUIType.NORMAL)
|
||||
.setStructure(structureIngredients)
|
||||
.setStructure(structure)
|
||||
.addIngredient('B', new BackItem(new MainGUI(player).getGUI()))
|
||||
.addIngredient('L', new LanguageCyclingItem().get(player))
|
||||
.addIngredient('T', new BungeeCordCyclingItem().get(player))
|
Loading…
Reference in a new issue