From 346f347243826f6a3ea42d6a72d9f78d0ffdcd3d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 1 Feb 2022 13:57:52 +0100 Subject: [PATCH] Add 1 new GuiItem Signed-off-by: yoyosource --- BauSystem_Main/src/BauSystem.properties | 1 + .../other/items/WorldSpawnBauGuiItem.java | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/other/items/WorldSpawnBauGuiItem.java diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 8fe57999..41329a18 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -878,6 +878,7 @@ OTHER_ITEMS_GAMEMODE_LORE_2=§eLinks-Click§8:§7 Umschalten zwischen Survival u OTHER_ITEMS_KILLALL_NAME=§eKillAll OTHER_ITEMS_KILLALL_LORE_1=§eOhne Shift§8:§7 nur die Region OTHER_ITEMS_KILLALL_LORE_2=§eMit Shift§8:§7 Global +OTHER_ITEMS_WORLDSPAWN_NAME=§eWorldSpawn OTHER_SLOT_INVALID_SLOT=§cInvalider Slot OTHER_NOCLIP_SLOT_INFO=§7Mit /slot kannst du den ausgewählten Slot ändern und einen anderen Block in den Slot nehmen. OTHER_NOCLIP_SLOT_HELP_PICK = §8/§eslot pick §8-§7 Lege den angeguckten Block ins Inventar diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/other/items/WorldSpawnBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/other/items/WorldSpawnBauGuiItem.java new file mode 100644 index 00000000..2c9ea43e --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/other/items/WorldSpawnBauGuiItem.java @@ -0,0 +1,61 @@ +/* + * 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.other.items; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.features.other.WorldSpawnCommand; +import de.steamwar.bausystem.linkage.LinkageType; +import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.bausystem.linkage.LinkedInstance; +import de.steamwar.bausystem.linkage.specific.BauGuiItem; +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; + +@Linked(LinkageType.BAU_GUI_ITEM) +public class WorldSpawnBauGuiItem extends BauGuiItem { + + @LinkedInstance + private WorldSpawnCommand worldSpawnCommand; + + public WorldSpawnBauGuiItem() { + super(33); + } + + @Override + public ItemStack getItem(Player player) { + return new SWItem(Material.ENDER_EYE, BauSystem.MESSAGE.parse("OTHER_ITEMS_WORLDSPAWN_NAME", player)).getItemStack(); + } + + @Override + public boolean click(ClickType click, Player p) { + p.closeInventory(); + worldSpawnCommand.genericCommand(p); + return false; + } + + @Override + public Permission permission() { + return Permission.MEMBER; + } +}