官术网_书友最值得收藏!

Adding Bukkit as a library

Now that we have created our main class, we need to add the Bukkit API as the library for our project. As we can recall from the previous chapter, the API includes the code that we can access to modify the CraftBukkit server. It is available for download at http://dl.bukkit.org/downloads/bukkit/. Again, choose the version that matches your client version and the version of CraftBukkit that you downloaded. Once you have downloaded the file, you will have to move it to a permanent location. I suggest you create a folder named Libraries in which to place it. The filename will most likely have a version appended to it. Similar to what we did for craftbukkit.jar, we will rename this file; this helps us to easily update it in the future. So the new location of your bukkit jar will be C:\Users\Owner\Documents\NetBeansProjects\Libraries\bukkit.jar. Remember your file location, because now that we have downloaded the Bukkit API we can create a library for it in NetBeans.

In NetBeans, inside the Projects tab, you will see a Libraries folder. If you right click on it you are presented with the option Add Library.... Click on it to bring up a list of your current libraries.

For the first time, we need to create the Bukkit library. For any future project it would already be present and we can simply select it. Click on Create... and type Bukkit as the Library Name. In the next window there is an Add JAR/Folder... button. Click on it to add the bukkit jar file that you have just downloaded. We will leave the Sources tab empty and click on the Javadoc tab next. Now, add the URL http://jd.bukkit.org/beta/apidocs/and click on OK. This allows us to read some of the API documentation directly in our IDE. Now we are able to select Bukkit as a library to add it to our project.

Note

Note that in order to update to a newer version of Bukkit you can simply replace the current bukkit.jar file with the new one, just as you would do to update the craftbukkit.jar on your server. No additional modifications need to be done to your existing projects. However, you will have to check the code to see if there are any new errors presented.

主站蜘蛛池模板: 青川县| 葵青区| 富锦市| 类乌齐县| 乐平市| 南召县| 华容县| 伽师县| 东丽区| 焦作市| 盈江县| 嫩江县| 南京市| 孙吴县| 津南区| 察哈| 大邑县| 丰台区| 伊通| 临高县| 舞阳县| 邳州市| 岳普湖县| 平凉市| 嘉禾县| 松滋市| 嘉善县| 北流市| 乐清市| 民乐县| 佳木斯市| 固原市| 鹤岗市| 遂宁市| 三江| 九台市| 永新县| 汶川县| 耿马| 额济纳旗| 壶关县|