I am currently working on a plugin, it has been created many times. but none of them are updated. basicly, it will override the /op command and requires a password for the /op or /deop to work. the password can be set in the config.yml. currently it auto-gens the folder and the config. but i need to find out a way to make it work /op <player> <pass> i dont understand args or configs yet. please help Main: Code:java package Manager; import java.util.logging.Logger; import org.bukkit.command.Command;import org.bukkit.command.CommandSender;import org.bukkit.entity.Player;import org.bukkit.plugin.PluginDescriptionFile;import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin{ public static Main plugin; public final Logger logger = Logger.getLogger("Minecraft"); public void onDisable() { PluginDescriptionFile p = this.getDescription(); this.logger.info(p.getName() + " V" + p.getVersion() + "has been disabled"); } public void onEnable() { PluginDescriptionFile p = this.getDescription(); this.logger.info(p.getName() + " V" + p.getVersion() + "has been enabled"); getConfig().options().copyDefaults(true); saveConfig(); } public boolean onCommand(CommandSender sender, Command dms, String commandLabel, String[] args) { Player player = (Player)sender; if(commandLabel.equalsIgnoreCase("Op")) { if(player.hasPermission("bradkillsu.op")) { if(getConfig().getString("Password") != null){ player.setOp(true); player.sendMessage("Hey You were Opped :D"); } } } return false; }} Config.yml: Code: #Enter Passcode on line below Password: example123 #Thanks for using Brad's Op Password Plugin! Plugin.yml: Code: name: Op-Secret version: 1.0.0 author: BRAD description: Op command main: Manager.Main commands: Op: description: Secret Op usage: /Op permissions: bradkillsu.*: children: bradkillsu.op: true
ShayBox http://wiki.bukkit.org/Configuration_API_Reference https://forums.bukkit.org/threads/tutorial-command-arguments.186497/ http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
I have already looked at all of these links before. im a beginner, idk what or how . i understand i can just type the pass in the Main.java but i want anyone to edit it from config
Unless you use a PlayerCommandPreprocessEvent, I'm pretty sure Bukkit automatically takes priority over commands like /op. What you could do is make a CommandExecutor with your command, and then set the executor with a PlayerCommandPreprocessEvent. Example: Code:java @EventHandlerpublic void commandExecutor(PlayerCommandPreprocessEvent event) {if (event.getMessage().startsWith("/op")) { // So, if a player does /op...Bukkit.getServer().getPluginCommand("op").setExecutor(Your Command Executor);}} If you're new enough to Bukkit not to know what a CommandExecutor is, just create another file, "Test.java" for example, then replace "Your Command Executor" with Code: new Test() Also, remember to put Code: implements CommandExecutor in the CommandExecutor if you're going to use this method. Then, just add the onCommand and everything to that file.
Look at: https://forums.bukkit.org/threads/tutorial-beginner-making-configs.52476/ for more help with config files.
1. READ ME CODE i have all that in there. 2. why cant anyone in the world be a developer and just fix it, i dont know 1 line, i need to import Password: form the config into a arg. just fix it and commend the new fixed code
If you don't understand configuration files yet, you should take a look at Bukkit's configuration reference.
Just a tip: you guys need to read. i dont want to learn it. i just want someone to fix line 31!!!!!!!!!! i dont care to learn java r anything else.
ShayBox If you don't want to learn Java and make the plugin yourself, then perhaps a Plugin Request would suit you better. This is a section for help, not for us to write code for you.
ive seen all the links youv posted, and the tripple posts. none have anything todo with like 31 idk what to type on there, i just combined 2 types of code and put Password: but fine, if you guys are not true coders ill go get someone that will fix it (Pretend Locked) EDIT by Moderator: merged posts, please use the edit button instead of double posting.