1 / 32

Checklist

Checklist. Do you have Java JDK installed? Do you have the latest bukkit jar file installed? Do you have Minecraft installed? Do you have the github files installed? Do you have the bukkit server files?. Creating Bukkit Plugins. What you should learn. How to build a Bukkit plugin

effie
Download Presentation

Checklist

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Checklist • Do you have Java JDK installed? • Do you have the latest bukkit jar file installed? • Do you have Minecraft installed? • Do you have the github files installed? • Do you have the bukkit server files?

  2. Creating Bukkit Plugins

  3. What you should learn • How to build a Bukkit plugin • How to find information about the API an Java • How to make cheats and react to the game

  4. What is a plugin? • A plugin for Bukkit is a jar file • A jar file is a zip file. Inside the structure of the file corresponds to what Bukkit expects • It needs compiled Java code and a plugin.yml file

  5. Compile the Java code javac -Xlint -classpath ../../craftbukkit.jar Hello.java

  6. Create the jar file • Create the bin folder • Inside the bin folder, create Hello folder • Move Hello.class into this folder • Copy plugin .yml into bin jar -cvf Hello.jar -C bin .

  7. Install the plugin • Copy Hello.jar and put it in plugins folder

  8. Test the plugin • Start bukkit • Start Minecraft • Type /hello bob

  9. Writing Cheats • Now we are going to learn how to write cheats • Cheats are Commands • A command is an order that you can type into Minecraft via / command arguments

  10. How to write a command • For a command to work you need • The description of the command in the plugin.yml • The code in your java file

  11. Plugin.yml • This is a configuration file • It tells Bukkit • the name of our module, • its main class – the start up class • what commands exist within your plugin

  12. Spells.java • The onCommand event • Check for our command • Then call the method that executes the command

  13. Build the Spells plugin Look at the code and try the different spells How would you make your own?

  14. How do we change Minecraft? • Through the Bukkit API Application Programming Interface

  15. What is the API • The API is like a dictionary to tell the computer what to do • Each package is like a chapter in the dictionary

  16. How is it organized? The API is organized as a map of idea What categories do we have? • World • Player • Blocks • Events

  17. How to explore the API • Think of what you would like to do • I want to change the whether! • Think of what category does it fall into • Is it a player? • A block? • A World event?

  18. Browse through the documentation • Look at the packages. Click them • Look at what classes are within the package • Click on something like looks correct

  19. Reading the class documentation • Find out to what package it belongs so you can import it correctly • In the method list, look for what you want to do • Use the search function to find possible methods • Remember that Java uses get() and set() as a convention for changing values

  20. Making sense of the API • Good libraries are consistent • If you found something related to Pigs under entities, then other beings, like chickens, should be under entities • The more you use the documentation, the better you will get at finding what you need

  21. If you can’t find it, Google Search following this convention bukkit api <what you want to find out> bukkit api player’s hunger • Seek out bukkit.org result and minecraft forums results • Watch out for outdated information. Keep an eye for bukkit versions and the dates

  22. Events • Build the Hydra plugin • Install it • Summon zombies through the “rise” command • Fight it until you defeat it

  23. What is an event? • Events are things that happen in the game • Hitting a block • Eating • Waking up

  24. Event handler • If-then code • If the event happens, then do this

  25. How to write an event • We need an event listener • We need to use the annotation • We need to write the event function • You need to find the right event in the documentation

  26. Writing Hydra • Idea: when you kill a zombie, two will spawn! • Events: when a Zombie dies • Look in the API

  27. Even the sun will create more! • I need them to respawn only when I kill them • Find the damage event • Set a variable • Modify our original event handler

  28. The tools • Making changes by hand is boring. So I built some scripts to automate the boring parts away

  29. New.sh • Use it as ./new.sh <name> • It will create a template for a new plugin • You need to change every word that says CHANGEME

  30. Build.sh • It will compile, move the files, create a jar, and move the jar to the plugin folder

  31. What else is there to learn? • Build tools • IDE for development • More Java • Bukkit services • Saving data

  32. Questions?

More Related