61 lines
2.1 KiB
Java
61 lines
2.1 KiB
Java
package eu.univento.core.commands;
|
|
|
|
import eu.univento.core.Core;
|
|
import eu.univento.core.api.AutoCommand;
|
|
import eu.univento.core.api.languages.Messages;
|
|
import eu.univento.core.api.player.CustomPlayer;
|
|
import eu.univento.core.api.player.Perms.Ranks;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 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());
|
|
Messages msgs = new Messages(p);
|
|
if(p.isAllowed(Ranks.SrModerator)) {
|
|
Runtime run = Runtime.getRuntime();
|
|
p.sendMessage("§6§l===SystemInfo <SpigotServer>===");
|
|
p.sendMessage("§6Spigot version: " + Bukkit.getVersion());
|
|
p.sendMessage("§6used memory: " + (run.totalMemory() - run.freeMemory() / 1048576L) + " MB");
|
|
p.sendMessage("§6free memory: " + run.freeMemory() / 1048576L + " MB");
|
|
p.sendMessage("§6total memory: " + run.maxMemory() / 1048576L + " MB");
|
|
p.sendMessage("§6avaiable cores: " + run.availableProcessors());
|
|
p.sendMessage("§6OS: " + System.getProperty("os.name"));
|
|
p.sendMessage("§6OS version: " + System.getProperty("os.version"));
|
|
p.sendMessage("§6OS architecture: " + System.getProperty("os.arch"));
|
|
}else {
|
|
p.sendMessage(msgs.NO_PERMS());
|
|
}
|
|
}else {
|
|
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
|
return null;
|
|
}
|
|
|
|
} |