Merge pull request 'Update StatCommand' (#402) from CommandStat into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #402 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
adee8f565b
@ -21,6 +21,7 @@ package de.steamwar.bungeecore.commands;
|
|||||||
|
|
||||||
import de.steamwar.bungeecore.Message;
|
import de.steamwar.bungeecore.Message;
|
||||||
import de.steamwar.bungeecore.Node;
|
import de.steamwar.bungeecore.Node;
|
||||||
|
import de.steamwar.command.SWCommand;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@ -28,14 +29,14 @@ import java.io.InputStreamReader;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class StatCommand extends BasicCommand {
|
public class StatCommand extends SWCommand {
|
||||||
|
|
||||||
public StatCommand() {
|
public StatCommand() {
|
||||||
super("stat", "bungeecore.softreload", "stats");
|
super("stat", "bungeecore.softreload", "stats");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Register
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void genericCommand(CommandSender sender) {
|
||||||
Map<String, Integer> serverCount = new HashMap<>();
|
Map<String, Integer> serverCount = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
Process process = new ProcessBuilder("ps", "x").start();
|
Process process = new ProcessBuilder("ps", "x").start();
|
||||||
@ -53,5 +54,4 @@ public class StatCommand extends BasicCommand {
|
|||||||
|
|
||||||
Node.forEach(node -> Message.send("STAT_SERVER", sender, node.getName(), node.getLoad(), serverCount.getOrDefault(node.getName(), 0)));
|
Node.forEach(node -> Message.send("STAT_SERVER", sender, node.getName(), node.getLoad(), serverCount.getOrDefault(node.getName(), 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren