61 lines
2.1 KiB
Java
61 lines
2.1 KiB
Java
package eu.univento.core.commands;
|
|
|
|
import java.util.List;
|
|
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
import eu.univento.core.Core;
|
|
import eu.univento.core.api.AutoCommand;
|
|
import eu.univento.core.api.Messages;
|
|
import eu.univento.core.api.player.CustomPlayer;
|
|
import eu.univento.core.api.player.Perms.Ranks;
|
|
|
|
/**
|
|
* prints infos about the server
|
|
* @author joethei
|
|
* @version 1.0
|
|
*/
|
|
public class SystemInfo extends AutoCommand<Core>{
|
|
|
|
/**
|
|
* @param plugin main class
|
|
* @param command command to execute
|
|
* @param description describes the command
|
|
* @param aliases aliases of command
|
|
*/
|
|
public SystemInfo(Core plugin, String command, String description, String[] aliases) {
|
|
super(plugin, command, description, aliases);
|
|
}
|
|
|
|
@Override
|
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
|
if(sender instanceof Player) {
|
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
|
if(p.isAllowed(Ranks.Admin)) {
|
|
Runtime run = Runtime.getRuntime();
|
|
p.sendMessage("§6§l===SystemInfo <SpigotServer>===");
|
|
p.sendMessage("§6Spigot Version: " + Bukkit.getVersion());
|
|
p.sendMessage("§6Genutzter Arbeitsspeicher: " + (run.totalMemory() - run.freeMemory() / 1048576L) + " MB");
|
|
p.sendMessage("§6Freier Arbeitsspeicher: " + run.freeMemory() / 1048576L + " MB");
|
|
p.sendMessage("§6Gesamter Arbeitsspeicher: " + run.maxMemory() / 1048576L + " MB");
|
|
p.sendMessage("§6Verfügbare Prozessoren: " + run.availableProcessors());
|
|
p.sendMessage("§6Betriebssystem: " + System.getProperty("os.name"));
|
|
p.sendMessage("§6Betriebsystem Version: " + System.getProperty("os.version"));
|
|
p.sendMessage("§6Betriebssystem Architektur: " + System.getProperty("os.arch"));
|
|
}else {
|
|
p.sendMessage(Messages.NO_PERMS);
|
|
}
|
|
}else {
|
|
sender.sendMessage(Messages.NOT_A_PLAYER);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
|
return null;
|
|
}
|
|
|
|
} |