diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 7fe1b0df..cb974732 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -508,6 +508,8 @@ SIMULATOR_DELETE_HELP = §8/§esimulator delete §8[§7name§8] §8-§7 Deletes SIMULATOR_START_HELP = §8/§esimulator start §8[§7name§8] §8-§7 Starts the simulator SIMULATOR_NO_PERMS = §cYou are not allowed to use the simulator here +SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator + SIMULATOR_NO_SIM_IN_HAND = §cNo simulator item selected SIMULATOR_GUI_SELECT_SIM = Simulator selection SIMULATOR_NAME_ALREADY_EXISTS = §cSimulator already exists diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index 99cbc066..3afcdd41 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -509,6 +509,8 @@ SIMULATOR_DELETE_HELP = §8/§esimulator delete §8[§7name§8] §8-§7 Löscht SIMULATOR_START_HELP = §8/§esimulator start §8[§7name§8] §8-§7 Startet die Simulation SIMULATOR_NO_PERMS = §cDu darfst hier nicht den Simulator nutzen +SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator + SIMULATOR_NO_SIM_IN_HAND = §cKein Simulator Item gewählt SIMULATOR_GUI_SELECT_SIM = Simulator wählen SIMULATOR_NAME_ALREADY_EXISTS = §cSimulator existiert bereits diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java index 55dc22b2..b6f409e8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java @@ -98,5 +98,4 @@ public class FreezeListener implements Listener { e.setCancelled(true); } } - } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorBauGuiItem.java new file mode 100644 index 00000000..0487507b --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorBauGuiItem.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.simulator; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.linkage.LinkageType; +import de.steamwar.bausystem.linkage.Linked; +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 SimulatorBauGuiItem extends BauGuiItem { + + public SimulatorBauGuiItem() { + super(20); + } + + @Override + public ItemStack getItem(Player player) { + return new SWItem(Material.BLAZE_ROD, BauSystem.MESSAGE.parse("SIMULATOR_GUI_ITEM_NAME", player)).getItemStack(); + } + + @Override + public boolean click(ClickType click, Player p) { + p.closeInventory(); + p.performCommand("sim"); + return false; + } + + @Override + public Permission permission() { + return Permission.WORLD; + } +}