1. Welcome to LilyPad. Download the project, explore the forums, and create your own LilyPad network.


    If you use the software and enjoy it or have a question, or would like to contribute to the future of the software directly or through resources, please sign up and join our little community.

Plugin that shows which version you are using

Discussion in 'Development' started by Matt, Dec 15, 2013.

  1. Matt

    Matt Forum Moderator & Contributor Staff Member Moderator Contributor

    Hello all,

    I made a small plugin that shows which version of LilyPad and Java you are using with the following result:[​IMG]
    What I want to add is the GoLilyPad connect and Proxy. How can I do this and is it possible?
    This is my code now:
    Code (text):
    public class Main extends JavaPlugin {
       
        Connect connect;
       
        public static final String ConnectTitle = Connect.class.getPackage().getImplementationTitle();
        public static final String ConnectBuild = Connect.class.getPackage().getImplementationVersion();
        public static final String ProxyTitle = Proxy.class.getPackage().getImplementationTitle();
        public static final String ProxyBuild = Proxy.class.getPackage().getImplementationVersion();
       
        public boolean onCommand (CommandSender sender, Command cmd, String label, String[] args) {
            Player player = (Player) sender;
            if (player.hasPermission("lilypad.version")) {
                if (cmd.getName().equalsIgnoreCase("lily")) {
                    player.sendMessage(ChatColor.GOLD + ConnectTitle + ChatColor.GREEN + " is running on version: " + ChatColor.GOLD + ConnectBuild);
                    player.sendMessage(ChatColor.GOLD + ProxyTitle + ChatColor.GREEN + " is running on version: " + ChatColor.GOLD + ProxyBuild);
                }
            } else {
                player.sendMessage(ChatColor.RED + "You don't have permissions!");
            }
            return false;
        }

    }
     
    Can someone help me with this? Thank you :)
  2. Coelho

    Coelho Software Engineer Staff Member Administrator Maintainer

    This is not currently possible but I should make it possible in a later API change.
  3. Coelho

    Coelho Software Engineer Staff Member Administrator Maintainer

    That is because your chat variable is now not reachable. If you're using an IDE it shows a description of the error.
  4. Matt

    Matt Forum Moderator & Contributor Staff Member Moderator Contributor

    Okay :D

Share This Page