fix: text blocks are not supported by lib

This commit is contained in:
aro 2023-01-15 13:02:01 +01:00
parent 61727ecbe8
commit 9d396befea
8 changed files with 36 additions and 32 deletions

View file

@ -14,18 +14,16 @@ import org.bukkit.entity.Player;
public class MainGUI {
private final Player player;
private final GUI gui;
private final String structure = """
# # # # # # # # #
# % % % % % % % #
# % # R S P # % #
# % % % A % % % #
E # # # # # # # #
""";
private final String[] structure = new String[]{
"# # # # # # # # #",
"# % % % A % % % #",
"# % # R S P # % #",
"# % % % % % % % #",
"E # # # # # # # #"};
public MainGUI(Player player) {
if (!player.hasPermission("nicko.admin") || !player.isOp()) {
final String[] rows = structure.split("\n");
rows[3] = rows[3].replace("A", "#");
structure[3] = structure[3].replace("A", "#");
}
this.gui = new GUIBuilder<>(GUIType.NORMAL)

View file

@ -0,0 +1,4 @@
package net.artelnatif.nicko.gui.items.admin;
public class SkinInvalidatorItem {
}

View file

@ -3,17 +3,21 @@ package net.artelnatif.nicko.gui.items.main;
import de.studiocode.invui.item.ItemProvider;
import de.studiocode.invui.item.builder.ItemBuilder;
import de.studiocode.invui.item.impl.BaseItem;
import net.artelnatif.nicko.gui.AdminPanelGUI;
import net.artelnatif.nicko.gui.sub.AdminPanelGUI;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemFlag;
import org.jetbrains.annotations.NotNull;
public class AdminItem extends BaseItem {
@Override
public ItemProvider getItemProvider() {
final ItemBuilder builder = new ItemBuilder(Material.REDSTONE_TORCH);
final ItemBuilder builder = new ItemBuilder(Material.COMMAND_BLOCK);
builder.addEnchantment(Enchantment.DAMAGE_ALL, 1, false);
builder.addItemFlags(ItemFlag.HIDE_ENCHANTS);
builder.setDisplayName("§cAdministration panel...");
builder.addLoreLines("§7Access the administration panel.");
return builder;

View file

@ -3,7 +3,7 @@ package net.artelnatif.nicko.gui.items.main;
import de.studiocode.invui.item.ItemProvider;
import de.studiocode.invui.item.builder.ItemBuilder;
import de.studiocode.invui.item.impl.BaseItem;
import net.artelnatif.nicko.gui.SettingsGUI;
import net.artelnatif.nicko.gui.sub.SettingsGUI;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;

View file

@ -3,7 +3,7 @@ package net.artelnatif.nicko.gui.items.main;
import de.studiocode.invui.item.ItemProvider;
import de.studiocode.invui.item.builder.ItemBuilder;
import de.studiocode.invui.item.impl.BaseItem;
import net.artelnatif.nicko.gui.AppearanceGUI;
import net.artelnatif.nicko.gui.sub.AppearanceGUI;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;

View file

@ -11,11 +11,11 @@ import org.bukkit.entity.Player;
public class AdminPanelGUI {
private final Player player;
private final GUI gui;
private final String structure = """
# # # # # # # # #
# % % X X X % % #
B # # # # # # # #
""";
private final String[] structure = new String[]{
"# # # # # # # # #",
"# % % X X X % % #",
"B # # # # # # # #"
};
public AdminPanelGUI(Player player) {
this.gui = new GUIBuilder<>(GUIType.NORMAL)

View file

@ -15,13 +15,12 @@ import org.bukkit.entity.Player;
public class AppearanceGUI {
private final Player player;
private final GUI gui;
private final String structure = """
# # # # # # # # #
# % % % % % % % #
# % # N A S # % #
# % % % % % % % #
B # # # # # # # #
""";
private final String[] structure = new String[]{
"# # # # # # # # #",
"# % % % % % % % #",
"# % # N A S # % #",
"# % % % % % % % #",
"B # # # # # # # #"};
public AppearanceGUI(Player player) {
this.gui = new GUIBuilder<>(GUIType.NORMAL)

View file

@ -14,16 +14,15 @@ import org.bukkit.entity.Player;
public class SettingsGUI {
private final Player player;
private final GUI gui;
private final String structure = """
# # # # # # # # #
# % % L # T % % #
B # # # # # # # #
""";
private final String[] structure = new String[]{
"# # # # # # # # #",
"# % % L # T % % #",
"B # # # # # # # #"
};
public SettingsGUI(Player player) {
if (!NickoBukkit.getInstance().getNickoConfig().isBungeecordSupport()) {
final String[] rows = structure.split("\n");
rows[1] = rows[1].replace("T", "#");
structure[1] = structure[1].replace("T", "#");
}
this.gui = new GUIBuilder<>(GUIType.NORMAL)