SteamWar/BauSystem2.0
Archiviert
12
0

Add MaterialCommand

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-05-25 13:55:48 +02:00
Ursprung 4d33f67926
Commit a08bb3b46d
2 geänderte Dateien mit 90 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -199,3 +199,14 @@ LOADER_BUTTON_INVALID = Invalider
# Other # Other
OTHER_ITEMS_TELEPORT_GUI-NAME = Teleportieren OTHER_ITEMS_TELEPORT_GUI-NAME = Teleportieren
OTHER_ITEMS_TELEPORT_PLAYER-OFFLINE = §cDer Spieler ist Offline OTHER_ITEMS_TELEPORT_PLAYER-OFFLINE = §cDer Spieler ist Offline
# Material
MATERIAL_BLAST-RESISTANCE = §8- §eBlast Resistance§8: §7{0}
MATERIAL_TNT_BREAKABLE = §8- §eZerstörbar durch TNT
MATERIAL_TNT_UNBREAKABLE = §8- §eNicht Zerstörbar durch TNT
MATERIAL_TRANSPARENT = §8- §eTransparenter Block
MATERIAL_SOLID = §8- §eSolider Block
MATERIAL_GRAVITY = §8- §eFallender Block
MATERIAL_OCCLUDING = §8- §eOccluding Block
MATERIAL_INTERACT-ABLE = §8- §eInterargierbarer Block
MATERIAL_FLAMMABLE = §8- §eFlammbarer Block

Datei anzeigen

@ -0,0 +1,78 @@
/*
* 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.util;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
@Linked(LinkageType.COMMAND)
public class MaterialCommand extends SWCommand {
public MaterialCommand() {
super("material");
}
@Register
public void materialGUI(Player p) {
List<SWListInv.SWListEntry<Material>> swListEntries = new ArrayList<>();
for (Material value : Material.values()) {
if (!value.isBlock()) {
continue;
}
if (value.isLegacy()) {
continue;
}
List<String> lore = new ArrayList<>();
lore.add(BauSystem.MESSAGE.parse("MATERIAL_BLAST-RESISTANCE", p, value.getBlastResistance()));
lore.add(BauSystem.MESSAGE.parse(value.getBlastResistance() > 9 ? "MATERIAL_TNT_UNBREAKABLE" : "MATERIAL_TNT_BREAKABLE", p));
if (value.isTransparent()) {
lore.add(BauSystem.MESSAGE.parse("MATERIAL_TRANSPARENT", p));
}
if (value.isSolid()) {
lore.add(BauSystem.MESSAGE.parse("MATERIAL_SOLID", p));
}
if (value.hasGravity()) {
lore.add(BauSystem.MESSAGE.parse("MATERIAL_GRAVITY", p));
}
if (value.isOccluding()) {
lore.add(BauSystem.MESSAGE.parse("MATERIAL_OCCLUDING", p));
}
if (value.isInteractable()) {
lore.add(BauSystem.MESSAGE.parse("MATERIAL_INTERACT-ABLE", p));
}
if (value.isFlammable()) {
lore.add(BauSystem.MESSAGE.parse("MATERIAL_FLAMMABLE", p));
}
SWItem swItem = new SWItem(value.isItem() ? value : Material.GHAST_TEAR, "§e" + value.name(), lore, false, clickType -> {});
swListEntries.add(new SWListInv.SWListEntry<>(swItem, value));
}
SWListInv<Material> materialSWListInv = new SWListInv<>(p, "Material", false, swListEntries, (clickType, material) -> {});
materialSWListInv.open();
}
}