diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstoneTesterGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstoneTesterGuiItem.java new file mode 100644 index 00000000..8763767d --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstoneTesterGuiItem.java @@ -0,0 +1,57 @@ +/* + * 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.redstonetester; + +import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.config.ColorConfig; +import de.steamwar.bausystem.linkage.GuiItem; +import de.steamwar.bausystem.linkage.LinkageType; +import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.inventory.SWItem; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +import java.util.Arrays; + +@Linked(LinkageType.GUI_ITEM) +public class RedstoneTesterGuiItem extends GuiItem { + + public RedstoneTesterGuiItem() { + super(23); + } + + @Override + public ItemStack getItem(Player player) { + return new SWItem(Material.BLAZE_ROD, ColorConfig.HIGHLIGHT + "Redstonetester", Arrays.asList(ColorConfig.HIGHLIGHT + "Linksklick Block " + ColorConfig.OTHER + "-" + ColorConfig.BASE + " Setzt die 1. Position", ColorConfig.HIGHLIGHT + "Rechtsklick Block " + ColorConfig.OTHER + "-" + ColorConfig.BASE + " Setzt die 2. Position", ColorConfig.HIGHLIGHT + "Shift-Rechtsklick Luft " + ColorConfig.OTHER + "-" + ColorConfig.BASE + " Zurücksetzten"), false, null).getItemStack(); + } + + @Override + public boolean click(ClickType click, Player p) { + p.performCommand("redstonetester"); + return true; + } + + @Override + public Permission permission() { + return Permission.MEMBER; + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterCommand.java index ef84d72b..0bbf47a5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterCommand.java @@ -25,7 +25,6 @@ import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; -import de.steamwar.core.VersionedRunnable; import org.bukkit.entity.Player; @Linked(LinkageType.COMMAND) @@ -42,9 +41,7 @@ public class RedstonetesterCommand extends SWCommand { @Register public void genericCommand(Player p) { - VersionedRunnable.call(new VersionedRunnable(() -> p.sendMessage(BauSystem.PREFIX + "Der RedstoneTester ist nicht in der 1.12 verfügbar"), 8), new VersionedRunnable(() -> { - p.sendMessage(BauSystem.PREFIX + "Messe die Zeit zwischen der Aktivierung zweier Redstone Komponenten"); - SWUtils.giveItemToPlayer(p, RedstonetesterUtils.WAND); - }, 15)); + p.sendMessage(BauSystem.PREFIX + "Messe die Zeit zwischen der Aktivierung zweier Redstone Komponenten"); + SWUtils.giveItemToPlayer(p, RedstonetesterUtils.WAND); } } \ No newline at end of file