From d36503ed3fe5fa078566673744c02cacec1eea0a Mon Sep 17 00:00:00 2001 From: Kaboom <58372747+kaboombot@users.noreply.github.com> Date: Wed, 11 Sep 2024 02:32:54 +0300 Subject: [PATCH] CommandServerInfo.java: remove CPU info This can be re-added if we find a way to do it without using shell commands. Closes #354 --- .../extras/commands/CommandServerInfo.java | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/src/main/java/pw/kaboom/extras/commands/CommandServerInfo.java b/src/main/java/pw/kaboom/extras/commands/CommandServerInfo.java index 0348054..3befce4 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandServerInfo.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandServerInfo.java @@ -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()) );