Some refactoring
Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
1c166d10d7
Commit
6f24ca0f18
@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.bau;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
@ -36,10 +36,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class BauInfoGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class BauInfoBauGuiItem extends BauGuiItem {
|
||||
|
||||
public BauInfoGuiItem() {
|
||||
public BauInfoBauGuiItem() {
|
||||
super(7);
|
||||
}
|
||||
|
@ -20,17 +20,17 @@
|
||||
package de.steamwar.bausystem.features.detonator;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class DetonatorGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class DetonatorBauGuiItem extends BauGuiItem {
|
||||
|
||||
public DetonatorGuiItem() {
|
||||
public DetonatorBauGuiItem() {
|
||||
super(8);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.features.gui.editor.BauGuiMapping;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.UtilityClass;
|
||||
@ -39,7 +39,7 @@ import java.util.*;
|
||||
public class BauGUI {
|
||||
|
||||
@Getter
|
||||
private static final HashMap<Integer, GuiItem> ITEMS = new HashMap<>();
|
||||
private static final HashMap<Integer, BauGuiItem> ITEMS = new HashMap<>();
|
||||
|
||||
private static final Set<Player> OPEN_INVS = new HashSet<>();
|
||||
private static boolean updating = false;
|
||||
@ -54,7 +54,7 @@ public class BauGUI {
|
||||
GUI_ITEM.setItemMeta(meta);
|
||||
}
|
||||
|
||||
public static void addItem(GuiItem item) {
|
||||
public static void addItem(BauGuiItem item) {
|
||||
ITEMS.put(item.getId(), item);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.gui;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@ -32,10 +32,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class BauGuiGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class BauGuiBauGuiItem extends BauGuiItem {
|
||||
|
||||
public BauGuiGuiItem() {
|
||||
public BauGuiBauGuiItem() {
|
||||
super(14);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.gui.editor;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@ -45,10 +45,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Linked(LinkageType.LISTENER)
|
||||
public class BauGuiEditor implements Listener {
|
||||
@ -74,7 +71,8 @@ public class BauGuiEditor implements Listener {
|
||||
inv.setItem(mapping.getSize() + 3, new SWItem(mapping.getSize() == 9 * 5 ? Material.GRAY_STAINED_GLASS_PANE : Material.LIME_STAINED_GLASS_PANE, ColorConfig.HIGHLIGHT + "+1 Zeile").getItemStack());
|
||||
inv.setItem(mapping.getSize() + 2, new SWItem(mapping.getSize() == 9 ? Material.GRAY_STAINED_GLASS_PANE : Material.RED_STAINED_GLASS_PANE, ColorConfig.HIGHLIGHT + "-1 Zeile").getItemStack());
|
||||
|
||||
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, ColorConfig.ERROR + "Trashcan").getItemStack());
|
||||
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, ColorConfig.ERROR + "Trashcan", Arrays.asList(ColorConfig.BASE + "Item hier rein Legen"), false, clickType -> {
|
||||
}).getItemStack());
|
||||
inv.setItem(mapping.getSize() + 6, new SWItem(Material.SCUTE, ColorConfig.HIGHLIGHT + "Mehr Items").getItemStack());
|
||||
|
||||
p.openInventory(inv);
|
||||
@ -116,28 +114,34 @@ public class BauGuiEditor implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (i.getType()) {
|
||||
case RED_STAINED_GLASS_PANE:
|
||||
event.setCancelled(true);
|
||||
if (event.getSlot() - mapping.getSize() >= 0) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
switch (event.getSlot() - mapping.getSize()) {
|
||||
case 2:
|
||||
if (mapping.getSize() == 9) {
|
||||
return;
|
||||
}
|
||||
saveMapping(p);
|
||||
mapping.setSize(mapping.getSize() - 9);
|
||||
openGuiEditor(p, event.getCursor());
|
||||
break;
|
||||
case LIME_STAINED_GLASS_PANE:
|
||||
event.setCancelled(true);
|
||||
case 3:
|
||||
if (mapping.getSize() == 9 * 5) {
|
||||
return;
|
||||
}
|
||||
saveMapping(p);
|
||||
mapping.setSize(mapping.getSize() + 9);
|
||||
openGuiEditor(p, event.getCursor());
|
||||
break;
|
||||
case BARRIER:
|
||||
event.setCancelled(true);
|
||||
case 5:
|
||||
event.getView().setCursor(new SWItem().getItemStack());
|
||||
break;
|
||||
case SCUTE:
|
||||
event.setCancelled(true);
|
||||
case 6:
|
||||
saveMapping(p);
|
||||
List<SWListInv.SWListEntry<GuiItem>> items = new ArrayList<>();
|
||||
for (GuiItem item : BauGUI.getITEMS().values()) {
|
||||
List<SWListInv.SWListEntry<BauGuiItem>> items = new ArrayList<>();
|
||||
for (BauGuiItem item : BauGUI.getITEMS().values()) {
|
||||
if (mapping.isShown(item.getId())) {
|
||||
continue;
|
||||
}
|
||||
@ -148,15 +152,11 @@ public class BauGuiEditor implements Listener {
|
||||
if (items.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
SWListInv<GuiItem> inv = new SWListInv<>(p, "Item auswählen", items, (clickType, item) -> {
|
||||
SWListInv<BauGuiItem> inv = new SWListInv<>(p, "Item auswählen", items, (clickType, item) -> {
|
||||
openGuiEditor(p, addId(item.getItem(p), item.getId()));
|
||||
});
|
||||
inv.open();
|
||||
break;
|
||||
case WHITE_STAINED_GLASS_PANE:
|
||||
case GRAY_STAINED_GLASS_PANE:
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
@ -202,7 +202,7 @@ public class BauGuiEditor implements Listener {
|
||||
newMapping.put(getId(itemStack), i);
|
||||
}
|
||||
|
||||
for (Map.Entry<Integer, GuiItem> e : BauGUI.getITEMS().entrySet()) {
|
||||
for (Map.Entry<Integer, BauGuiItem> e : BauGUI.getITEMS().entrySet()) {
|
||||
if (!newMapping.containsKey(e.getKey())) {
|
||||
newMapping.put(e.getKey(), -1);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
package de.steamwar.bausystem.features.gui.editor;
|
||||
|
||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
@ -37,7 +37,7 @@ public class TempClass {
|
||||
Random rnd = new Random();
|
||||
int size = (rnd.nextInt(5) + 1) * 9;
|
||||
HashMap<Integer, Integer> mapping = new HashMap<>();
|
||||
for (GuiItem item : BauGUI.getITEMS().values()) {
|
||||
for (BauGuiItem item : BauGUI.getITEMS().values()) {
|
||||
int slot;
|
||||
int i = 0;
|
||||
do {
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.loader;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
@ -34,10 +34,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class LoaderGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class LoaderBauGuiItem extends BauGuiItem {
|
||||
|
||||
public LoaderGuiItem() {
|
||||
public LoaderBauGuiItem() {
|
||||
super(9);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.other.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
@ -31,10 +31,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class TeleportGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class TeleportBauGuiItem extends BauGuiItem {
|
||||
|
||||
public TeleportGuiItem() {
|
||||
public TeleportBauGuiItem() {
|
||||
super(10);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.bausystem.region.Color;
|
||||
@ -39,10 +39,10 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class ColorGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class ColorBauGuiItem extends BauGuiItem {
|
||||
|
||||
public ColorGuiItem() {
|
||||
public ColorBauGuiItem() {
|
||||
super(2);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
@ -33,10 +33,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class FireGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class FireBauGuiItem extends BauGuiItem {
|
||||
|
||||
public FireGuiItem() {
|
||||
public FireBauGuiItem() {
|
||||
super(3);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
@ -33,10 +33,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class FreezeGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class FreezeBauGuiItem extends BauGuiItem {
|
||||
|
||||
public FreezeGuiItem() {
|
||||
public FreezeBauGuiItem() {
|
||||
super(1);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
@ -33,10 +33,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class ProtectGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class ProtectBauGuiItem extends BauGuiItem {
|
||||
|
||||
public ProtectGuiItem() {
|
||||
public ProtectBauGuiItem() {
|
||||
super(4);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@ -36,10 +36,10 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class ResetGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class ResetBauGuiItem extends BauGuiItem {
|
||||
|
||||
public ResetGuiItem() {
|
||||
public ResetBauGuiItem() {
|
||||
super(6);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@ -36,10 +36,10 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class TestblockGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class TestblockBauGuiItem extends BauGuiItem {
|
||||
|
||||
public TestblockGuiItem() {
|
||||
public TestblockBauGuiItem() {
|
||||
super(5);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
@ -34,10 +34,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class TntGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class TntBauGuiItem extends BauGuiItem {
|
||||
|
||||
public TntGuiItem() {
|
||||
public TntBauGuiItem() {
|
||||
super(0);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.script;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@ -30,10 +30,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class ScriptBookGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class ScriptBookBauGuiItem extends BauGuiItem {
|
||||
|
||||
public ScriptBookGuiItem() {
|
||||
public ScriptBookBauGuiItem() {
|
||||
super(15);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.simulator;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@ -30,10 +30,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class SimulatorGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class SimulatorBauGuiItem extends BauGuiItem {
|
||||
|
||||
public SimulatorGuiItem() {
|
||||
public SimulatorBauGuiItem() {
|
||||
super(20);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.tpslimit;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
@ -33,10 +33,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class TPSLimitGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class TPSLimitBauGuiItem extends BauGuiItem {
|
||||
|
||||
public TPSLimitGuiItem() {
|
||||
public TPSLimitBauGuiItem() {
|
||||
super(19);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.tracer;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.features.tracer.record.RecordStateMachine;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@ -33,10 +33,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class TracerGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class TracerBauGuiItem extends BauGuiItem {
|
||||
|
||||
public TracerGuiItem() {
|
||||
public TracerBauGuiItem() {
|
||||
super(21);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.util.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@ -30,10 +30,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class DebugstickGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class DebugstickBauGuiItem extends BauGuiItem {
|
||||
|
||||
public DebugstickGuiItem() {
|
||||
public DebugstickBauGuiItem() {
|
||||
super(12);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.util.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@ -33,10 +33,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class NightVisionGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class NightVisionBauGuiItem extends BauGuiItem {
|
||||
|
||||
public NightVisionGuiItem() {
|
||||
public NightVisionBauGuiItem() {
|
||||
super(11);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.util.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
@ -40,12 +40,12 @@ import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class SelectGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class SelectBauGuiItem extends BauGuiItem {
|
||||
|
||||
private static final Map<Player, LastSelect> LAST_SELECT_MAP = new HashMap<>();
|
||||
|
||||
public SelectGuiItem() {
|
||||
public SelectBauGuiItem() {
|
||||
super(13);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.util.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
@ -31,10 +31,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class SkullGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class SkullBauGuiItem extends BauGuiItem {
|
||||
|
||||
public SkullGuiItem() {
|
||||
public SkullBauGuiItem() {
|
||||
super(16);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.util.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
@ -33,10 +33,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class SpeedGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class SpeedBauGuiItem extends BauGuiItem {
|
||||
|
||||
public SpeedGuiItem() {
|
||||
public SpeedBauGuiItem() {
|
||||
super(17);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.util.items;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.GuiItem;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@ -31,10 +31,10 @@ import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
@Linked(LinkageType.GUI_ITEM)
|
||||
public class WaterVisionGuiItem extends GuiItem {
|
||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||
public class WaterVisionBauGuiItem extends BauGuiItem {
|
||||
|
||||
public WaterVisionGuiItem() {
|
||||
public WaterVisionBauGuiItem() {
|
||||
super(18);
|
||||
}
|
||||
|
38
BauSystem_Main/src/de/steamwar/bausystem/linkage/BauGuiItem.java
Normale Datei
38
BauSystem_Main/src/de/steamwar/bausystem/linkage/BauGuiItem.java
Normale Datei
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2021 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.linkage;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@AllArgsConstructor
|
||||
public abstract class BauGuiItem extends GuiItem {
|
||||
|
||||
@Getter
|
||||
private final int id;
|
||||
|
||||
public void update() {
|
||||
BauGUI.update();
|
||||
}
|
||||
|
||||
public abstract Permission permission();
|
||||
}
|
@ -19,27 +19,13 @@
|
||||
|
||||
package de.steamwar.bausystem.linkage;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@AllArgsConstructor
|
||||
public abstract class GuiItem {
|
||||
|
||||
@Getter
|
||||
private final int id;
|
||||
|
||||
public abstract ItemStack getItem(Player player);
|
||||
|
||||
public abstract boolean click(ClickType click, Player p);
|
||||
|
||||
public void update() {
|
||||
BauGUI.update();
|
||||
}
|
||||
|
||||
public abstract Permission permission();
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public enum LinkageType {
|
||||
PLAIN(1, false, clazz -> true),
|
||||
LISTENER(2, false, Listener.class::isAssignableFrom, o -> Bukkit.getPluginManager().registerEvents((Listener) o, BauSystem.getInstance())),
|
||||
UNLINK_LISTENER(2, true, Listener.class::isAssignableFrom, o -> HandlerList.unregisterAll((Listener) o)),
|
||||
GUI_ITEM(3, false, GuiItem.class::isAssignableFrom, o -> BauGUI.addItem((GuiItem) o)),
|
||||
BAU_GUI_ITEM(3, false, BauGuiItem.class::isAssignableFrom, o -> BauGUI.addItem((BauGuiItem) o)),
|
||||
SCRIPT_COMMAND(4, false, SpecialCommand.class::isAssignableFrom, o -> ScriptExecutor.SPECIAL_COMMANDS.add((SpecialCommand) o)),
|
||||
CONFIG_CONVERTER(5, false, ConfigConverter.class::isAssignableFrom, o -> ConfigUpdater.addConfigConverter((ConfigConverter) o));
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren