SteamWar/BauSystem2.0
Archiviert
12
0

Add InfoCommand

Dieser Commit ist enthalten in:
yoyosource 2021-04-19 20:49:42 +02:00
Ursprung a36267a14e
Commit da392a5d9c
2 geänderte Dateien mit 75 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -40,6 +40,9 @@ public class BauCommand extends SWCommand {
@LinkedInstance(BauServer.class)
private BauServer bauServer;
@LinkedInstance(InfoCommand.class)
private InfoCommand infoCommand;
public BauCommand() {
super("bau", "b", "gs");
}
@ -52,8 +55,7 @@ public class BauCommand extends SWCommand {
@Register("info")
public void infoCommand(Player p) {
// TODO: Implement this
// CommandInfo.sendBauInfo(p);
infoCommand.sendBauInfo(p);
}
@Register("togglewe")

Datei anzeigen

@ -0,0 +1,71 @@
package de.steamwar.bausystem.features.bau;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.linkage.LinkedInstance;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
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.features.tpslimit.TPSWarpUtils.getTps;
@Linked(LinkageType.COMMAND)
public class InfoCommand extends SWCommand {
@LinkedInstance(BauServer.class)
private BauServer bauServer;
public InfoCommand() {
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) {
sendBauInfo(p);
}
public void sendBauInfo(Player p) {
p.sendMessage(BauSystem.PREFIX + "Besitzer: §e" + SteamwarUser.get(bauServer.getOwnerID()).getUserName());
Region region = Region.getRegion(p.getLocation());
p.sendMessage(BauSystem.PREFIX + "§eTNT§8: " + region.get(Flag.TNT).getChatValue().toUpperCase() + " §eFire§8: " + region.get(Flag.FIRE).getChatValue().toUpperCase() + " §eFreeze§8: " + region.get(Flag.FREEZE).getChatValue().toUpperCase());
if (region.getFloorLevel() != 0) {
p.sendMessage(BauSystem.PREFIX + "§eProtect§8: " + region.get(Flag.PROTECT).getChatValue().toUpperCase());
}
List<BauweltMember> members = BauweltMember.getMembers(bauServer.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 (!TPSWarpUtils.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());
}
}