I excluded an important part of plugin creation, at some point you'll have to create a file called "plugin.yml" located in your source folder prior to compiling. The contents of this file should consist of: Code: name: < Your plugin's name > main: < the full name of the class that extends JavaPlugin > version: < plugin version > The sample plugin would consist of: Code: name: SamplePlugin main: com.dinnerbone.bukkit.sample.SamplePlugin version: 0.1
Bah you beat me to it. This is my step by step guide (in text form) Server Installation Download Bukkit and CraftBukkit to a directory. This is the API and the Server software built by hudson. Later, you would presumably use the Stable official builds. Create a .bat file with: java -Xms512M -Xmx1024M -jar craftbukkit-0.0.1-SNAPSHOT.jar in the same directory. Double click to start the server (this creates the sub directories) type in stop to stop it Sample Plugin Building On to compiling the sample plugin: File -> New -> Java Project Enter SamplePlugin into Project Name Click Finish Right click on SamplePlugin (left windown) -> properties Select java build path in the left window and add external jars in the right Add the bukkit.jar file that you downloaed Right click on SamplePlugin (left windown) -> New -> Package Enter com.<yourname>.bukkit.sample Right click on SamplePlugin -> src -> com.<yourname>.bukkit.sample Select new -> class Enter SamplePlugin as the class name and press finish Repeat for SamplePlayerListener and SampleBlockListener Get the source from here Copy and paste the source files into your eclipse project Note: Don't copy the package name, eclipse sets that up for you Right click SamplePlugin->src and choose new -> file Filename is plugin.yml Copy and paste the yml file from here Replace Dinnerbone with your name Delete the version number (Don't do this with latest builds) Save everything Right click on SamplePlugin -> Export Select Java -> Jar file Click next Click browse to place the .jar file in the plugin directory of craftBukkit Make sure java sources and resources is selected (it it off by default) Click finish use start.bat to start the server What is does is: - information when a player joins or leaves (but you can't actually see it, since it says that you joined before you joined ). - /pos command - /pos x y z to teleport - /debug will cause it to send you movement info - allows cactus to be built anywhere - prevents sand and gravel from falling if they are below an iron block (Ofc, it needs a /item command to test that on a fresh server ).
Good, but one part is incorrect, you are supposed to build your plugin with Bukkit on the build path, not CraftBukkit.
Updated. The main reason I did it that way was to only have 1 .jar to download. However, using the bukkit file is better as it ensures that you aren't using any craftBukkit specific stuff.
Some great start-up instructions Oslarathos (and Raphfrk)! I have some questions about the process: When following Oslarathos video step-by-step (install eclipse, egit plugin, m2maven plugin, get the bukkit/craftbukkit git repo's), at the 7:20 mark - (right click craftbukkit -> Run As -> 9 Maven package), you just assume that since your works - it works for everyone, but it doesn't. There is some dependency issue with the bukkit jar that the build fails and I couldn't get it to work.. Perhaps explain how to get by that part? The way I resolved this is to completely scrap the Eclipse headache, and install netbeans + maven separately, and it worked without no issues at all - everything built without any issues. --- merged: Jan 5, 2011 1:50 PM --- Also, using the batch file to start up the craftbukkit server, it works fine. When adding the bukkit plugin to the mix, it seems to error out on me (possible missing plugin.yml from the bukkit project perhaps? i swore it existed)... here's the error: Code: Jan 5, 2011 8:46:44 AM org.bukkit.plugin.SimplePluginManager loadPlugins SEVERE: Could not load plugins\bukkit.jar in plugins org.bukkit.plugin.InvalidPluginException at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:56) at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:112) at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:80) at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:34) at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:31) at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:98) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:162) at net.minecraft.server.ThreadServerApplication.run(SourceFile:490) Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml ... 8 more
you are talking about java is it possible with c# (using pluginloader) and can somebody tell me how to use pluginloader
Great tutorial -- helped me a lot with porting my plugins! Just one thing: I noticed that CraftBukkit has the chunk events, but Bukkit itself doesn't (at least not the version I had). These are hooks that ARE going to be implemented in Bukkit, right?
I put both of those files into a directory, and when i ran the .bat file it just gave an error telling me "java" isn't recognized as a command and closes instantly. is there something im doing wrong? EDIT: I managed to get it working, apparantly instead of just putting "java" at the beginning i needed to put the location of java.exe in programs.
Code: The method isDebugging(Player) is undefined for the type SamplePlugin This error shows up after pasting example code. But if i type "plugin.", it shows me isDebugging(Player) on suggestions list.
Actually, if you add the location (not the file name but the folder name) to your PATH environment variable, all you need to do is type 'java *parameters*'. If you need help with that, I can tell you how to do that. I would actually suggest doing this for later stuffs (like if you need to make javadocs, you can type 'javadocs *parameters*'; you can easily make use of other programs in that folder, too).
That's funny, worked for me perfectly fine. Make sure that the path to your java.exe file is in the PATH environment variable. Also make sure that the name of the jar file in your statement is the same name as the CraftBukkit jar file you downloaded (the name may have changed).
"PATH environment variable"? I'm sorry, I don't know what you're talking about. I followed the tutorial exactly, and my folder looks like this:
Unfortunately, that doesn't help. Please refer to the text and picture above and tell me what I am doing wrong. As I said above, I have only done as the tutorial instructed. It's like I've taken a brand new computer and followed the tutorial without installing any programs (besides Java and Minecraft).
Alright, here's a test you can run before going into the details about environment variables: Click start, then into the run/search bar (depends on your version of Windows), type 'cmd' (minus the quotes). Use the 'cd' command to navigate to your bin folder. E.g. type 'cd C:\Bukkit\bin\'. Then execute the batch file (type 'serverstarter.bat'). What does it print out?
Ah. You're going to have to modify the PATH environment variable, then, as the system can't find the java.exe file. Here's what to do: Open the Control Panel, select System, then Advanced System Properties. Click Environment Variables (at the bottom of the window). In the bottom table (labelled System Variables), select the 'PATH' variable and click the 'Edit...' button. It may also be called 'Path' (or possibly 'path', but I haven't seen that variation on capitalization). Find the path to your java.exe file and copy it (I will refer to it as *path* in the next step) Put a semicolon (';') at the end of the text in the edit field, then paste your path into it (should have added, collectively, ';*path*'). Click 'Okay' until you're back to the Control Panel. Close that out, and repeat the test. Does it start the server, or does it repeat the error? If it repeats the error, tell me exactly what you added to the PATH variable.
Do you remember where you installed Java to in the first place? I found mine here: C:\Program Files\Java\jre6\bin Check your Java program folder for the latest version of the JRE (or, if you prefer, the JDK if you have that installed), then go to its bin folder. Use that path. If you can't find it in 'Program Files\Java', check 'Program Files (x86)\Java'.
Glad to hear it works. Next time, though, could you leave a reply? Goodness I've been waiting for the past 30 minutes for a reply to see if I needed to help further xD
Same problem ( dependencies) could you explain how you set this up in netbeans? Maybe a small step by step? =3
I'm getting this same issue and I cant seem to resolve it no matter how hard I try, even after reading the docs multiiple times again and validating manually multiple times using winrare that the file does in fact exist. Running on windows, but should that really matter? java.io.FileNotFoundException: Jar does not contain plugin.yml EDIT: Compiler was placing the file int the wrong path inside the .jar file.. it was placing it in with the .class files and not on the top of the directory structure.. look for this using winrar if you get that error, hen move the location of the file in your project file to compensate.
Missing an important step. You have to mvn clean install bukkit before you mvn clean package craftbukkit.. So for eclipse you would right click bukkit, runas> 8 Maven Install then rightclick craftbukkit, runas>9 Maven package. For linux (Debian systems, replace apt with yum etc) and without using eclipse Code: sudo apt-get install git sudo apt-get install maven2 cd mkdir bukkit mkdir craftbukkit cd bukkit (run as root in non-sudo environments) sudo git init sudo git pull git://github.com/Bukkit/Bukkit sudo mvn clean install cd .. cd craftbukkit sudo git init sudo git pull git://github.com/Bukkit/CraftBukkit sudo mvn clean package Both compiles will be in target directory.
In the File EntityCombustEvent.java I get Errors. Code: Description Resource Path Location Type The method isCancelled() of type EntityCombustEvent must override a superclass method EntityCombustEvent.java /bukkit/src/main/java/org/bukkit/event/entity line 19 Java Problem and the same Error for setCancelled(). When I compile Plugin it just gives me just Warnings. When I start server with the sample-Plugin I get this: Code: 11.01.2011 10:37:57 org.bukkit.plugin.SimplePluginManager loadPlugins SCHWERWIEGEND: Could not load plugins\SamplePlugin.jar in plugins: null org.bukkit.plugin.InvalidPluginException at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j ava:77) at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager. java:115) at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager .java:80) at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:37) at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:140) at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:127) at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:103) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:164) at net.minecraft.server.ThreadServerApplication.run(SourceFile:490) Caused by: java.lang.ClassNotFoundException: com.hans.bukkit.sample.SamplePlugin at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.net.FactoryURLClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j ava:71) ... 8 more 2011-01-11 10:37:57 [INFO] Done! For help, type "help" or "?" Can someone help me? I am not that up to date with all the java-stuff, but i really want to get into it.
You did't override method. That mean you need to write/implement in your class(SamplePlugin) method isCancelled() or it won't work.
I'm having the same issue as TheArcher, I've done as AnonymousJohn described with no change. Only differences from what I can tell are; I'm using a 64-bit OS so my java dir is in 'Program Files (x86)' and I have the Bukkit files on another HDD(which shouldn't make any difference). I don't really know a lot about this kind of stuff but from what I can tell this shouldn't be doing this at all. I've used .bat files to run .jar files on several occasions without issue, why would this be any different? Any help would be appreciated, but it's not urgent or anything. I'm just curious to have a play around.