SteamWar/BauSystem2.0
Archiviert
12
0

Add Some™ GuiItems

Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Chaoscaot 2021-04-26 20:08:13 +02:00
Ursprung f33218d90b
Commit b31578ec8b
13 geänderte Dateien mit 388 neuen und 82 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,68 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.bau;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.BauServer;
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.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.*;
import de.steamwar.inventory.SWItem;
import de.steamwar.sql.SteamwarUser;
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 BauInfoGuiItem extends GuiItem {
public BauInfoGuiItem() {
super(7);
}
@Override
public ItemStack getItem(Player player) {
SWItem itemStack = SWItem.getPlayerSkull(SteamwarUser.get(BauServer.getInstance().getOwner()).getUserName());
itemStack.setName(ColorConfig.HIGHLIGHT + "Bau management");
Region region = Region.getRegion(player.getLocation());
itemStack.setLore(Arrays.asList(ColorConfig.BASE + "TNT" + ColorConfig.OTHER + ": " + ColorConfig.HIGHLIGHT + region.getPlain(Flag.TNT, TNTMode.class).getChatValue(),
ColorConfig.BASE + "Freeze" + ColorConfig.OTHER + ": " + ColorConfig.HIGHLIGHT + region.getPlain(Flag.FREEZE, FreezeMode.class).getChatValue(),
ColorConfig.BASE + "Feuer" + ColorConfig.OTHER + ": " + ColorConfig.HIGHLIGHT + region.getPlain(Flag.FIRE, FireMode.class).getChatValue(),
ColorConfig.BASE + "Farbe" + ColorConfig.OTHER + ": " + ColorConfig.HIGHLIGHT + region.getPlain(Flag.COLOR, ColorMode.class).getChatValue(),
ColorConfig.BASE + "Protect" + ColorConfig.OTHER + ": " + ColorConfig.HIGHLIGHT + region.getPlain(Flag.PROTECT, ProtectMode.class).getChatValue()));
return itemStack.getItemStack();
}
@Override
public boolean click(ClickType click, Player p) {
return false;
}
@Override
public Permission permission() {
return Permission.MEMBER;
}
}

Datei anzeigen

@ -0,0 +1,53 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.detonator;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.linkage.GuiItem;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
@Linked(LinkageType.GUI_ITEM)
public class DetonatorGuiItem extends GuiItem {
public DetonatorGuiItem() {
super(8);
}
@Override
public ItemStack getItem(Player player) {
return DetonatorCommand.getWAND();
}
@Override
public boolean click(ClickType click, Player p) {
p.closeInventory();
p.performCommand("detonator wand");
return false;
}
@Override
public Permission permission() {
return Permission.MEMBER;
}
}

Datei anzeigen

@ -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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.gui;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig;
import de.steamwar.bausystem.linkage.GuiItem;
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;
public class BauGuiGuiItem extends GuiItem {
public BauGuiGuiItem() {
super(9);
}
@Override
public ItemStack getItem(Player player) {
return new SWItem(Material.NETHER_STAR, ColorConfig.HIGHLIGHT + "Bau GUI", Arrays.asList(ColorConfig.BASE + "Du kannst dieses Item zum Öffnen der BauGUI nutzen", ColorConfig.BASE + "oder Doppel F (Swap hands) drücken."), false, clickType -> {
}).getItemStack();
}
@Override
public boolean click(ClickType click, Player p) {
p.closeInventory();
BauGUI.giveItem(p);
return false;
}
@Override
public Permission permission() {
return null;
}
}

Datei anzeigen

@ -0,0 +1,106 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.loader;
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.SWAnvilInv;
import de.steamwar.inventory.SWInventory;
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 LoaderGuiItem extends GuiItem {
public LoaderGuiItem() {
super(9);
}
@Override
public ItemStack getItem(Player player) {
return new SWItem(Material.FLINT_AND_STEEL, ColorConfig.HIGHLIGHT + "Loader").getItemStack();
}
@Override
public boolean click(ClickType click, Player p) {
p.closeInventory();
openLoaderGui(p);
return false;
}
private void openLoaderGui(Player p) {
SWInventory inv = new SWInventory(p, 9, "Loader");
if (Loader.getLoader(p) == null) {
inv.setItem(4, new SWItem(Material.SCUTE, ColorConfig.HIGHLIGHT + "Neuer Loader", clickType -> {
p.closeInventory();
p.performCommand("loader setup");
}));
} else {
Loader loader = Loader.getLoader(p);
if (loader.getStage() != Loader.Stage.RUNNING) {
inv.setItem(0, new SWItem(Material.GREEN_DYE, ColorConfig.HIGHLIGHT + "Loader Starten", clickType -> {
p.closeInventory();
p.performCommand("loader start");
}));
} else {
inv.setItem(0, new SWItem(Material.RED_DYE, ColorConfig.HIGHLIGHT + "Loader pausieren", clickType -> {
p.closeInventory();
p.performCommand("loader pause");
}));
}
inv.setItem(2, new SWItem(Material.ARROW, ColorConfig.HIGHLIGHT + "Letzte Aktion Rückgängig machen", clickType -> {
p.closeInventory();
p.performCommand("loader undo");
}));
inv.setItem(4, new SWItem(Material.COMPASS, ColorConfig.HIGHLIGHT + "Schuss Delay", Arrays.asList(ColorConfig.BASE + "Aktuell: " + ColorConfig.HIGHLIGHT + loader.getTicksBetweenShots()), false, clickType -> {
p.closeInventory();
SWAnvilInv anvilInv = new SWAnvilInv(p, "Schuss Delay");
anvilInv.setItem(Material.CLOCK);
anvilInv.setCallback(s -> p.performCommand("loader delay " + s));
anvilInv.open();
}));
inv.setItem(6, new SWItem(Material.CLOCK, ColorConfig.HIGHLIGHT + "Geschwindigkeit", Arrays.asList(ColorConfig.BASE + "Aktuell: " + ColorConfig.HIGHLIGHT + loader.getTicksBetweenBlocks()), false, clickType -> {
p.closeInventory();
SWAnvilInv anvilInv = new SWAnvilInv(p, "Block Platzier Geschwindigkeit");
anvilInv.setItem(Material.CLOCK);
anvilInv.setCallback(s -> p.performCommand("loader speed " + s));
anvilInv.open();
}));
inv.setItem(8, new SWItem(Material.BARRIER, ColorConfig.HIGHLIGHT + "Loader Stoppen", clickType -> {
p.closeInventory();
p.performCommand("loader stop");
}));
}
inv.open();
}
@Override
public Permission permission() {
return Permission.WORLD;
}
}

Datei anzeigen

@ -0,0 +1,60 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.other;
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.SWAnvilInv;
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.GUI_ITEM)
public class TeleportGuiItem extends GuiItem {
public TeleportGuiItem() {
super(10);
}
@Override
public ItemStack getItem(Player player) {
return new SWItem(Material.ENDER_PEARL, ColorConfig.HIGHLIGHT + "Teleporter").getItemStack();
}
@Override
public boolean click(ClickType click, Player p) {
p.closeInventory();
SWAnvilInv inv = new SWAnvilInv(p, "Teleportieren");
inv.setItem(Material.ENDER_PEARL);
inv.setCallback(s -> p.performCommand("tp " + s));
inv.open();
return false;
}
@Override
public Permission permission() {
return Permission.MEMBER;
}
}

Datei anzeigen

@ -34,7 +34,6 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.Collections;
@ -88,11 +87,7 @@ public class ColorGuiItem extends GuiItem {
public ItemStack getItem(Player player) {
Region region = Region.getRegion(player.getLocation());
ColorMode mode = region.getPlain(Flag.COLOR, ColorMode.class);
ItemStack itemStack = new ItemStack(mapColor(mode.getColor()));
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(ColorConfig.BASE + "Color: " + ColorConfig.HIGHLIGHT + mode.getChatValue());
itemStack.setItemMeta(meta);
return itemStack;
return new SWItem(mapColor(mode.getColor()), ColorConfig.BASE + "Color: " + ColorConfig.HIGHLIGHT + mode.getChatValue()).getItemStack();
}
@Override

Datei anzeigen

@ -27,11 +27,11 @@ import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.FireMode;
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 org.bukkit.inventory.meta.ItemMeta;
@Linked(LinkageType.GUI_ITEM)
public class FireGuiItem extends GuiItem {
@ -44,17 +44,9 @@ public class FireGuiItem extends GuiItem {
public ItemStack getItem(Player player) {
Region region = Region.getRegion(player.getLocation());
if (region.getPlain(Flag.FIRE, FireMode.class) == FireMode.ALLOW) {
ItemStack itemStack = new ItemStack(Material.FIRE_CHARGE);
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(ColorConfig.BASE + "Feuer: " + ColorConfig.HIGHLIGHT + "Eingeschaltet");
itemStack.setItemMeta(meta);
return itemStack;
return new SWItem(Material.FIRE_CHARGE, ColorConfig.BASE + "Feuer: " + ColorConfig.HIGHLIGHT + "Eingeschaltet").getItemStack();
} else {
ItemStack itemStack = new ItemStack(Material.FIREWORK_STAR);
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(ColorConfig.BASE + "Feuer: " + ColorConfig.HIGHLIGHT + "Eingeschaltet");
itemStack.setItemMeta(meta);
return itemStack;
return new SWItem(Material.FIREWORK_STAR, ColorConfig.BASE + "Feuer: " + ColorConfig.HIGHLIGHT + "Eingeschaltet").getItemStack();
}
}

Datei anzeigen

@ -27,11 +27,11 @@ import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
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 org.bukkit.inventory.meta.ItemMeta;
@Linked(LinkageType.GUI_ITEM)
public class FreezeGuiItem extends GuiItem {
@ -44,17 +44,9 @@ public class FreezeGuiItem extends GuiItem {
public ItemStack getItem(Player player) {
Region region = Region.getRegion(player.getLocation());
if (region.getPlain(Flag.FREEZE, FreezeMode.class) == FreezeMode.ACTIVE) {
ItemStack itemStack = new ItemStack(Material.GUNPOWDER);
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(ColorConfig.BASE + "Freeze: " + ColorConfig.HIGHLIGHT + "Eingeschaltet");
itemStack.setItemMeta(meta);
return itemStack;
return new SWItem(Material.GUNPOWDER, ColorConfig.BASE + "Freeze: " + ColorConfig.HIGHLIGHT + "Eingeschaltet").getItemStack();
} else {
ItemStack itemStack = new ItemStack(Material.REDSTONE);
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(ColorConfig.BASE + "Freeze: " + ColorConfig.HIGHLIGHT + "Ausgeschaltet");
itemStack.setItemMeta(meta);
return itemStack;
return new SWItem(Material.REDSTONE, ColorConfig.BASE + "Freeze: " + ColorConfig.HIGHLIGHT + "Ausgeschaltet").getItemStack();
}
}

Datei anzeigen

@ -27,11 +27,11 @@ import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.ProtectMode;
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 org.bukkit.inventory.meta.ItemMeta;
@Linked(LinkageType.GUI_ITEM)
public class ProtectGuiItem extends GuiItem {
@ -44,17 +44,9 @@ public class ProtectGuiItem extends GuiItem {
public ItemStack getItem(Player player) {
Region region = Region.getRegion(player.getLocation());
if (region.getPlain(Flag.PROTECT, ProtectMode.class) == ProtectMode.ACTIVE) {
ItemStack itemStack = new ItemStack(Material.OBSIDIAN);
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(ColorConfig.BASE + "Protect: " + ColorConfig.HIGHLIGHT + "Eingeschaltet");
itemStack.setItemMeta(meta);
return itemStack;
return new SWItem(Material.OBSIDIAN, ColorConfig.BASE + "Protect: " + ColorConfig.HIGHLIGHT + "Eingeschaltet").getItemStack();
} else {
ItemStack itemStack = new ItemStack(Material.STONE);
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(ColorConfig.BASE + "Protect: " + ColorConfig.HIGHLIGHT + "Eingeschaltet");
itemStack.setItemMeta(meta);
return itemStack;
return new SWItem(Material.STONE, ColorConfig.BASE + "Protect: " + ColorConfig.HIGHLIGHT + "Ausgeschaltet").getItemStack();
}
}

Datei anzeigen

@ -31,7 +31,6 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.Collections;
@ -46,11 +45,7 @@ public class ResetGuiItem extends GuiItem {
@Override
public ItemStack getItem(Player player) {
ItemStack itemStack = new ItemStack(Material.END_STONE);
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(ColorConfig.HIGHLIGHT + "Reset");
itemStack.setItemMeta(meta);
return itemStack;
return new SWItem(Material.HEAVY_WEIGHTED_PRESSURE_PLATE, ColorConfig.HIGHLIGHT + "Reset").getItemStack();
}
@Override

Datei anzeigen

@ -31,7 +31,6 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.Collections;
@ -46,11 +45,7 @@ public class TestblockGuiItem extends GuiItem {
@Override
public ItemStack getItem(Player player) {
ItemStack itemStack = new ItemStack(Material.END_STONE);
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(ColorConfig.HIGHLIGHT + "Testblock");
itemStack.setItemMeta(meta);
return itemStack;
return new SWItem(Material.END_STONE, ColorConfig.HIGHLIGHT + "Testblock").getItemStack();
}
@Override

Datei anzeigen

@ -33,7 +33,6 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@Linked(LinkageType.GUI_ITEM)
public class TntGuiItem extends GuiItem {
@ -45,49 +44,51 @@ public class TntGuiItem extends GuiItem {
@Override
public ItemStack getItem(Player player) {
switch (Region.getRegion(player.getLocation()).getPlain(Flag.TNT, TNTMode.class)) {
case DENY: {
ItemStack itemStack = new ItemStack(Material.MINECART);
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(ColorConfig.BASE + "TNT: " + ColorConfig.HIGHLIGHT + "Ausgeschaltet");
itemStack.setItemMeta(meta);
return itemStack;
}
case ONLY_TB: {
ItemStack itemStack = new ItemStack(Material.TNT_MINECART);
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(ColorConfig.BASE + "TNT: " + ColorConfig.HIGHLIGHT + "nur Testblock");
itemStack.setItemMeta(meta);
return itemStack;
}
default: {
ItemStack itemStack = new ItemStack(Material.TNT);
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(ColorConfig.BASE + "TNT: " + ColorConfig.HIGHLIGHT + "Eingeschaltet");
itemStack.setItemMeta(meta);
return itemStack;
}
case DENY:
return new SWItem(Material.MINECART, ColorConfig.BASE + "TNT: " + ColorConfig.HIGHLIGHT + "Ausgeschaltet").getItemStack();
case ONLY_TB:
return new SWItem(Material.TNT_MINECART, ColorConfig.BASE + "TNT: " + ColorConfig.HIGHLIGHT + "nur Testblock").getItemStack();
default:
return new SWItem(Material.TNT, ColorConfig.BASE + "TNT: " + ColorConfig.HIGHLIGHT + "Eingeschaltet").getItemStack();
}
}
@Override
public boolean click(ClickType click, Player p) {
if (click == ClickType.LEFT) {
p.performCommand("tnt");
return true;
switch (Region.getRegion(p.getLocation()).getPlain(Flag.TNT, TNTMode.class)) {
case DENY:
updateTntMode(TNTMode.ALLOW, p);
break;
case ALLOW:
updateTntMode(TNTMode.ONLY_TB, p);
break;
default:
updateTntMode(TNTMode.DENY, p);
}
} else {
p.closeInventory();
SWInventory selector = new SWInventory(p, 9, "Tnt Modus");
selector.setItem(1, new SWItem(Material.TNT, ColorConfig.HIGHLIGHT + "Einschalten", clickType -> updateTntMode(TNTMode.ALLOW, p)));
if (!Region.getRegion(p.getLocation()).isGlobal())
selector.setItem(4, new SWItem(Material.TNT_MINECART, ColorConfig.HIGHLIGHT + "nur Testblock", clickType -> updateTntMode(TNTMode.ONLY_TB, p)));
selector.setItem(7, new SWItem(Material.MINECART, ColorConfig.HIGHLIGHT + "Ausschalten", clickType -> updateTntMode(TNTMode.DENY, p)));
selector.setItem(1, new SWItem(Material.TNT, ColorConfig.HIGHLIGHT + "Einschalten", clickType -> {
updateTntMode(TNTMode.ALLOW, p);
p.closeInventory();
}));
if (!Region.getRegion(p.getLocation()).isGlobal()) {
selector.setItem(4, new SWItem(Material.TNT_MINECART, ColorConfig.HIGHLIGHT + "nur Testblock", clickType -> {
updateTntMode(TNTMode.ONLY_TB, p);
p.closeInventory();
}));
}
selector.setItem(7, new SWItem(Material.MINECART, ColorConfig.HIGHLIGHT + "Ausschalten", clickType -> {
updateTntMode(TNTMode.DENY, p);
p.closeInventory();
}));
selector.open();
return false;
}
return false;
}
private void updateTntMode(TNTMode mode, Player p) {
p.closeInventory();
switch (mode) {
case ONLY_TB:
p.performCommand("tnt tb");
@ -99,6 +100,7 @@ public class TntGuiItem extends GuiItem {
p.performCommand("tnt off");
break;
}
update();
}
@Override

Datei anzeigen

@ -46,7 +46,7 @@ public abstract class GuiItem {
@Override
public String toString() {
return "GuiItem{" +
"slot=" + slot +
"slot=" + slot + ", " +
"class=" + this.getClass().getName() +
'}';
}