Resource Millisecond Reload Class

Discussion in 'Spigot Plugin Development' started by DocDrewskii, Jul 17, 2018.

  1. Hello, Today I wanted to upload this "Recource" publicly because I have stopped coding Java, and I think the community deserves to be able to use this decently coded Reload class that shows Milliseconds. Without further adue
    Code (Text):
    public class Main extends JavaPlugin implements CommandExecutor {
        private static final Plugin PluginName = null;

        public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args)
        if (cmd.getName().equalsIgnoreCase("CommandName")) { //Creates the command name
            if (sender.hasPermission("PluginName.Reload")) { //Checks if the player has permissions to use command
                if (args.length == 0) { //Checks if the args are equal to only the main command
                    sender.sendMessage(ChatColor.GREEN + "USAGE: /StaffList Reload - Reloads the Config"); //Sends the message to the player for usage
                    return true; //returns the statement
            } else if (args[0].equalsIgnoreCase("Reload")) { //Checks if the their are any args beyond main command, and if so if it is equal to sub command
                long l1 = System.currentTimeMillis(); //Gets the time in milliseconds
                sender.sendMessage(ChatColor.GREEN + "Reloading (Insert Plugin name here)" + Bukkit.getVersion()); // Sends player message that the plugin is reloading
                Bukkit.getScheduler().cancelTasks(PluginName); //Cancels all events by the Plugin
                PluginName.reloadConfig(); //Reloads the config
                PluginName.saveConfig(); //Saves the newly reloaded config
                long l2 = System.currentTimeMillis() - l1; //Checks the milliseconds
                DecimalFormat formatter = new DecimalFormat("###.#"); //Adds a format to the output of the message
                sender.sendMessage((ChatColor.GRAY + "(Insert Plugin Name here)" + Bukkit.getVersion() + ChatColor.GREEN + "RELOAD-COMPLETE").replace("%ms%", formatter.format(l2))); //messages the player when the reload is completed and the amount of milliseconds it took to reload.
        return false;
    Hope you guys enjoy this little resource, I know it is not much and a reload command is easy to make, But I just wanted to upload this, cause I rarely see plugins that have accurate millisecond reload speeds
    #1 DocDrewskii, Jul 17, 2018
    Last edited: Jul 17, 2018
    • Optimistic Optimistic x 2
    • Like Like x 1
    • Funny Funny x 1
  2. FrostedSnowman

    Resource Staff

    • Agree Agree x 2
  3. That’s a plugin, not a resource. Furthermore, you’re comparing two times... it’d take me longer to copy and paste this, fix the logical errors & formatting, than to do it myself.
  4. Yes because this information literally doesn't mean anything, it's completely superfluous
  5. Down with the haters. Thank you ;)

    #I Stand With LilDevs
    • Funny Funny x 1