Implemented Players, CpuUsage, RamUsage Commands. Updated README

This commit is contained in:
Carlos
2019-08-13 19:38:37 +02:00
parent 59fa012a18
commit 7f170f15b6
18 changed files with 266 additions and 66 deletions

View File

@ -0,0 +1,64 @@
package com.mesacarlos.webconsole.json;
import com.google.gson.JsonObject;
public class RamUsage implements JSONOutput {
private String message;
private int free;
private int used;
private int max;
public RamUsage(String message, int free, int used, int max) {
this.message = message;
this.free = free;
this.used = used;
this.max = max;
}
@Override
public int getStatusCode() {
return 1002;
}
@Override
public String getMessage() {
return message;
}
/**
* Free amount of RAM, in MB
* @return
*/
public int getFree() {
return free;
}
/**
* Used amount of RAM, in MB
* @return
*/
public int getUsed() {
return used;
}
/**
* Max amount of RAM, in MB
* @return
*/
public int getMax() {
return max;
}
@Override
public String toJSON() {
JsonObject object = new JsonObject();
object.addProperty("status", getStatusCode());
object.addProperty("statusDescription", "RAM Usage");
object.addProperty("free", getFree());
object.addProperty("total", getUsed());
object.addProperty("max", getMax());
object.addProperty("message", getMessage());
return object.toString();
}
}