/* * This file is a part of the SteamWar software. * * Copyright (C) 2025 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.commands; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.world.TPSUtils; import de.steamwar.bausystem.world.regions.Region; import de.steamwar.command.SWCommand; import de.steamwar.core.TPSWatcher; import de.steamwar.sql.BauweltMember; import de.steamwar.sql.SteamwarUser; import org.bukkit.entity.Player; import java.util.List; import static de.steamwar.bausystem.world.TPSUtils.getTps; public class CommandInfo extends SWCommand { public CommandInfo() { super("bauinfo"); } @Register(help = true) public void genericHelp(Player p, String... args) { p.sendMessage("§8/§ebauinfo §8- §7Gibt Informationen über den Bau"); } @Register public void genericCommand(Player p) { CommandInfo.sendBauInfo(p); } public static void sendBauInfo(Player p) { p.sendMessage(BauSystem.PREFIX + "Besitzer: §e" + SteamwarUser.get(BauSystem.getOwnerID()).getUserName()); Region region = Region.getRegion(p.getLocation()); p.sendMessage(BauSystem.PREFIX + "§eTNT§8: " + region.getTntMode().getName() + " §eFire§8: " + (region.isFire() ? "§aAUS" : "§cAN") + " §eFreeze§8: " + (region.isFreeze() ? "§aAN" : "§cAUS")); if (region.hasProtection()) { p.sendMessage(BauSystem.PREFIX + "§eProtect§8: " + (region.isProtect() ? "§aAN" : "§cAUS")); } List members = BauweltMember.getMembers(BauSystem.getOwnerID()); StringBuilder membermessage = new StringBuilder().append(BauSystem.PREFIX).append("Mitglieder: "); for (BauweltMember member : members) { membermessage.append("§e").append(SteamwarUser.get(member.getMemberID()).getUserName()).append("§8["); membermessage.append(member.isWorldEdit() ? "§a" : "§c").append("WE").append("§8,"); membermessage.append(member.isWorld() ? "§a" : "§c").append("W").append("§8]").append(" "); } p.sendMessage(membermessage.toString()); StringBuilder tpsMessage = new StringBuilder(); tpsMessage.append(BauSystem.PREFIX).append("TPS:§e"); tpsMessage.append(" ").append(getTps(TPSWatcher.TPSType.ONE_SECOND)); tpsMessage.append(" ").append(getTps(TPSWatcher.TPSType.TEN_SECONDS)); if (!TPSUtils.isWarping()) { tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_MINUTE)); tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES)); tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)); } p.sendMessage(tpsMessage.toString()); } }