Tutorials/Development
Developing with my plugin ..As promised, with beta..
Setup
Setup
-Assumptions
I assume that you have basic java/algebra skills and use eclipse. It is helpful if you have made a bukkit plugin before, as a lot of things are the same. If you don't use eclipse, found at https://www.eclipse.org/ there is no help for you.
If you need help with setting up your workspace (or don't know what I'm talking about watsoever), you should look at the getting started tutorial: https://dev.bukkit.org/bukkit-plugins/client-gui-bridge/pages/tutorials/getting-started/ If you don't know what I'm talking about, this tutorial (that you are reading currently) is probably not for you, and you should probably learn java and start with normal bukkit plugins first (though that's not a requirement). If you don't understand any words in the photo above, you need serious help, and this tutorial is definitely not for you.
I am writing this tutorial for windows. Because apple computers are duplicates of PCs (don't argue. just go with it.), you can replace ctrl with the annoying clover leaf apple button thing, and right-click with the control-click or 'secondary click'. If you are using linux, everything will be fine. If you are using something else, such as OS/2, I have no idea what to do (yes, people do use OS/2)
-Required files
You'll need the latest JAR from https://dev.bukkit.org/bukkit-plugins/client-gui-bridge/files/ (all my files). Just download the one with the biggest number. You'll also need eclipse (see above), and a version of craftbukkit.jar that matches my latest plugin. Yes, I know that I probably am not updated to the latest build, but I am dependent also on Minecraft Forge and my life, so give me a break. However, feel free to try my plugin with more recent bukkit releases, because the event system (probably) won't change entirely and catastrophically, so it will most likely work. [END TANGENT] Oh yeah, you'll probably need the latest JDK/JRE, found at http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html and http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html Just download the right one for your system, and install them (yes, they will probably make your anti-virus programs pop up, but you can verify this download any way you want; It's run by oracle, who owns java).
-Build-pathing
In eclipse, make a new project (ctrl+N>select Java Project>fill out the first page>click finish). Then right click the project in Package Explorer, and click Configure Build Path (Build Path>Configure Build Path...). In the menu, go to Libraries (on the top) then click Add External JARs (the Add JARs button won't work; I haven't found out yet what it's for). Navigate to craftbukkit.jar, and select it. Repeat for the latest versions of my plugin. If you want (it makes life a lot easier), you can set the javadoc to http://jd.bukkit.org/rb/ If it doesn't hate you, you can exit the window.
Basic Bukkiting
Basic Bukkiting
"Never re-invent the wheel" -Anonymous
Look at the really nice tutorial at http://wiki.bukkit.org/Plugin_Tutorial I really want to thank them. I know that this tutorial works, because I learned to bukkit with it.
Fun Stuff
Fun Stuff
Basically, my plugin's API has two parts: events and the GUI builder(s). The events are pretty simple to use.
Events
Events are triggered when a player does something inside a GUI (i.e., click a button). Here's a table of events:
| Event Class | Event Trigger |
|---|---|
| ClientGuiButtonClickEvent | When a button is clicked in a custom GUI |
| ClientGuiKeyEvent | When a key is pressed or released in a custom GUI |
| ClientGuiMouseClickEvent | When the mouse clicks (not a button) in a custom GUI |
Just receive them like you would with any normal event. BTW, if you don't want to show a random string every time an event is called, don't set event.showText to true. I would suggest checking that the event comes from your GUI, because there may be multiple plugins that send other GUIs. [To be continued...]
Disclaimer
Disclaimer
I'm sorry, but I really don't want to be sued. You should read the full disclaimer @ http://dev.bukkit.org/bukkit-plugins/client-gui-bridge/pages/disclaimer/ Basically, it just says that you agree to it by reading this page or using my software, and I own rights to my stuff, you can't sue me, and if you make a virus or something, it's not my fault. However, you should definately read it.
Comments