CommandServerInfo.java: remove CPU info

This can be re-added if we find a way to do it without using shell commands.

Closes #354
This commit is contained in:
Kaboom 2024-09-11 02:32:54 +03:00 committed by GitHub
parent 60b20ab4bf
commit d36503ed3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,8 +7,6 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import javax.annotation.Nonnull;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
@ -52,28 +50,6 @@ public final class CommandServerInfo implements CommandExecutor {
+ ManagementFactory.getRuntimeMXBean().getVmVersion()
);
try {
final String[] shCommand = {
"/bin/sh",
"-c",
"cat /proc/cpuinfo | grep 'model name' | cut -f 2 -d ':' | awk '{$1=$1}1' | head -1"
};
final Process process = Runtime.getRuntime().exec(shCommand);
final InputStreamReader isr = new InputStreamReader(process.getInputStream());
final BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) {
sendInfoMessage(sender, "CPU model",
line
);
}
br.close();
} catch (Exception ignored) {
}
sendInfoMessage(sender, "CPU cores",
String.valueOf(Runtime.getRuntime().availableProcessors())
);