SteamWar/BauSystem2.0
Archiviert
12
0

Irgendein GuiItem und noch nen bissle mehr.

Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Chaoscaot 2021-05-10 20:53:39 +02:00
Ursprung f1d126dd9a
Commit 48d6a0ed50
5 geänderte Dateien mit 168 neuen und 23 gelöschten Zeilen

Datei anzeigen

@ -1,21 +1,48 @@
PREFIX = §eBau§8System §8» #
# 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/>.
#
PREFIX = §eBau§8System §8»
# Permission # Permission
PERMISSION_WORLD=Einstellungen vornehmen PERMISSION_WORLD=Einstellungen vornehmen
PERMISSION_WORLD_EDIT=WorldEdit verwenden PERMISSION_WORLD_EDIT=WorldEdit verwenden
PERMISSION_CHANGE_YOU_ENABLE=§aDer Spieler darf nun {0} PERMISSION_CHANGE_YOU_ENABLE=§aDer Spieler darf nun {0}
PERMISSION_CHANGE_YOU_DISABLE=§cDer Spieler darf nun nicht mehr {0} PERMISSION_CHANGE_YOU_DISABLE=§cDer Spieler darf nun nicht mehr {0}
PERMISSION_CHANGE_OTHER_ENABLE=§aDu kannst nun auf der Welt von §6{0} §a{1} PERMISSION_CHANGE_OTHER_ENABLE=§aDu kannst nun auf der Welt von §6{0} §a{1}
PERMISSION_CHANGE_OTHER_DISABLE=§cDu kannst nun nicht mehr auf der Welt von §6{0} §c{1} PERMISSION_CHANGE_OTHER_DISABLE=§cDu kannst nun nicht mehr auf der Welt von §6{0} §c{1}
# Feature
FEATURE_OTHER_ITEMS_TELEPORT_GUI_NAME=Teleportieren
FEATURE_OTHER_ITEMS_TELEPORT_PLAYER_OFFLINE=§cDer Spieler ist Offline
FEATURE_GUI_EDITOR_ITEM_NAME=§eGui Editor
FEATURE_TRACER_GUI_NAME=Tracer Gui
FEATURE_TRACER_GUI_TRACE_INACTIVE=§eTracer Starten
FEATURE_TRACER_GUI_TRACE_ACTIVE=§eTracer Stoppen
FEATURE_TRACER_GUI_TRACE_ACTIVE_AUTO=§eAuto-Trace ist Aktiv
FEATURE_TRACER_GUI_AUTO_TRACE_INACTIVE=§eAuto-Tracer Aktivieren
FEATURE_TRACER_GUI_AUTO_TRACE_ACTIVE=§eAuto-Tracer Deaktivieren
FEATURE_TRACER_GUI_SHOW_GUI=§eTrace Show Gui
FEATURE_TRACER_GUI_DELETE=§eTrace Löschen
# Flags # Flags
FLAG_COLOR=Color FLAG_COLOR=Color
FLAG_TNT=TNT FLAG_TNT=TNT
FLAG_FIRE=Fire FLAG_FIRE=Fire
FLAG_FREEZE=Freeze FLAG_FREEZE=Freeze
FLAG_PROTECT=Protect FLAG_PROTECT=Protect
FLAG_FIRE_ALLOW=§can FLAG_FIRE_ALLOW=§can
FLAG_FIRE_DENY=§aaus FLAG_FIRE_DENY=§aaus

Datei anzeigen

@ -55,6 +55,9 @@ public class BauGUI {
} }
public static void addItem(BauGuiItem item) { public static void addItem(BauGuiItem item) {
if (ITEMS.containsKey(item.getId())) {
throw new IllegalArgumentException("Duplicate Id Key: " + item.getId() + ". From Classes: " + ITEMS.get(item.getId()).getClass().getName() + " and " + item.getClass().getName());
}
ITEMS.put(item.getId(), item); ITEMS.put(item.getId(), item);
} }

Datei anzeigen

@ -0,0 +1,55 @@
/*
* 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.editor;
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 BauGuiEditorGuiItem extends BauGuiItem {
public BauGuiEditorGuiItem() {
super(23);
}
@Override
public Permission permission() {
return Permission.MEMBER;
}
@Override
public ItemStack getItem(Player player) {
return new SWItem(Material.IRON_PICKAXE, BauSystem.MESSAGE.parse("FEATURE_GUI_EDITOR_ITEM_NAME", player)).getItemStack();
}
@Override
public boolean click(ClickType click, Player p) {
p.performCommand("gui editor");
return false;
}
}

Datei anzeigen

@ -19,18 +19,22 @@
package de.steamwar.bausystem.features.other.items; package de.steamwar.bausystem.features.other.items;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.config.ColorConfig;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.UUID;
@Linked(LinkageType.BAU_GUI_ITEM) @Linked(LinkageType.BAU_GUI_ITEM)
public class TeleportBauGuiItem extends BauGuiItem { public class TeleportBauGuiItem extends BauGuiItem {
@ -46,9 +50,14 @@ public class TeleportBauGuiItem extends BauGuiItem {
@Override @Override
public boolean click(ClickType click, Player p) { public boolean click(ClickType click, Player p) {
p.closeInventory(); p.closeInventory();
SWAnvilInv inv = new SWAnvilInv(p, "Teleportieren"); SWListInv<UUID> inv = new SWListInv<>(p, BauSystem.MESSAGE.parse("FEATURE_OTHER_ITEMS_TELEPORT_GUI_NAME", p), SWListInv.createPlayerList(p.getUniqueId()), (clickType, o) -> {
inv.setItem(Material.ENDER_PEARL); Player t = Bukkit.getPlayer(o);
inv.setCallback(s -> p.performCommand("tp " + s)); if (t == null) {
BauSystem.MESSAGE.send("FEATURE_OTHER_ITEMS_TELEPORT_PLAYER_OFFLINE", p);
} else {
p.performCommand("tp " + t.getName());
}
});
inv.open(); inv.open();
return false; return false;
} }

Datei anzeigen

@ -19,12 +19,16 @@
package de.steamwar.bausystem.features.tracer; package de.steamwar.bausystem.features.tracer;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.config.ColorConfig;
import de.steamwar.bausystem.features.tracer.record.RecordStateMachine; import de.steamwar.bausystem.features.tracer.record.RecordStateMachine;
import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.features.tracer.record.RecordStatus;
import de.steamwar.bausystem.features.tracer.show.TraceShowManager;
import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -46,8 +50,55 @@ public class TracerBauGuiItem extends BauGuiItem {
}).getItemStack(); }).getItemStack();
} }
private static void open(Player p) {
RecordStatus status = RecordStateMachine.getRecordStatus();
SWInventory inv = new SWInventory(p, 9, BauSystem.MESSAGE.parse("FEATURE_TRACER_GUI_NAME", p));
if (status.isTracing()) {
if (status.isAutoTrace()) {
inv.setItem(1, new SWItem(Material.GRAY_DYE, BauSystem.MESSAGE.parse("FEATURE_TRACER_GUI_TRACE_ACTIVE_AUTO", p)));
} else {
inv.setItem(1, new SWItem(Material.GREEN_DYE, BauSystem.MESSAGE.parse("FEATURE_TRACER_GUI_TRACE_ACTIVE", p), clickType -> {
p.performCommand("trace stop");
open(p);
}));
}
} else {
inv.setItem(1, new SWItem(Material.RED_DYE, BauSystem.MESSAGE.parse("FEATURE_TRACER_GUI_TRACE_INACTIVE", p), clickType -> {
p.performCommand("trace start");
open(p);
}));
}
if (status.isAutoTrace()) {
inv.setItem(3, new SWItem(Material.ENDER_EYE, BauSystem.MESSAGE.parse("FEATURE_TRACER_GUI_AUTO_TRACE_ACTIVE", p), clickType -> {
p.performCommand("trace auto");
open(p);
}));
} else {
inv.setItem(3, new SWItem(Material.FIREWORK_STAR, BauSystem.MESSAGE.parse("FEATURE_TRACER_GUI_AUTO_TRACE_INACTIVE", p), clickType -> {
p.performCommand("trace auto");
open(p);
}));
}
if (TraceShowManager.hasActiveShow(p)) {
inv.setItem(5, new SWItem(Material.TNT, BauSystem.MESSAGE.parse("FEATURE_TRACER_GUI_SHOW_GUI", p), clickType -> {
p.performCommand("trace show gui");
}));
} else {
inv.setItem(5, new SWItem(Material.GLASS, BauSystem.MESSAGE.parse("FEATURE_TRACER_GUI_SHOW_GUI", p), clickType -> {
p.performCommand("trace show gui");
}));
}
inv.setItem(7, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("FEATURE_TRACER_GUI_DELETE", p), clickType -> {
p.performCommand("trace delete");
open(p);
}));
inv.open();
}
@Override @Override
public boolean click(ClickType click, Player p) { public boolean click(ClickType click, Player p) {
open(p);
return false; return false;
} }