Skip to content

Commit

Permalink
CommandServerInfo.java: remove CPU info
Browse files Browse the repository at this point in the history
This can be re-added if we find a way to do it without using shell commands.

Closes #354
  • Loading branch information
kaboombot authored Sep 10, 2024
1 parent 60b20ab commit d36503e
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/main/java/pw/kaboom/extras/commands/CommandServerInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
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;

Expand Down Expand Up @@ -52,28 +50,6 @@ public boolean onCommand(final @Nonnull CommandSender sender,
+ 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())
);
Expand Down

0 comments on commit d36503e

Please sign in to comment.