Inactive [MISC/ADMN/GEN/] LagTest v1.0 - Know how laggy your server is! [1.3.2-R0.1]

Discussion in 'Inactive/Unsupported Plugins' started by PvM_Iain, May 13, 2012.

  1. Offline

    PvM_Iain

    Do you run a server? Do you want to know much lag your server has? Then this plugin is for you! With one single command you can know if its lagging, by showing you a message, if this message is slow, then you know its lagging!


    My first simple plugin. I know it is a very very basic plugin but I am just starting. Hope you enjoy.

    Version: v2.0.

    Features:
    • Single command to telling you how much lag you have.
    • Easy to use.
    • Easy to understand.
    Commands:
    • /lagtest - Shows the current server ping.
    Changelog:

    Version 2.0
    • Added a simple timer that returns in ms. Thanks -_Husky_-
    • Complete code rewrite.
    • Updated to 1.3.2R0.1.
    Version 1.0
    • Implemented a more useful message.
    • Plugin Release.
    v2.0
     
    MrGKanev likes this.
  2. Offline

    tom

    Can't you just type something in chat, and if it appears slow the server is lagging?
     
  3. Offline

    PvM_Iain

    Yes you could also do that, hehe.
     
  4. Offline

    Scoin0

    I thought /ping?
     
    lemon42 likes this.
  5. Offline

    C0nsole

    I could make this in my sleep :p
     
    lemon42 likes this.
  6. Offline

    Adrenaline

    Link dont work =d / change hosting.. :S
     
  7. Offline

    PvM_Iain

    Oops I'll change it now

    Updated download link.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  8. Offline

    Deleted user

    Use /ping....
     
    lemon42 likes this.
  9. Offline

    zombieman1000

    its a great plugin thanks for making it :D
     
  10. Offline

    lemon42

    This has already been stated, but Essentials comes with a very handy command for that.
    Try to run /ping :)
     
  11. Offline

    PvM_Iain

    Thanks and your welcome!
     
  12. Offline

    -_Husky_-

    add a simple timer, that returns in MS.

    Code:java
    1.  
    2. //when command is performed
    3. long l1 =System.currentTimeMillis();
    4. //then return the ms from the new time
    5. long l2 =System.currentTimeMillis();
    6. long ping = l1-l2;
    7. // send player result
    8. p.sendMessage(ChatColor.whatever + "Ping: " + ping);
    9.  


    Soooo...

    Code:Java
    1.  
    2. package code.husky;
    3.  
    4. import org.bukkit.ChatColor;
    5. import org.bukkit.command.Command;
    6. import org.bukkit.command.CommandSender;
    7. import org.bukkit.entity.Player;
    8. import org.bukkit.plugin.java.JavaPlugin;
    9.  
    10. public class GetPing extends JavaPlugin{
    11.  
    12. public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
    13. Player p = (Player) sender;
    14. if(commandLabel.equalsIgnoreCase("cms")) {
    15. long l1 =System.currentTimeMillis();
    16. p.sendMessage("");
    17. long l2 =System.currentTimeMillis();
    18. long ping = l1-l2;
    19. p.sendMessage(ChatColor.GREEN + "Ping: " + ping + "ms");
    20. return true;
    21. }
    22. return false;
    23. }
    24.  
    25. }
    26.  


    Is basically what you need :D

    //EDIT - think i stuffed it.. >.> let me check
     
  13. Offline

    PvM_Iain

    Thanks!
     
  14. Offline

    -_Husky_-

    if you need any more help. PM me. (or quote me or tag me etc)
     
  15. Offline

    PvM_Iain

    Where would I add this code? Would I make a new class?
     
  16. Offline

    -_Husky_-

    that would be your command class.

    Soooo.. your class would look like this

    Code:java
    1. package me.Iain.test;
    2.  
    3. import org.bukkit.ChatColor;
    4. import org.bukkit.command.Command;
    5. import org.bukkit.command.CommandSender;
    6. import org.bukkit.entity.Player;
    7. import org.bukkit.plugin.java.JavaPlugin;
    8.  
    9. public class Test extends JavaPlugin
    10. {
    11.  
    12. // dont need onenable + ondisable anymore
    13.  
    14. public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
    15. Player p = (Player) sender;
    16. if(commandLabel.equalsIgnoreCase("lagtest")) {
    17. long l1 =System.currentTimeMillis();
    18. p.sendMessage("");
    19. long l2 =System.currentTimeMillis();
    20. long ping = l1-l2;
    21. p.sendMessage(ChatColor.GREEN + "Ping: " + ping + "ms");
    22. return true;
    23. }
    24. return false;
    25. }
    26. }
    27.  


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  17. Offline

    MrGKanev

    Pleese update for the soon 1.2(sorry for the mistake shitty keyboard)
     
  18. Offline

    dark_hunter

    1.3 is not even out yet, so how can one update to something that doesn't exist yet?
     
    Snipes01 likes this.
  19. Offline

    Snipes01

    Haha...what is happening on these forums. I've seen so many silly post today I don't even want to reply to most of them. 1.3 isn't even out... :eek:
     
  20. Offline

    PvM_Iain

    This will be updated for 1.3 for all that want it to be!
     
  21. Offline

    PvM_Iain

    Updated to 1.3!

    Changes:
    • Added a simple timer that returns in MS, thanks -_Husky_-
    • Complete code rewrite.
    • Updated to 1.3.2 R0.1.
     
  22. Offline

    PvM_Iain

    Will be releasing this on BukkitDev soon.
     
  23. Offline

    Butkicker12

    PvM_Iain likes this.
  24. Offline

    MLG_KICK

    Server running at 1tps. I think it may be lagging a little.
     
  25. Offline

    PvM_Iain

    Not sure if sarcasm....
     

Share This Page