From 0430d140b405cb5ea989475b5274f2508da65f63 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 19 May 2024 11:46:49 +0200 Subject: [PATCH] Move BauGUI into own module --- BauSystem_GUI/build.gradle | 63 +++++++++++++++++++ .../de/steamwar/bausystem}/gui/BauGUI.java | 28 ++++----- .../steamwar/bausystem/gui/BauGUICommand.java | 49 +++++++++++++++ .../bausystem}/gui/BauGuiBauGuiItem.java | 26 ++++---- .../bausystem/gui/BauGuiListener.java | 43 +++++++++++++ .../bausystem}/gui/editor/BauGuiEditor.java | 4 +- .../gui/editor/BauGuiEditorGuiItem.java | 2 +- .../bausystem}/gui/editor/BauGuiMapping.java | 4 +- .../linkage/specific/BauGuiItem.java | 45 +++++++++++++ .../linkage/types/BauGuiItem_GENERIC.java | 40 ++++++++++++ BauSystem_GUI/src/plugin.yml | 12 ++++ BauSystem_ItemUtilities/build.gradle | 2 + BauSystem_ItemUtilities/src/plugin.yml | 2 +- .../linkage/types/BauGuiItem_GENERIC.java | 40 ------------ .../bausystem/features/gui/BauGUICommand.java | 49 --------------- .../features/gui/BauGuiListener.java | 43 ------------- .../linkage/specific/BauGuiItem.java | 38 ----------- 17 files changed, 287 insertions(+), 203 deletions(-) create mode 100644 BauSystem_GUI/build.gradle rename {BauSystem_Main/src/de/steamwar/bausystem/features => BauSystem_GUI/src/de/steamwar/bausystem}/gui/BauGUI.java (79%) create mode 100644 BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGUICommand.java rename {BauSystem_Main/src/de/steamwar/bausystem/features => BauSystem_GUI/src/de/steamwar/bausystem}/gui/BauGuiBauGuiItem.java (58%) create mode 100644 BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGuiListener.java rename {BauSystem_Main/src/de/steamwar/bausystem/features => BauSystem_GUI/src/de/steamwar/bausystem}/gui/editor/BauGuiEditor.java (98%) rename {BauSystem_Main/src/de/steamwar/bausystem/features => BauSystem_GUI/src/de/steamwar/bausystem}/gui/editor/BauGuiEditorGuiItem.java (97%) rename {BauSystem_Main/src/de/steamwar/bausystem/features => BauSystem_GUI/src/de/steamwar/bausystem}/gui/editor/BauGuiMapping.java (97%) create mode 100644 BauSystem_GUI/src/de/steamwar/bausystem/linkage/specific/BauGuiItem.java create mode 100644 BauSystem_GUI/src/de/steamwar/bausystem/linkage/types/BauGuiItem_GENERIC.java create mode 100644 BauSystem_GUI/src/plugin.yml delete mode 100644 BauSystem_Linkage/src/de/steamwar/linkage/types/BauGuiItem_GENERIC.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUICommand.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiListener.java delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/linkage/specific/BauGuiItem.java diff --git a/BauSystem_GUI/build.gradle b/BauSystem_GUI/build.gradle new file mode 100644 index 00000000..dd0a66df --- /dev/null +++ b/BauSystem_GUI/build.gradle @@ -0,0 +1,63 @@ +/* + * 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 . + */ + +plugins { + id 'base' + id 'java' +} + +group 'steamwar' +version '1.0' + +compileJava.options.encoding = 'UTF-8' + +sourceCompatibility = 17 +targetCompatibility = 17 + +sourceSets { + main { + java { + srcDirs = ['src/', 'build/generated/sources/annotationProcessor/java/main/'] + } + resources { + srcDirs = ['src/'] + exclude '**/*.java', '**/*.kt' + } + } +} + +dependencies { + implementation project(":BauSystem_PluginBase") + + compileOnly 'org.projectlombok:lombok:1.18.22' + annotationProcessor 'org.projectlombok:lombok:1.18.22' + + compileOnly 'org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT' + // compileOnly 'com.mojang:authlib:1.5.25' + // compileOnly 'io.netty:netty-all:4.1.68.Final' + + compileOnly swdep('Spigot-1.20') + compileOnly swdep('SpigotCore') + annotationProcessor swdep('SpigotCore') + + compileOnly swdep('FastAsyncWorldEdit-1.18') + // compileOnly swdep('AxiomPaper') + + // implementation 'org.luaj:luaj-jse:3.0.1' +} \ No newline at end of file diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUI.java b/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGUI.java similarity index 79% rename from BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUI.java rename to BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGUI.java index 3b8dc600..64fc2eb3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUI.java +++ b/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGUI.java @@ -1,28 +1,28 @@ /* - * This file is a part of the SteamWar software. + * This file is a part of the SteamWar software. * - * Copyright (C) 2021 SteamWar.de-Serverteam + * Copyright (C) 2024 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 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. + * 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 . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ -package de.steamwar.bausystem.features.gui; +package de.steamwar.bausystem.gui; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.features.gui.editor.BauGuiMapping; +import de.steamwar.bausystem.gui.editor.BauGuiMapping; import de.steamwar.bausystem.linkage.LinkageUtils; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWInventory; diff --git a/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGUICommand.java b/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGUICommand.java new file mode 100644 index 00000000..48769230 --- /dev/null +++ b/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGUICommand.java @@ -0,0 +1,49 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2024 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 . + */ + +package de.steamwar.bausystem.gui; + +import de.steamwar.bausystem.gui.editor.BauGuiEditor; +import de.steamwar.command.SWCommand; +import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; +import org.bukkit.entity.Player; + +@Linked +public class BauGUICommand extends SWCommand { + + public BauGUICommand() { + super("gui", "baugui", "g"); + } + + @Register(help = true) + public void genericHelp(Player p, String... args) { + BauGUI.openBauGui(p); + } + + @Register("item") + public void giveItem(Player p) { + BauGUI.giveItem(p); + } + + @Register("editor") + public void openEditor(Player p) { + BauGuiEditor.openGuiEditor(p, new SWItem().getItemStack()); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiBauGuiItem.java b/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGuiBauGuiItem.java similarity index 58% rename from BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiBauGuiItem.java rename to BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGuiBauGuiItem.java index c03b458a..6113d62e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiBauGuiItem.java +++ b/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGuiBauGuiItem.java @@ -1,23 +1,23 @@ /* - * This file is a part of the SteamWar software. + * This file is a part of the SteamWar software. * - * Copyright (C) 2021 SteamWar.de-Serverteam + * Copyright (C) 2024 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 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. + * 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 . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ -package de.steamwar.bausystem.features.gui; +package de.steamwar.bausystem.gui; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; diff --git a/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGuiListener.java b/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGuiListener.java new file mode 100644 index 00000000..f0b636b0 --- /dev/null +++ b/BauSystem_GUI/src/de/steamwar/bausystem/gui/BauGuiListener.java @@ -0,0 +1,43 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2024 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 . + */ + +package de.steamwar.bausystem.gui; + +import de.steamwar.linkage.Linked; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +@Linked +public class BauGuiListener implements Listener { + + @EventHandler + public void onPlayerInteract(PlayerInteractEvent event) { + if (event.getItem() == null) { + return; + } + + if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) { + if (event.getItem().isSimilar(BauGUI.getGUI_ITEM(event.getPlayer()))) { + BauGUI.openBauGui(event.getPlayer()); + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditor.java b/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditor.java similarity index 98% rename from BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditor.java rename to BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditor.java index 733e7213..6c4bdad9 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditor.java +++ b/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditor.java @@ -17,10 +17,10 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.gui.editor; +package de.steamwar.bausystem.gui.editor; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.gui.BauGUI; +import de.steamwar.bausystem.gui.BauGUI; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditorGuiItem.java b/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditorGuiItem.java similarity index 97% rename from BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditorGuiItem.java rename to BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditorGuiItem.java index b1a76041..4c7c97cc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditorGuiItem.java +++ b/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiEditorGuiItem.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.gui.editor; +package de.steamwar.bausystem.gui.editor; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiMapping.java b/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiMapping.java similarity index 97% rename from BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiMapping.java rename to BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiMapping.java index 90cc1fb4..c839325f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiMapping.java +++ b/BauSystem_GUI/src/de/steamwar/bausystem/gui/editor/BauGuiMapping.java @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.gui.editor; +package de.steamwar.bausystem.gui.editor; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.configplayer.Config; -import de.steamwar.bausystem.features.gui.BauGUI; +import de.steamwar.bausystem.gui.BauGUI; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import lombok.Getter; import lombok.Setter; diff --git a/BauSystem_GUI/src/de/steamwar/bausystem/linkage/specific/BauGuiItem.java b/BauSystem_GUI/src/de/steamwar/bausystem/linkage/specific/BauGuiItem.java new file mode 100644 index 00000000..663c174a --- /dev/null +++ b/BauSystem_GUI/src/de/steamwar/bausystem/linkage/specific/BauGuiItem.java @@ -0,0 +1,45 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2024 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 . + */ + +package de.steamwar.bausystem.linkage.specific; + +import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.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 BauGuiItem { + + @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(); +} diff --git a/BauSystem_GUI/src/de/steamwar/bausystem/linkage/types/BauGuiItem_GENERIC.java b/BauSystem_GUI/src/de/steamwar/bausystem/linkage/types/BauGuiItem_GENERIC.java new file mode 100644 index 00000000..e67c3cb1 --- /dev/null +++ b/BauSystem_GUI/src/de/steamwar/bausystem/linkage/types/BauGuiItem_GENERIC.java @@ -0,0 +1,40 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2024 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 . + */ + +package de.steamwar.bausystem.linkage.types; + +import de.steamwar.linkage.LinkageType; +import de.steamwar.linkage.plan.BuildPlan; +import de.steamwar.linkage.plan.MethodBuilder; + +import javax.lang.model.element.TypeElement; + +public class BauGuiItem_GENERIC implements LinkageType { + + @Override + public String method() { + return "linkGUIItems"; + } + + @Override + public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) { + buildPlan.addImport("de.steamwar.bausystem.features.gui.BauGUI"); + methodBuilder.addLine("BauGUI.addItem(" + s + ");"); + } +} diff --git a/BauSystem_GUI/src/plugin.yml b/BauSystem_GUI/src/plugin.yml new file mode 100644 index 00000000..219c80ef --- /dev/null +++ b/BauSystem_GUI/src/plugin.yml @@ -0,0 +1,12 @@ +name: BauSystem_GUI +authors: [ Lixfel, YoyoNow, Chaoscaot, Zeanon, D4rkr34lm ] +version: "2.0" +depend: [ WorldEdit, SpigotCore ] +softdepend: [ ] +load: POSTWORLD +main: de.steamwar.bausystem.BauSystemPlugin +api-version: "1.13" +website: "https://steamwar.de" +description: "So unseriƶs wie wir sind: BauSystem nur besser." + +commands: diff --git a/BauSystem_ItemUtilities/build.gradle b/BauSystem_ItemUtilities/build.gradle index dd0a66df..e61cbb87 100644 --- a/BauSystem_ItemUtilities/build.gradle +++ b/BauSystem_ItemUtilities/build.gradle @@ -44,6 +44,8 @@ sourceSets { dependencies { implementation project(":BauSystem_PluginBase") + compileOnly project(":BauSystem_GUI") + annotationProcessor project(":BauSystem_GUI") compileOnly 'org.projectlombok:lombok:1.18.22' annotationProcessor 'org.projectlombok:lombok:1.18.22' diff --git a/BauSystem_ItemUtilities/src/plugin.yml b/BauSystem_ItemUtilities/src/plugin.yml index f4727758..20197b99 100644 --- a/BauSystem_ItemUtilities/src/plugin.yml +++ b/BauSystem_ItemUtilities/src/plugin.yml @@ -2,7 +2,7 @@ name: BauSystem_ItemUtilities authors: [ Lixfel, YoyoNow, Chaoscaot, Zeanon, D4rkr34lm ] version: "2.0" depend: [ WorldEdit, SpigotCore ] -softdepend: [ ] +softdepend: [ BauSystem_GUI ] load: POSTWORLD main: de.steamwar.bausystem.BauSystemPlugin api-version: "1.13" diff --git a/BauSystem_Linkage/src/de/steamwar/linkage/types/BauGuiItem_GENERIC.java b/BauSystem_Linkage/src/de/steamwar/linkage/types/BauGuiItem_GENERIC.java deleted file mode 100644 index 160a7ca3..00000000 --- a/BauSystem_Linkage/src/de/steamwar/linkage/types/BauGuiItem_GENERIC.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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 . - */ - -package de.steamwar.linkage.types; - -import de.steamwar.linkage.LinkageType; -import de.steamwar.linkage.plan.BuildPlan; -import de.steamwar.linkage.plan.MethodBuilder; - -import javax.lang.model.element.TypeElement; - -public class BauGuiItem_GENERIC implements LinkageType { - - @Override - public String method() { - return "linkGUIItems"; - } - - @Override - public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) { - buildPlan.addImport("de.steamwar.bausystem.features.gui.BauGUI"); - methodBuilder.addLine("BauGUI.addItem(" + s + ");"); - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUICommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUICommand.java deleted file mode 100644 index f6810ef7..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUICommand.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 . - */ - -package de.steamwar.bausystem.features.gui; - -import de.steamwar.bausystem.features.gui.editor.BauGuiEditor; -import de.steamwar.command.SWCommand; -import de.steamwar.inventory.SWItem; -import de.steamwar.linkage.Linked; -import org.bukkit.entity.Player; - -@Linked -public class BauGUICommand extends SWCommand { - - public BauGUICommand() { - super("gui", "baugui", "g"); - } - - @Register(help = true) - public void genericHelp(Player p, String... args) { - BauGUI.openBauGui(p); - } - - @Register("item") - public void giveItem(Player p) { - BauGUI.giveItem(p); - } - - @Register("editor") - public void openEditor(Player p) { - BauGuiEditor.openGuiEditor(p, new SWItem().getItemStack()); - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiListener.java deleted file mode 100644 index 5895019f..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiListener.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 . - */ - -package de.steamwar.bausystem.features.gui; - -import de.steamwar.linkage.Linked; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; - -@Linked -public class BauGuiListener implements Listener { - - @EventHandler - public void onPlayerInteract(PlayerInteractEvent event) { - if (event.getItem() == null) { - return; - } - - if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) { - if (event.getItem().isSimilar(BauGUI.getGUI_ITEM(event.getPlayer()))) { - BauGUI.openBauGui(event.getPlayer()); - } - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/linkage/specific/BauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/linkage/specific/BauGuiItem.java deleted file mode 100644 index b14327b7..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/linkage/specific/BauGuiItem.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 . - */ - -package de.steamwar.bausystem.linkage.specific; - -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(); -}