Solved problem with RAM not showing numbers correctly
This commit is contained in:
parent
cb9027c42a
commit
f3aad57148
@ -1,5 +1,8 @@
|
|||||||
# WebConsole
|
# WebConsole
|
||||||
|
|
||||||
|
[](https://github.com/mesacarlos/WebConsole/releases/latest)
|
||||||
|

|
||||||
|
|
||||||
WebConsole is a Spigot plugin for Minecraft 1.8-1.14 that enables you to view your server console and manage your server from anywhere. It creates a WebSocket server in the background used by the web interface to send commands, receive your console log and manage your server.
|
WebConsole is a Spigot plugin for Minecraft 1.8-1.14 that enables you to view your server console and manage your server from anywhere. It creates a WebSocket server in the background used by the web interface to send commands, receive your console log and manage your server.
|
||||||
|
|
||||||
Dont worry about privacy or security: all data is stored in your browser offline and your PC will connect directly to your minecraft server. No intermediary web servers, just you and your MC server.
|
Dont worry about privacy or security: all data is stored in your browser offline and your PC will connect directly to your minecraft server. No intermediary web servers, just you and your MC server.
|
||||||
|
@ -1,131 +1,131 @@
|
|||||||
/**
|
/**
|
||||||
WebConsole Language Manager for WebConsole
|
WebConsole Language Manager for WebConsole
|
||||||
Used to save your preferred language into your browser
|
Used to save your preferred language into your browser
|
||||||
https://github.com/mesacarlos
|
https://github.com/mesacarlos
|
||||||
2019 Carlos Mesa under MIT License.
|
2019 Carlos Mesa under MIT License.
|
||||||
*/
|
*/
|
||||||
function setLanguage(locale){
|
function setLanguage(locale){
|
||||||
//Save to persistence
|
//Save to persistence
|
||||||
persistenceManager.setLanguage(locale);
|
persistenceManager.setLanguage(locale);
|
||||||
//Set locale phrases
|
//Set locale phrases
|
||||||
switch(locale){
|
switch(locale){
|
||||||
case "en_US":
|
case "en_US":
|
||||||
lang = {
|
lang = {
|
||||||
"home_link": "Home",
|
"home_link": "Home",
|
||||||
"home_header": "Select a server from the menu",
|
"home_header": "Select a server from the menu",
|
||||||
"home_description": "Use the navigation bar to add a new Minecraft Server or connect to a previously added one.",
|
"home_description": "Use the navigation bar to add a new Minecraft Server or connect to a previously added one.",
|
||||||
"server_dropdown": "Your servers",
|
"server_dropdown": "Your servers",
|
||||||
"add_server": "Add Server",
|
"add_server": "Add Server",
|
||||||
"lang_dropdown": "Language",
|
"lang_dropdown": "Language",
|
||||||
"addServerModalLongTitle": "Add a new server",
|
"addServerModalLongTitle": "Add a new server",
|
||||||
"addServerModalSvName": "Server name:",
|
"addServerModalSvName": "Server name:",
|
||||||
"addServerModalSvIp": "Server IP:",
|
"addServerModalSvIp": "Server IP:",
|
||||||
"addServerModalSvPort": "WebConsole port:",
|
"addServerModalSvPort": "WebConsole port:",
|
||||||
"addServerModalSvSsl": "Server is SSL enabled",
|
"addServerModalSvSsl": "Server is SSL enabled",
|
||||||
"addServerModalClose": "Close",
|
"addServerModalClose": "Close",
|
||||||
"saveAndConnectServerButton": "Save and connect",
|
"saveAndConnectServerButton": "Save and connect",
|
||||||
"passwordModalLongTitle": "Password required",
|
"passwordModalLongTitle": "Password required",
|
||||||
"passwordModalLabel": "Password:",
|
"passwordModalLabel": "Password:",
|
||||||
"passwordModalRememberLabel": "Remember password",
|
"passwordModalRememberLabel": "Remember password",
|
||||||
"passwordModalCloseButton": "Close",
|
"passwordModalCloseButton": "Close",
|
||||||
"passwordSendButton": "Login",
|
"passwordSendButton": "Login",
|
||||||
"disconnectionModalLongTitle": "Disconnected",
|
"disconnectionModalLongTitle": "Disconnected",
|
||||||
"disconnectionModalDescription": "Connection was lost with the server you were connected to, probably caused by a server stop. Moved back to welcome screen.",
|
"disconnectionModalDescription": "Connection was lost with the server you were connected to, probably caused by a server stop. Moved back to welcome screen.",
|
||||||
"disconnectionModalCloseButton": "Close",
|
"disconnectionModalCloseButton": "Close",
|
||||||
"players_online": "Players Online",
|
"players_online": "Players Online",
|
||||||
"cpu_title": "CPU",
|
"cpu_title": "CPU",
|
||||||
"ram_title": "RAM",
|
"ram_title": "RAM usage",
|
||||||
"deleteServerButton": "Delete server",
|
"deleteServerButton": "Delete server",
|
||||||
"sendCommandButton": "Send"
|
"sendCommandButton": "Send"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "es_ES":
|
case "es_ES":
|
||||||
lang = {
|
lang = {
|
||||||
"home_link": "Inicio",
|
"home_link": "Inicio",
|
||||||
"home_header": "Selecciona un servidor del menú",
|
"home_header": "Selecciona un servidor del menú",
|
||||||
"home_description": "Usa la barra superior para añadir un nuevo servidor de Minecraft o para conectarte a un servidor añadido previamente.",
|
"home_description": "Usa la barra superior para añadir un nuevo servidor de Minecraft o para conectarte a un servidor añadido previamente.",
|
||||||
"server_dropdown": "Tus servidores",
|
"server_dropdown": "Tus servidores",
|
||||||
"add_server": "Añadir Server",
|
"add_server": "Añadir Server",
|
||||||
"lang_dropdown": "Idioma",
|
"lang_dropdown": "Idioma",
|
||||||
"addServerModalLongTitle": "Añadir un nuevo servidor",
|
"addServerModalLongTitle": "Añadir un nuevo servidor",
|
||||||
"addServerModalSvName": "Nombre del servidor:",
|
"addServerModalSvName": "Nombre del servidor:",
|
||||||
"addServerModalSvIp": "IP del servidor:",
|
"addServerModalSvIp": "IP del servidor:",
|
||||||
"addServerModalSvPort": "Puerto WebConsole:",
|
"addServerModalSvPort": "Puerto WebConsole:",
|
||||||
"addServerModalSvSsl": "SSL está activado",
|
"addServerModalSvSsl": "SSL está activado",
|
||||||
"addServerModalClose": "Cerrar",
|
"addServerModalClose": "Cerrar",
|
||||||
"saveAndConnectServerButton": "Guardar y conectar",
|
"saveAndConnectServerButton": "Guardar y conectar",
|
||||||
"passwordModalLongTitle": "Se necesita contraseña",
|
"passwordModalLongTitle": "Se necesita contraseña",
|
||||||
"passwordModalLabel": "Contraseña:",
|
"passwordModalLabel": "Contraseña:",
|
||||||
"passwordModalRememberLabel": "Recordar contraseña",
|
"passwordModalRememberLabel": "Recordar contraseña",
|
||||||
"passwordModalCloseButton": "Cerrar",
|
"passwordModalCloseButton": "Cerrar",
|
||||||
"passwordSendButton": "Iniciar sesión",
|
"passwordSendButton": "Iniciar sesión",
|
||||||
"disconnectionModalLongTitle": "Desconectado",
|
"disconnectionModalLongTitle": "Desconectado",
|
||||||
"disconnectionModalDescription": "Se ha perdido la conexión con el servidor al que estabas conectado. Esto puede ser debido a que el servidor se ha cerrado. Se ha vuelto a la ventana principal.",
|
"disconnectionModalDescription": "Se ha perdido la conexión con el servidor al que estabas conectado. Esto puede ser debido a que el servidor se ha cerrado. Se ha vuelto a la ventana principal.",
|
||||||
"disconnectionModalCloseButton": "Cerrar",
|
"disconnectionModalCloseButton": "Cerrar",
|
||||||
"players_online": "Jugadores en línea",
|
"players_online": "Jugadores en línea",
|
||||||
"cpu_title": "CPU",
|
"cpu_title": "CPU",
|
||||||
"ram_title": "RAM",
|
"ram_title": "RAM en uso",
|
||||||
"deleteServerButton": "Borrar servidor",
|
"deleteServerButton": "Borrar servidor",
|
||||||
"sendCommandButton": "Enviar"
|
"sendCommandButton": "Enviar"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "ru_RU": //Credit to Stashenko
|
case "ru_RU": //Credit to Stashenko
|
||||||
lang = {
|
lang = {
|
||||||
"home_link": "Главная",
|
"home_link": "Главная",
|
||||||
"home_header": "Выберите сервер из меню",
|
"home_header": "Выберите сервер из меню",
|
||||||
"home_description": "Используйте панель навигации, чтобы добавить новый сервер Minecraft или подключиться к ранее добавленному.",
|
"home_description": "Используйте панель навигации, чтобы добавить новый сервер Minecraft или подключиться к ранее добавленному.",
|
||||||
"server_dropdown": "Ваши серверы",
|
"server_dropdown": "Ваши серверы",
|
||||||
"add_server": "Добавить сервер",
|
"add_server": "Добавить сервер",
|
||||||
"lang_dropdown": "Язык",
|
"lang_dropdown": "Язык",
|
||||||
"addServerModalLongTitle": "Добавить новый сервер",
|
"addServerModalLongTitle": "Добавить новый сервер",
|
||||||
"addServerModalSvName": "Название сервера:",
|
"addServerModalSvName": "Название сервера:",
|
||||||
"addServerModalSvIp": "IP сервера:",
|
"addServerModalSvIp": "IP сервера:",
|
||||||
"addServerModalSvPort": "Порт WebConsole:",
|
"addServerModalSvPort": "Порт WebConsole:",
|
||||||
"addServerModalSvSsl": "Сервер с поддержкой SSL",
|
"addServerModalSvSsl": "Сервер с поддержкой SSL",
|
||||||
"addServerModalClose": "Закрыть",
|
"addServerModalClose": "Закрыть",
|
||||||
"saveAndConnectServerButton": "Сохранить и подключить",
|
"saveAndConnectServerButton": "Сохранить и подключить",
|
||||||
"passwordModalLongTitle": "Требуется пароль",
|
"passwordModalLongTitle": "Требуется пароль",
|
||||||
"passwordModalLabel": "Пароль:",
|
"passwordModalLabel": "Пароль:",
|
||||||
"passwordModalRememberLabel": "Запомнить пароль",
|
"passwordModalRememberLabel": "Запомнить пароль",
|
||||||
"passwordModalCloseButton": "Закрыть",
|
"passwordModalCloseButton": "Закрыть",
|
||||||
"passwordSendButton": "Войти",
|
"passwordSendButton": "Войти",
|
||||||
"disconnectionModalLongTitle": "Отключение!",
|
"disconnectionModalLongTitle": "Отключение!",
|
||||||
"disconnectionModalDescription": "Соединение с сервером, к которому вы подключены, потеряно.",
|
"disconnectionModalDescription": "Соединение с сервером, к которому вы подключены, потеряно.",
|
||||||
"players_online": "Игроки",
|
"players_online": "Игроки",
|
||||||
"cpu_title": "CPU",
|
"cpu_title": "CPU",
|
||||||
"ram_title": "RAM",
|
"ram_title": "RAM",
|
||||||
"deleteServerButton": "Удалить сервер",
|
"deleteServerButton": "Удалить сервер",
|
||||||
"sendCommandButton": "Отправить"
|
"sendCommandButton": "Отправить"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.error("No language set");
|
console.error("No language set");
|
||||||
}
|
}
|
||||||
//Set navbar phrases
|
//Set navbar phrases
|
||||||
document.getElementById("navbarHomeLink").textContent = lang.home_link;
|
document.getElementById("navbarHomeLink").textContent = lang.home_link;
|
||||||
document.getElementById("home_header").textContent = lang.home_header;
|
document.getElementById("home_header").textContent = lang.home_header;
|
||||||
document.getElementById("home_description").textContent = lang.home_description;
|
document.getElementById("home_description").textContent = lang.home_description;
|
||||||
document.getElementById("serversDropdown").textContent = lang.server_dropdown;
|
document.getElementById("serversDropdown").textContent = lang.server_dropdown;
|
||||||
document.getElementById("add_server").textContent = lang.add_server;
|
document.getElementById("add_server").textContent = lang.add_server;
|
||||||
document.getElementById("lang_dropdown").textContent = lang.lang_dropdown;
|
document.getElementById("lang_dropdown").textContent = lang.lang_dropdown;
|
||||||
document.getElementById("addServerModalLongTitle").textContent = lang.addServerModalLongTitle;
|
document.getElementById("addServerModalLongTitle").textContent = lang.addServerModalLongTitle;
|
||||||
document.getElementById("addServerModalSvName").textContent = lang.addServerModalSvName;
|
document.getElementById("addServerModalSvName").textContent = lang.addServerModalSvName;
|
||||||
document.getElementById("addServerModalSvIp").textContent = lang.addServerModalSvIp;
|
document.getElementById("addServerModalSvIp").textContent = lang.addServerModalSvIp;
|
||||||
document.getElementById("addServerModalSvPort").textContent = lang.addServerModalSvPort;
|
document.getElementById("addServerModalSvPort").textContent = lang.addServerModalSvPort;
|
||||||
document.getElementById("addServerModalSvSsl").textContent = lang.addServerModalSvSsl;
|
document.getElementById("addServerModalSvSsl").textContent = lang.addServerModalSvSsl;
|
||||||
document.getElementById("addServerModalClose").textContent = lang.addServerModalClose;
|
document.getElementById("addServerModalClose").textContent = lang.addServerModalClose;
|
||||||
document.getElementById("saveAndConnectServerButton").textContent = lang.saveAndConnectServerButton;
|
document.getElementById("saveAndConnectServerButton").textContent = lang.saveAndConnectServerButton;
|
||||||
document.getElementById("passwordModalLongTitle").textContent = lang.passwordModalLongTitle;
|
document.getElementById("passwordModalLongTitle").textContent = lang.passwordModalLongTitle;
|
||||||
document.getElementById("passwordModalLabel").textContent = lang.passwordModalLabel;
|
document.getElementById("passwordModalLabel").textContent = lang.passwordModalLabel;
|
||||||
document.getElementById("passwordModalRememberLabel").textContent = lang.passwordModalRememberLabel;
|
document.getElementById("passwordModalRememberLabel").textContent = lang.passwordModalRememberLabel;
|
||||||
document.getElementById("passwordModalCloseButton").textContent = lang.passwordModalCloseButton;
|
document.getElementById("passwordModalCloseButton").textContent = lang.passwordModalCloseButton;
|
||||||
document.getElementById("passwordSendButton").textContent = lang.passwordSendButton;
|
document.getElementById("passwordSendButton").textContent = lang.passwordSendButton;
|
||||||
document.getElementById("disconnectionModalLongTitle").textContent = lang.disconnectionModalLongTitle;
|
document.getElementById("disconnectionModalLongTitle").textContent = lang.disconnectionModalLongTitle;
|
||||||
document.getElementById("disconnectionModalDescription").textContent = lang.disconnectionModalDescription;
|
document.getElementById("disconnectionModalDescription").textContent = lang.disconnectionModalDescription;
|
||||||
document.getElementById("disconnectionModalCloseButton").textContent = lang.disconnectionModalCloseButton;
|
document.getElementById("disconnectionModalCloseButton").textContent = lang.disconnectionModalCloseButton;
|
||||||
document.getElementById("players_online").textContent = lang.players_online;
|
document.getElementById("players_online").textContent = lang.players_online;
|
||||||
document.getElementById("cpu_title").textContent = lang.cpu_title;
|
document.getElementById("cpu_title").textContent = lang.cpu_title;
|
||||||
document.getElementById("ram_title").textContent = lang.ram_title;
|
document.getElementById("ram_title").textContent = lang.ram_title;
|
||||||
document.getElementById("deleteServerButton").textContent = lang.deleteServerButton;
|
document.getElementById("deleteServerButton").textContent = lang.deleteServerButton;
|
||||||
document.getElementById("sendCommandButton").textContent = lang.sendCommandButton;
|
document.getElementById("sendCommandButton").textContent = lang.sendCommandButton;
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
name: WebConsole
|
name: WebConsole
|
||||||
main: com.mesacarlos.webconsole.WebConsole
|
main: com.mesacarlos.webconsole.WebConsole
|
||||||
version: 1.1
|
version: 1.2
|
||||||
description: WebSockets-based web console
|
description: WebSockets-based web console
|
||||||
author: Carlos Mesa
|
author: Carlos Mesa
|
||||||
commands:
|
commands:
|
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>WebConsole</groupId>
|
<groupId>WebConsole</groupId>
|
||||||
<artifactId>WebConsole</artifactId>
|
<artifactId>WebConsole</artifactId>
|
||||||
<version>1.1</version>
|
<version>1.2</version>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
@ -11,9 +11,9 @@ public class RamUsageCommand implements WSCommand {
|
|||||||
public void execute(WSServer wsServer, WebSocket conn, String params) {
|
public void execute(WSServer wsServer, WebSocket conn, String params) {
|
||||||
Runtime r = Runtime.getRuntime();
|
Runtime r = Runtime.getRuntime();
|
||||||
|
|
||||||
int free = (int) r.freeMemory() / 1024 / 1024;
|
long free = r.freeMemory() / 1024 / 1024;
|
||||||
int max = (int) r.maxMemory() / 1024 / 1024;
|
long max = r.maxMemory() / 1024 / 1024;
|
||||||
int used = max - free;
|
long used = max - free;
|
||||||
|
|
||||||
wsServer.sendToClient(conn,
|
wsServer.sendToClient(conn,
|
||||||
new RamUsage(free + " free, " + used + " used, " + max + " maximum memory", free, used, max));
|
new RamUsage(free + " free, " + used + " used, " + max + " maximum memory", free, used, max));
|
||||||
|
@ -4,11 +4,11 @@ import com.google.gson.JsonObject;
|
|||||||
|
|
||||||
public class RamUsage implements JSONOutput {
|
public class RamUsage implements JSONOutput {
|
||||||
private String message;
|
private String message;
|
||||||
private int free;
|
private long free;
|
||||||
private int used;
|
private long used;
|
||||||
private int max;
|
private long max;
|
||||||
|
|
||||||
public RamUsage(String message, int free, int used, int max) {
|
public RamUsage(String message, long free, long used, long max) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.free = free;
|
this.free = free;
|
||||||
this.used = used;
|
this.used = used;
|
||||||
@ -29,7 +29,7 @@ public class RamUsage implements JSONOutput {
|
|||||||
* Free amount of RAM, in MB
|
* Free amount of RAM, in MB
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int getFree() {
|
public long getFree() {
|
||||||
return free;
|
return free;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public class RamUsage implements JSONOutput {
|
|||||||
* Used amount of RAM, in MB
|
* Used amount of RAM, in MB
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int getUsed() {
|
public long getUsed() {
|
||||||
return used;
|
return used;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ public class RamUsage implements JSONOutput {
|
|||||||
* Max amount of RAM, in MB
|
* Max amount of RAM, in MB
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int getMax() {
|
public long getMax() {
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user