Watch HD, Full Screen and Enjoy: Subscribe!More Info:This is just a Small Plugin Tutorial on how to create the basics of the basics of a Plugin. Just a Broadcaster but I hope this helps some of you Noobs And if i helped Feel Free To Donate!
im a complete noob and attempting to learn this stuff. i am very grateful of this video but it would be even nicer if it had voice instructions too.
I will add a Voice Tut soon; Since I didnt have a Mic for the computer I was using, I could only do this. But now I have a Mic so I can get to it =D
Hey, I am new to plugin making, and I have a problem with my very simple program in which you type /orano10000 and it returns a string. The only thing is, when I export my file, it exports fine (yes i have config.yml selected) and when I run my server, the file is there, but shows no signs of being executed. Also there is no folder with config.yml in it that is generated. Help would be appreciated. Here is my project. Main Class: Code: import java.util.logging.Logger; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; public class TestPlugin extends JavaPlugin { private final TestPluginPlayerListener playerListener = new TestPluginPlayerListener(this); Logger log =Logger.getLogger("Minecraft"); public void onEnable(){ log.info("[TESTPLUGIN] TestPlugin is enabled"); PluginManager pm = this.getServer().getPluginManager(); } public void onDisable(){ log.info("TestPlugin is now disabled"); } } Listener Class: Code: import java.util.logging.Logger; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.event.player.PlayerListener; import org.bukkit.event.player.PlayerMoveEvent; public class TestPluginPlayerListener extends PlayerListener { public TestPlugin plugin; Logger log =Logger.getLogger("Minecraft"); public TestPluginPlayerListener(TestPlugin instance) { plugin = instance; } public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ if(cmd.getName().equalsIgnoreCase("orano10000")){ // If the player typed /basic then do the following... sender.sendMessage(ChatColor.GREEN + "Did someone say my name!"); return true; } //If this has happened the function will break and return true. if this hasn't happened the a value of false will be returned. return false; } } config.yml: Code: name: TestPlugin main: Bukkit_plugin.TestPlugin version: 1.0 commands: orano10000: description: This is a jokey command. usage: /orano1000
Here: } //If this has happened the function will break and return true. if this hasn't happened the a value of false will be returned. return false; <-- Change to true;
Here ill show you a new way to code it. You dont have to use Two Classes. Create your Main Class Code: public class PMain extends JavaPlugin{ @Override public void onDisable() { // TODO Auto-generated method stub } @Override public void onEnable() { // TODO Auto-generated method stub } @Override public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) { if(cmdLabel.equalsIgnoreCase("emericask8ur")){ sender.sendMessage(ChatColor.RED + "Yeah im emericask8ur!"); return true; } return true; } } Create YML Code: name: Simple version: 0.1 main: com.emericask8ur.Simple.PMain commands: emericask8ur: description: Uses usage: /emericask8ur
i'll post my new code: main class: Code: import java.util.logging.Logger; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; public class TestPlugin extends JavaPlugin{ @Override public void onDisable() { // TODO Auto-generated method stub } @Override public void onEnable() { // TODO Auto-generated method stub } @Override public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) { if(cmdLabel.equalsIgnoreCase("orano10000")){ sender.sendMessage(ChatColor.RED + "Did someone say my name!"); return true; } return true; } } and config.yml: Code: name: TestPlugin main: Bukkit_plugin.TestPlugin version: 1.0 commands: orano10000: description: This is a jokey command. usage: /orano10000
It wont make a Folder unless you make it do that. Creating a Folder happens when you create a config. And it does run. Make sure your doing these things: DO NOT Renaming the .jar File to something else than your Project name It must contain your package name
so the .jar file is called TestPlugin.jar, is that right? And I did create a config didn't I? Config.yml sorry for being so nooby but i'm confused!
oh yeah and the command doesn't work, so if I try /orano10000 or orano10000 in console, it just returns"unknown command"