SteamWar/BauSystem2.0
Archiviert
12
0

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageType.java
Dieser Commit ist enthalten in:
yoyosource 2021-05-03 15:49:12 +02:00
Commit 5b35148a6f
33 geänderte Dateien mit 172 neuen und 153 gelöschten Zeilen

Datei anzeigen

@ -31,7 +31,6 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.logging.Level;
public class BauSystem extends JavaPlugin implements Listener { public class BauSystem extends JavaPlugin implements Listener {

Datei anzeigen

@ -20,7 +20,7 @@
package de.steamwar.bausystem.features.autostart; package de.steamwar.bausystem.features.autostart;
import de.steamwar.bausystem.Permission; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -31,8 +31,8 @@ import org.bukkit.inventory.ItemStack;
import java.util.Arrays; import java.util.Arrays;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class AutoStartGuiItem extends GuiItem { public class AutoStartGuiItem extends BauGuiItem {
public AutoStartGuiItem() { public AutoStartGuiItem() {
super(24); super(24);

Datei anzeigen

@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.bau;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.BauServer; import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
@ -36,10 +36,10 @@ import org.bukkit.inventory.ItemStack;
import java.util.Arrays; import java.util.Arrays;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class BauInfoGuiItem extends GuiItem { public class BauInfoBauGuiItem extends BauGuiItem {
public BauInfoGuiItem() { public BauInfoBauGuiItem() {
super(7); super(7);
} }

Datei anzeigen

@ -21,20 +21,20 @@ package de.steamwar.bausystem.features.countingwand;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.config.ColorConfig;
import de.steamwar.bausystem.features.gui.BauGUI; import de.steamwar.bausystem.linkage.BauGuiItem;
import de.steamwar.bausystem.linkage.GuiItem;
import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import java.util.Arrays;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
@Linked(LinkageType.GUI_ITEM)
public class CountingwandGuiItem extends GuiItem { @Linked(LinkageType.BAU_GUI_ITEM)
public class CountingwandGuiItem extends BauGuiItem {
public CountingwandGuiItem() { public CountingwandGuiItem() {
super(22); super(22);
@ -43,8 +43,8 @@ public class CountingwandGuiItem extends GuiItem {
@Override @Override
public ItemStack getItem(Player player) { public ItemStack getItem(Player player) {
return new SWItem(Material.STICK, return new SWItem(Material.STICK,
ColorConfig.HIGHLIGHT + "Counting Wand", ColorConfig.HIGHLIGHT + "Counting Wand",
Arrays.asList(ColorConfig.HIGHLIGHT + "Linksklick" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Setzt die 1. Position", Arrays.asList(ColorConfig.HIGHLIGHT + "Linksklick" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Setzt die 1. Position",
ColorConfig.HIGHLIGHT + "Rechtsklick" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Setzt die 2. Position"), ColorConfig.HIGHLIGHT + "Rechtsklick" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Setzt die 2. Position"),
false, clickType -> { false, clickType -> {
}).getItemStack(); }).getItemStack();

Datei anzeigen

@ -20,17 +20,17 @@
package de.steamwar.bausystem.features.detonator; package de.steamwar.bausystem.features.detonator;
import de.steamwar.bausystem.Permission; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class DetonatorGuiItem extends GuiItem { public class DetonatorBauGuiItem extends BauGuiItem {
public DetonatorGuiItem() { public DetonatorBauGuiItem() {
super(8); super(8);
} }

Datei anzeigen

@ -24,7 +24,7 @@ import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.config.ColorConfig;
import de.steamwar.bausystem.features.gui.editor.BauGuiMapping; 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 de.steamwar.inventory.SWInventory;
import lombok.Getter; import lombok.Getter;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
@ -39,7 +39,7 @@ import java.util.*;
public class BauGUI { public class BauGUI {
@Getter @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 final Set<Player> OPEN_INVS = new HashSet<>();
private static boolean updating = false; private static boolean updating = false;
@ -54,7 +54,7 @@ public class BauGUI {
GUI_ITEM.setItemMeta(meta); GUI_ITEM.setItemMeta(meta);
} }
public static void addItem(GuiItem item) { public static void addItem(BauGuiItem item) {
ITEMS.put(item.getId(), item); ITEMS.put(item.getId(), item);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.gui;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -32,10 +32,10 @@ import org.bukkit.inventory.ItemStack;
import java.util.Arrays; import java.util.Arrays;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class BauGuiGuiItem extends GuiItem { public class BauGuiBauGuiItem extends BauGuiItem {
public BauGuiGuiItem() { public BauGuiBauGuiItem() {
super(14); super(14);
} }

Datei anzeigen

@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.gui.editor;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.config.ColorConfig;
import de.steamwar.bausystem.features.gui.BauGUI; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -45,10 +45,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType; import org.bukkit.persistence.PersistentDataType;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Linked(LinkageType.LISTENER) @Linked(LinkageType.LISTENER)
public class BauGuiEditor implements 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() + 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() + 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()); inv.setItem(mapping.getSize() + 6, new SWItem(Material.SCUTE, ColorConfig.HIGHLIGHT + "Mehr Items").getItemStack());
p.openInventory(inv); p.openInventory(inv);
@ -116,28 +114,34 @@ public class BauGuiEditor implements Listener {
return; return;
} }
switch (i.getType()) { if (event.getSlot() - mapping.getSize() >= 0) {
case RED_STAINED_GLASS_PANE: event.setCancelled(true);
event.setCancelled(true); }
switch (event.getSlot() - mapping.getSize()) {
case 2:
if (mapping.getSize() == 9) {
return;
}
saveMapping(p); saveMapping(p);
mapping.setSize(mapping.getSize() - 9); mapping.setSize(mapping.getSize() - 9);
openGuiEditor(p, event.getCursor()); openGuiEditor(p, event.getCursor());
break; break;
case LIME_STAINED_GLASS_PANE: case 3:
event.setCancelled(true); if (mapping.getSize() == 9 * 5) {
return;
}
saveMapping(p); saveMapping(p);
mapping.setSize(mapping.getSize() + 9); mapping.setSize(mapping.getSize() + 9);
openGuiEditor(p, event.getCursor()); openGuiEditor(p, event.getCursor());
break; break;
case BARRIER: case 5:
event.setCancelled(true);
event.getView().setCursor(new SWItem().getItemStack()); event.getView().setCursor(new SWItem().getItemStack());
break; break;
case SCUTE: case 6:
event.setCancelled(true);
saveMapping(p); saveMapping(p);
List<SWListInv.SWListEntry<GuiItem>> items = new ArrayList<>(); List<SWListInv.SWListEntry<BauGuiItem>> items = new ArrayList<>();
for (GuiItem item : BauGUI.getITEMS().values()) { for (BauGuiItem item : BauGUI.getITEMS().values()) {
if (mapping.isShown(item.getId())) { if (mapping.isShown(item.getId())) {
continue; continue;
} }
@ -148,15 +152,11 @@ public class BauGuiEditor implements Listener {
if (items.isEmpty()) { if (items.isEmpty()) {
return; 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())); openGuiEditor(p, addId(item.getItem(p), item.getId()));
}); });
inv.open(); inv.open();
break; break;
case WHITE_STAINED_GLASS_PANE:
case GRAY_STAINED_GLASS_PANE:
event.setCancelled(true);
break;
default: default:
} }
} }
@ -202,7 +202,7 @@ public class BauGuiEditor implements Listener {
newMapping.put(getId(itemStack), i); 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())) { if (!newMapping.containsKey(e.getKey())) {
newMapping.put(e.getKey(), -1); newMapping.put(e.getKey(), -1);
} }

Datei anzeigen

@ -20,7 +20,7 @@
package de.steamwar.bausystem.features.gui.editor; package de.steamwar.bausystem.features.gui.editor;
import de.steamwar.bausystem.features.gui.BauGUI; 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.HashMap;
import java.util.Random; import java.util.Random;
@ -37,7 +37,7 @@ public class TempClass {
Random rnd = new Random(); Random rnd = new Random();
int size = (rnd.nextInt(5) + 1) * 9; int size = (rnd.nextInt(5) + 1) * 9;
HashMap<Integer, Integer> mapping = new HashMap<>(); HashMap<Integer, Integer> mapping = new HashMap<>();
for (GuiItem item : BauGUI.getITEMS().values()) { for (BauGuiItem item : BauGUI.getITEMS().values()) {
int slot; int slot;
int i = 0; int i = 0;
do { do {

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.loader;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWAnvilInv;
@ -34,10 +34,10 @@ import org.bukkit.inventory.ItemStack;
import java.util.Arrays; import java.util.Arrays;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class LoaderGuiItem extends GuiItem { public class LoaderBauGuiItem extends BauGuiItem {
public LoaderGuiItem() { public LoaderBauGuiItem() {
super(9); super(9);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.other.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWAnvilInv;
@ -31,10 +31,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class TeleportGuiItem extends GuiItem { public class TeleportBauGuiItem extends BauGuiItem {
public TeleportGuiItem() { public TeleportBauGuiItem() {
super(10); super(10);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.redstonetester;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -32,8 +32,8 @@ import org.bukkit.inventory.ItemStack;
import java.util.Arrays; import java.util.Arrays;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class RedstoneTesterGuiItem extends GuiItem { public class RedstoneTesterGuiItem extends BauGuiItem {
public RedstoneTesterGuiItem() { public RedstoneTesterGuiItem() {
super(23); super(23);

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.region.Color; import de.steamwar.bausystem.region.Color;
@ -39,10 +39,10 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class ColorGuiItem extends GuiItem { public class ColorBauGuiItem extends BauGuiItem {
public ColorGuiItem() { public ColorBauGuiItem() {
super(2); super(2);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
@ -33,10 +33,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class FireGuiItem extends GuiItem { public class FireBauGuiItem extends BauGuiItem {
public FireGuiItem() { public FireBauGuiItem() {
super(3); super(3);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
@ -33,10 +33,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class FreezeGuiItem extends GuiItem { public class FreezeBauGuiItem extends BauGuiItem {
public FreezeGuiItem() { public FreezeBauGuiItem() {
super(1); super(1);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
@ -33,10 +33,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class ProtectGuiItem extends GuiItem { public class ProtectBauGuiItem extends BauGuiItem {
public ProtectGuiItem() { public ProtectBauGuiItem() {
super(4); super(4);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -36,10 +36,10 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class ResetGuiItem extends GuiItem { public class ResetBauGuiItem extends BauGuiItem {
public ResetGuiItem() { public ResetBauGuiItem() {
super(6); super(6);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -36,10 +36,10 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class TestblockGuiItem extends GuiItem { public class TestblockBauGuiItem extends BauGuiItem {
public TestblockGuiItem() { public TestblockBauGuiItem() {
super(5); super(5);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.region.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
@ -34,10 +34,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class TntGuiItem extends GuiItem { public class TntBauGuiItem extends BauGuiItem {
public TntGuiItem() { public TntBauGuiItem() {
super(0); super(0);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.script;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -30,10 +30,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class ScriptBookGuiItem extends GuiItem { public class ScriptBookBauGuiItem extends BauGuiItem {
public ScriptBookGuiItem() { public ScriptBookBauGuiItem() {
super(15); super(15);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.simulator;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -30,10 +30,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class SimulatorGuiItem extends GuiItem { public class SimulatorBauGuiItem extends BauGuiItem {
public SimulatorGuiItem() { public SimulatorBauGuiItem() {
super(20); super(20);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.tpslimit;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWAnvilInv;
@ -33,10 +33,10 @@ import org.bukkit.inventory.ItemStack;
import java.util.Arrays; import java.util.Arrays;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class TPSLimitGuiItem extends GuiItem { public class TPSLimitBauGuiItem extends BauGuiItem {
public TPSLimitGuiItem() { public TPSLimitBauGuiItem() {
super(19); super(19);
} }

Datei anzeigen

@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.tracer;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.config.ColorConfig;
import de.steamwar.bausystem.features.tracer.record.RecordStateMachine; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -33,10 +33,10 @@ import org.bukkit.inventory.ItemStack;
import java.util.Arrays; import java.util.Arrays;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class TracerGuiItem extends GuiItem { public class TracerBauGuiItem extends BauGuiItem {
public TracerGuiItem() { public TracerBauGuiItem() {
super(21); super(21);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.util.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -30,10 +30,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class DebugstickGuiItem extends GuiItem { public class DebugstickBauGuiItem extends BauGuiItem {
public DebugstickGuiItem() { public DebugstickBauGuiItem() {
super(12); super(12);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.util.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -33,10 +33,10 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class NightVisionGuiItem extends GuiItem { public class NightVisionBauGuiItem extends BauGuiItem {
public NightVisionGuiItem() { public NightVisionBauGuiItem() {
super(11); super(11);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.util.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionExtensionType;
@ -40,12 +40,12 @@ import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class SelectGuiItem extends GuiItem { public class SelectBauGuiItem extends BauGuiItem {
private static final Map<Player, LastSelect> LAST_SELECT_MAP = new HashMap<>(); private static final Map<Player, LastSelect> LAST_SELECT_MAP = new HashMap<>();
public SelectGuiItem() { public SelectBauGuiItem() {
super(13); super(13);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.util.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWAnvilInv;
@ -31,10 +31,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class SkullGuiItem extends GuiItem { public class SkullBauGuiItem extends BauGuiItem {
public SkullGuiItem() { public SkullBauGuiItem() {
super(16); super(16);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.util.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWAnvilInv;
@ -33,10 +33,10 @@ import org.bukkit.inventory.ItemStack;
import java.util.Arrays; import java.util.Arrays;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class SpeedGuiItem extends GuiItem { public class SpeedBauGuiItem extends BauGuiItem {
public SpeedGuiItem() { public SpeedBauGuiItem() {
super(17); super(17);
} }

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.util.items;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -31,10 +31,10 @@ import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
@Linked(LinkageType.GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class WaterVisionGuiItem extends GuiItem { public class WaterVisionBauGuiItem extends BauGuiItem {
public WaterVisionGuiItem() { public WaterVisionBauGuiItem() {
super(18); super(18);
} }

Datei anzeigen

@ -19,8 +19,9 @@
package de.steamwar.bausystem.features.world; package de.steamwar.bausystem.features.world;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import org.bukkit.Material;
import org.bukkit.attribute.Attribute; import org.bukkit.attribute.Attribute;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -29,12 +30,12 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
//@Linked(LinkageType.LISTENER) @Linked(LinkageType.LISTENER)
public class InventoryListener implements Listener { public class InventoryListener implements Listener {
@EventHandler @EventHandler
public void onInventoryClick(InventoryClickEvent e) { public void onInventoryClick(InventoryClickEvent e) {
ItemStack stack = e.getCursor(); ItemStack stack = e.getCurrentItem();
if (stack == null || !stack.hasItemMeta()) { if (stack == null || !stack.hasItemMeta()) {
return; return;
} }
@ -47,11 +48,6 @@ public class InventoryListener implements Listener {
} }
} }
Material material = stack.getType();
if (material == Material.POTION || material == Material.SPLASH_POTION || material == Material.LINGERING_POTION) {
stack.setType(Material.MILK_BUCKET);
}
if (Core.getVersion() < 15) { if (Core.getVersion() < 15) {
e.setCurrentItem(stack); e.setCurrentItem(stack);
return; return;

Datei anzeigen

@ -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();
}

Datei anzeigen

@ -19,27 +19,13 @@
package de.steamwar.bausystem.linkage; 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.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@AllArgsConstructor
public abstract class GuiItem { public abstract class GuiItem {
@Getter
private final int id;
public abstract ItemStack getItem(Player player); public abstract ItemStack getItem(Player player);
public abstract boolean click(ClickType click, Player p); public abstract boolean click(ClickType click, Player p);
public void update() {
BauGUI.update();
}
public abstract Permission permission();
} }

Datei anzeigen

@ -50,7 +50,7 @@ public enum LinkageType {
UNLINK_LISTENER(2, true, Listener.class::isAssignableFrom, o -> HandlerList.unregisterAll((Listener) o)), UNLINK_LISTENER(2, true, Listener.class::isAssignableFrom, o -> HandlerList.unregisterAll((Listener) o)),
// SPECIFIC // SPECIFIC
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)), 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)), CONFIG_CONVERTER(5, false, ConfigConverter.class::isAssignableFrom, o -> ConfigUpdater.addConfigConverter((ConfigConverter) o)),
SCOREBOARD(6, false, ScoreboardItem.class::isAssignableFrom, o -> {}); SCOREBOARD(6, false, ScoreboardItem.class::isAssignableFrom, o -> {});