So i wanted to make a plugin with /help 1/2/3/4/5 For my network and I find all the ones I have seen has only been in 1 Main class and i tried some different things from them non of them worked so i decided to come here and put a thread about it so my main class looks like this please not to forget about the Plugin Hider bit. and i want to add more commands with /Help 2 but i have tryed so many things like add _ for the space what did not work so please help
lol a quick Google search brought me to this: https://bukkit.org/threads/tutorial-command-arguments.186497/ Please learn the basics before you start developing a plugin... and based on this, I assume you also don't know basic Java, so please read up on that as well. You can't just into development before you know the basics man.
Actually, it does. You clearly didn't read anything before you started coding your plugin, so it's safe to assume you didn't read anything before starting Java either.
That is why i have like 3 books of Java sitting right next to me and i use to code Java around 4/5 years ago because i use to make guis and shit but past that time i have forgotten and in that time i started to code Websites and do a lot of Youtube but i just started to get back in Java
If you can't remember args, then I recommend picking one of those books up and start reading as you have lost almost all knowledge of Java. I am currently in the early learning stages as well, but you should know how to use args in a command or at least use google before coding a plugin. I'm saying this so you can learn and not just have us tell you everything and feed you code when you could learn how these actually work by reading.
I am learning again that is the problem i have just got to the args page before i posted this and tbh now i feel stupid of this post.
Waldxn As u are here might as well ask I have got /help and /help 2 but i have tried like 4 types of codes what i found it and non of them work when i do /help 3 idk why idk if it is how i layed it out or something because i uses Else if and if
Code please? You need to check how many arguments there are, and then check for a specific argument (in your case, args[0] should be "3").
package mc.SlimieSlime.commands; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class Help implements CommandExecutor { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!(sender instanceof Player)) { sender.sendMessage("You must be a player to use this command!"); return false; } Player player = (Player) sender; if (args.length == 0) { player.sendMessage(ChatColor.AQUA + "Help(1/5)"); player.sendMessage(ChatColor.AQUA + "/Developer to show the Developers"); player.sendMessage(ChatColor.AQUA + "/Ah For auction house"); player.sendMessage(ChatColor.AQUA + "/Shop for the shop"); player.sendMessage(ChatColor.AQUA + "/Plot auto for a plot"); player.sendMessage(ChatColor.AQUA + "/Ranks for the ranks"); } else if (args.length == 1) { player.sendMessage(ChatColor.AQUA + "Help(1/5)"); player.sendMessage(ChatColor.AQUA + "/Developer to show the Developers"); player.sendMessage(ChatColor.AQUA + "/Ah For auction house"); player.sendMessage(ChatColor.AQUA + "/Shop for the shop"); player.sendMessage(ChatColor.AQUA + "/Plot auto for a plot"); player.sendMessage(ChatColor.AQUA + "/Ranks for the ranks"); if (args[0].equalsIgnoreCase("2")) { player.sendMessage(ChatColor.AQUA + "Help(2/5)"); player.sendMessage(ChatColor.AQUA + "/Plot Trust to trust players"); player.sendMessage(ChatColor.AQUA + "/Plot add to add players"); } } return true; } }
Code (Text): @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (cmd.getName().equalsIgnoreCase("help")) { if (args.length == 0) { sender.sendMessage(ChatColor.GREEN + "/help <page>"); } else { if (plugin.getConfig().getString("Help" + "." + args[0]) != null) { List<String> helppage = plugin.getConfig().getStringList("Help" + "." + args[0]); for (String hp: helppage) { sender.sendMessage(hp.replace("&", "§")); } } else { sender.sendMessage(ChatColor.RED + "This help page could not be found."); } } } return true; } Here is how I make a configurable help plugin with unlimited pages. #Spoonfeed