Added CPU & RAM information to /co status

This commit is contained in:
Intelli 2024-07-09 18:02:49 -06:00
parent e093970992
commit dbd8723752
7 changed files with 77 additions and 2 deletions

View file

@ -21,6 +21,8 @@ import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.config.Configurator;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -51,6 +53,8 @@ import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.io.BukkitObjectOutputStream;
import org.jutils.jhardware.HardwareInfo;
import org.jutils.jhardware.model.ProcessorInfo;
import net.coreprotect.CoreProtect;
import net.coreprotect.bukkit.BukkitAdapter;
@ -112,6 +116,19 @@ public class Util extends Queue {
return name;
}
public static ProcessorInfo getProcessorInfo() {
ProcessorInfo result = null;
try {
Configurator.setLevel("com.profesorfalken.jsensors.manager.unix.UnixSensorsManager", Level.WARN);
result = HardwareInfo.getProcessorInfo();
}
catch (Exception e) {
// unable to read processor information
}
return result;
}
public static int getBlockId(Material material) {
if (material == null) {
material = Material.AIR;