From 94240a10e71f279eb3f0fec933b8f8096d407a5b Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 21 May 2024 13:15:09 +0200 Subject: [PATCH] Update BauGui stuff --- .../src/de/steamwar/bausystem/gui/BauGUI.java | 12 ++++++------ .../steamwar/bausystem/gui/BauGuiBauGuiItem.java | 6 +++--- .../bausystem/gui/editor/BauGuiEditor.java | 15 ++++++++------- .../bausystem/gui/editor/BauGuiEditorGuiItem.java | 4 ++-- .../de/steamwar/bausystem/BauSystemPlugin.java | 12 ++++++++++++ 5 files changed, 31 insertions(+), 18 deletions(-) diff --git a/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGUI.java b/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGUI.java index 64fc2eb3..dafd505d 100644 --- a/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGUI.java +++ b/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGUI.java @@ -19,7 +19,7 @@ package de.steamwar.bausystem.gui; -import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.BauSystemPlugin; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.gui.editor.BauGuiMapping; @@ -51,7 +51,7 @@ public class BauGUI { public static ItemStack getGUI_ITEM(Player p) { ItemStack GUI_ITEM = new ItemStack(Material.NETHER_STAR); ItemMeta meta = GUI_ITEM.getItemMeta(); - meta.setDisplayName(ChatColor.YELLOW + BauSystem.MESSAGE.parse("GUI_NAME", p)); + meta.setDisplayName(ChatColor.YELLOW + BauSystemPlugin.MESSAGE.parse("GUI_NAME", p)); GUI_ITEM.setItemMeta(meta); return GUI_ITEM; } @@ -68,7 +68,7 @@ public class BauGUI { OPEN_INVS.add(p); } BauGuiMapping mapping = BauGuiMapping.getGuiMapping(p); - SWInventory inv = new SWInventory(p, mapping.getSize(), BauSystem.MESSAGE.parse("GUI_NAME", p)); + SWInventory inv = new SWInventory(p, mapping.getSize(), BauSystemPlugin.MESSAGE.parse("GUI_NAME", p)); getITEMS().values().forEach(item -> { if (!mapping.isShown(item.getId())) { return; @@ -81,7 +81,7 @@ public class BauGUI { } } else { p.closeInventory(); - BauSystem.MESSAGE.send("NO_PERMISSION", p); + BauSystemPlugin.MESSAGE.send("NO_PERMISSION", p); } }); }); @@ -108,9 +108,9 @@ public class BauGUI { if (!permission.hasPermission(p)) { List lore = meta.getLore(); if (lore == null) { - lore = Collections.singletonList(BauSystem.MESSAGE.parse("NO_PERMISSION", p)); + lore = Collections.singletonList(BauSystemPlugin.MESSAGE.parse("NO_PERMISSION", p)); } else { - lore.add(BauSystem.MESSAGE.parse("NO_PERMISSION", p)); + lore.add(BauSystemPlugin.MESSAGE.parse("NO_PERMISSION", p)); } meta.setLore(lore); } diff --git a/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGuiBauGuiItem.java b/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGuiBauGuiItem.java index 6113d62e..d48c8ba1 100644 --- a/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGuiBauGuiItem.java +++ b/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGuiBauGuiItem.java @@ -19,7 +19,7 @@ package de.steamwar.bausystem.gui; -import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.BauSystemPlugin; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; @@ -41,8 +41,8 @@ public class BauGuiBauGuiItem extends BauGuiItem { @Override public ItemStack getItem(Player player) { - return new SWItem(Material.NETHER_STAR, ChatColor.YELLOW + BauSystem.MESSAGE.parse("GUI_NAME", player), - Arrays.asList(BauSystem.MESSAGE.parse("GUI_ITEM_LORE1", player), BauSystem.MESSAGE.parse("GUI_ITEM_LORE2", player)), false, clickType -> { + return new SWItem(Material.NETHER_STAR, ChatColor.YELLOW + BauSystemPlugin.MESSAGE.parse("GUI_NAME", player), + Arrays.asList(BauSystemPlugin.MESSAGE.parse("GUI_ITEM_LORE1", player), BauSystemPlugin.MESSAGE.parse("GUI_ITEM_LORE2", player)), false, clickType -> { }).getItemStack(); } diff --git a/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditor.java b/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditor.java index 6c4bdad9..e9df8327 100644 --- a/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditor.java +++ b/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditor.java @@ -20,6 +20,7 @@ package de.steamwar.bausystem.gui.editor; import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.BauSystemPlugin; import de.steamwar.bausystem.gui.BauGUI; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; @@ -54,7 +55,7 @@ public class BauGuiEditor implements Listener { public static void openGuiEditor(Player p, ItemStack cursor) { BauGuiMapping mapping = BauGuiMapping.getGuiMapping(p); - Inventory inv = Bukkit.createInventory(null, mapping.getSize() + 9, BauSystem.MESSAGE.parse("GUI_EDITOR_TITLE", p)); + Inventory inv = Bukkit.createInventory(null, mapping.getSize() + 9, BauSystemPlugin.MESSAGE.parse("GUI_EDITOR_TITLE", p)); for (Map.Entry e : mapping.getMapping().entrySet()) { if (e.getValue() >= 0) { if (e.getValue() < mapping.getSize()) { @@ -67,13 +68,13 @@ public class BauGuiEditor implements Listener { inv.setItem(j, new SWItem(Material.WHITE_STAINED_GLASS_PANE, "").getItemStack()); } - inv.setItem(mapping.getSize() + 3, new SWItem(mapping.getSize() == 9 * 5 ? Material.GRAY_STAINED_GLASS_PANE : Material.LIME_STAINED_GLASS_PANE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_ROW_P", p)).getItemStack()); - inv.setItem(mapping.getSize() + 2, new SWItem(mapping.getSize() == 9 ? Material.GRAY_STAINED_GLASS_PANE : Material.RED_STAINED_GLASS_PANE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_ROW_M", p)).getItemStack()); + inv.setItem(mapping.getSize() + 3, new SWItem(mapping.getSize() == 9 * 5 ? Material.GRAY_STAINED_GLASS_PANE : Material.LIME_STAINED_GLASS_PANE, BauSystemPlugin.MESSAGE.parse("GUI_EDITOR_ITEM_ROW_P", p)).getItemStack()); + inv.setItem(mapping.getSize() + 2, new SWItem(mapping.getSize() == 9 ? Material.GRAY_STAINED_GLASS_PANE : Material.RED_STAINED_GLASS_PANE, BauSystemPlugin.MESSAGE.parse("GUI_EDITOR_ITEM_ROW_M", p)).getItemStack()); - inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> { + inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystemPlugin.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystemPlugin.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> { }).getItemStack()); - inv.setItem(mapping.getSize() + 6, new SWItem(Material.SCUTE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack()); - inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).getItemStack()); + inv.setItem(mapping.getSize() + 6, new SWItem(Material.SCUTE, BauSystemPlugin.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack()); + inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystemPlugin.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).getItemStack()); p.openInventory(inv); p.getOpenInventory().setCursor(cursor == null ? new SWItem().getItemStack() : cursor); @@ -152,7 +153,7 @@ public class BauGuiEditor implements Listener { if (items.isEmpty()) { return; } - SWListInv inv = new SWListInv<>(p, BauSystem.MESSAGE.parse("GUI_EDITOR_TITLE_MORE", p), items, (clickType, item) -> { + SWListInv inv = new SWListInv<>(p, BauSystemPlugin.MESSAGE.parse("GUI_EDITOR_TITLE_MORE", p), items, (clickType, item) -> { openGuiEditor(p, addId(item.getItem(p), item.getId())); }); inv.open(); diff --git a/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditorGuiItem.java b/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditorGuiItem.java index 4c7c97cc..0852ad01 100644 --- a/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditorGuiItem.java +++ b/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditorGuiItem.java @@ -19,7 +19,7 @@ package de.steamwar.bausystem.gui.editor; -import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.BauSystemPlugin; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; @@ -43,7 +43,7 @@ public class BauGuiEditorGuiItem extends BauGuiItem { @Override public ItemStack getItem(Player player) { - return new SWItem(Material.IRON_PICKAXE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_NAME", player)).getItemStack(); + return new SWItem(Material.IRON_PICKAXE, BauSystemPlugin.MESSAGE.parse("GUI_EDITOR_ITEM_NAME", player)).getItemStack(); } @Override diff --git a/BauSystem_PluginBase/src/de/steamwar/bausystem/BauSystemPlugin.java b/BauSystem_PluginBase/src/de/steamwar/bausystem/BauSystemPlugin.java index 1b77a2c3..9e3d273e 100644 --- a/BauSystem_PluginBase/src/de/steamwar/bausystem/BauSystemPlugin.java +++ b/BauSystem_PluginBase/src/de/steamwar/bausystem/BauSystemPlugin.java @@ -19,6 +19,8 @@ package de.steamwar.bausystem; +import de.steamwar.bausystem.permission.PermissionSystem; +import de.steamwar.bausystem.region.RegionSystem; import de.steamwar.message.Message; import lombok.Getter; import org.bukkit.Bukkit; @@ -39,6 +41,15 @@ public class BauSystemPlugin extends JavaPlugin { MESSAGE = new Message("BauSystem", getClassLoader()); instance = this; + try { + Bukkit.getLogger().log(Level.INFO, PermissionSystem.impl.getClass() + " impl loaded for PermissionSystem"); + Bukkit.getLogger().log(Level.INFO, RegionSystem.impl.getClass() + " impl loaded for RegionSystem"); + } catch (Exception e) { + Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e); + Bukkit.shutdown(); + System.exit(1); + } + try { Class clazz = Class.forName("de.steamwar.bausystem.LinkageUtils"); Method method = clazz.getMethod("link"); @@ -58,6 +69,7 @@ public class BauSystemPlugin extends JavaPlugin { method.invoke(null); } catch (Exception e) { Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e); + Bukkit.shutdown(); } } }