From afffcc7fd82f783da3698ef3991ea6cb60ecd05d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 2 May 2021 20:17:22 +0200 Subject: [PATCH] Add AutoStartGuiItem --- .../features/autostart/AutoStartGuiItem.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutoStartGuiItem.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutoStartGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutoStartGuiItem.java new file mode 100644 index 00000000..64bcf929 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutoStartGuiItem.java @@ -0,0 +1,56 @@ +/* + * 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.autostart; + +import de.steamwar.bausystem.Permission; +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 AutoStartGuiItem extends GuiItem { + + public AutoStartGuiItem() { + super(24); + } + + @Override + public ItemStack getItem(Player player) { + return new SWItem(Material.BLAZE_ROD, "§eAutostartTimer", Arrays.asList("§eRechtsklick Block §8- §7Starte den Timer"), false, null).getItemStack(); + } + + @Override + public boolean click(ClickType click, Player p) { + p.performCommand("timer"); + return true; + } + + @Override + public Permission permission() { + return Permission.MEMBER; + } +}