Code: Code: if(cmd.getName().equalsIgnoreCase("oppassword")){ if(player.hasPermission("enchanted.oppassword")){ if(args.length != 1){ player.sendMessage("§4§m----------[§9OPPassword§4§m]----------"); player.sendMessage("§a/oppassword reload"); player.sendMessage("§4§m-------------------------------"); }else{ if(args[0].equalsIgnoreCase("reload")){ reloadConfig(); getServer().getPluginManager().disablePlugin(this); getServer().getPluginManager().enablePlugin(this); player.sendMessage("§aPlugin has been reloaded successfully!"); } } } } It doesn't work, when I update the plugin and add it to the server, I have to restart the server instead.
@dagen9 This means that you plugin can't be running, your code will be stopped, your code won't be able to load the new version (as it is stopped) Just reload or restart the server. Or get a plugin that unloads and reloads it for you.
Also, I'm trying to reload a custom config txt file, how can I do this? Code: Code: if(cmd.getName().equalsIgnoreCase("oppassword")){ if(player.hasPermission("enchanted.oppassword")){ if(args.length != 1){ player.sendMessage("§4§m----------[§9OPPassword§4§m]----------"); player.sendMessage("§a/oppassword reload"); player.sendMessage("§4§m-------------------------------"); }else{ if(args[0].equalsIgnoreCase("reload")){ try { FileInputStream fs = new FileInputStream("plugins/OPPassword/messages.txt"); fs.reload(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } reloadConfig(); player.sendMessage(getConfig().getString("reload-message").replace('&', '§')); } } } } Idk how to do this Edit: I fixed it.