Hey! Is there a possibilty to make a plugin that says "The server is now using 34% of it's RAM" ingame as a broadcast? /Fred
You could use something like Skript or VariableTriggers in conjunction with LagMeter, which is my preferred method.
I think you can get it by: Code: Runntime run = Runntime.getRuntime(); .... long totalmemory = runtime.totalMemory(); long freememory = runtime.freeMemory();
Here is example code that you add right underneath a command if statement: Code: Runntime run = Runntime.getRuntime(); Player player = (Player)sender; long totalmemory = runtime.totalMemory(); long freememory = runtime.freeMemory(); long usedmemory = totalmemory =- freememory; player.sendMessage(ChatColor.GOLD + "Memory " + usedmemory + "/ " + totalmemory); return true; That should work, I haven't tested it yet though xD.
I'm not looking for the ram usage as an individual player, I want it to broadcast it. I already know that there are functions that does that. xMakerx, are you able to make me a plugin that does that, I don't know how to compile and etc.
You can get it from here: https://www.dropbox.com/s/2woi4rh85g16ymc/RamUsage.jar https://github.com/kg9dh/BroadCastRam/blob/master/BroadCastRam/src/ch/kg9dh/main/RamUsage.java use /ram and it gets broadcasted permission: op by default or "ram.use"
Do you use any webconsole? Because some of them can run commands, e.g. like McMyAdmin. Otherwise there are plugins like consolescheduler which can do that for you: http://dev.bukkit.org/server-mods/consolescheduler2/
Thanks for the offer, but I just want the simple text + perhaps you could add this infront of it? so it's "[Baconia] The server is using 34% of it's RAM." and have the "[Baconia]" as dark red and the rest of the text green (&a). It's the name of the server
done, works fine, changed it so it looks like: https://www.dropbox.com/s/2woi4rh85g16ymc/RamUsage.jar
Hey, are you able to make me a TPS plugin aswell, that simply says "[Baconia] TPS: 20" or whatever TPS I got?
Ticks per second. I think this code will get it Code: final int ticks = 100; // should be 5 seconds final long time = System.currentTimeMillis(); Bukkit.getScheduler().runTaskLater(plugin, new Runnable() { @Override public void run() { int tpsResult = (int)(ticks / ((System.currentTimeMillis() - time) / 1000)); // do something } }, ticks);
Yes on both, could you compile it for me? I want it to broadcast the same way as the other RAM usage plugin did. Nope, ticks per second! EDIT by Moderator: merged posts, please use the edit button instead of double posting.
i can do it https://www.dropbox.com/s/llf8fpiu1vucktm/BroadCastRam.jar EDIT by Moderator: merged posts, please use the edit button instead of double posting.
I like this idea. Is it possible to also upload a version that doesn't say [Baconia]? Just says how much RAM is being used and nothing more? Much appreciated!
sure /tps prints out [Baconia] The servers TPS is 20 (or whatever it is) and /ram same as before First version with config: https://www.dropbox.com/s/2woi4rh85g16ymc/RamUsage.jar Code: #RamUsage / BroadCastRam by kg9dh #If it's sent to the player(sender). If this is set to true it will override 'server-output' player-output: false #If it's sent to everyone (Broadcast) server-output: true #If it should output 'Total RAM', 'Used RAM', 'Free RAM' usage-output: false #If it should output the graphics graphics-output: false #If it should output how many percent of RAM are used. percent-output: true #The broadcasts name (label) label: Server EDIT by Moderator: merged posts, please use the edit button instead of double posting.