• 欢迎来到Minecraft插件百科!
  • 对百科编辑一脸懵逼?帮助:快速入门带您快速熟悉百科编辑!
  • 因近日遭受攻击,百科现已限制编辑,有意编辑请加入插件百科企鹅群:223812289

Bukkit/插件开发教程

来自Minecraft插件百科
Iwar讨论 | 贡献2014年10月26日 (日) 21:39的版本 (添加英文原文 部分内容)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索

Create a Project

Before starting you'll need to set up your workspace and files in Eclipse. Start Eclipse, then create a new Project by selecting File -> New -> Project:

Newproject.png

Now, open up the Maven folder, and select Maven Project. Click next, and then tick the Create a simple project box on the next page, and then click Next: If you can't see Maven folder, then you need to go download the m2eclipse plugin from here

Newproject2.png

Now, you need to name your group as follows:

  • If you have a domain name, the package would be the domain name in reverse.
    • Ex: i-am-a-bukkit-developer.com your package would be com.i_am_a_bukkit_developer source
    • Avoid using a domain you do not own.
  • No domain? Here are some common conventions
    1. Create an account on a source control site such as GitHub or sourceforge
      • For GitHub, follow the instructions here and you will have a sub-domain, so your package would be io.github.<username>
    2. Use your email. Ex: <username>@gmail.com would be com.gmail.<username>
    3. This is the least preferred method. Simply use any unique group naming, again, use this as your last resort.

There are several things that your group must not begin with and those are:

  • org.bukkit
  • net.bukkit
  • com.bukkit
  • net.minecraft

Once you have the base group name, you will want to finish it off with the plugin name. Lets use the GitHub Pages example for this. If you are creating a plugin called TestPlugin your full group name would be io.github.<username>, and your artifact name would be TestPlugin. For the version, simply stick with the default for now. It can be changed later.

Finish the wizard:

Newproject3.png

If this is your first time using Eclipse, close the Welcome tab by clicking the "X" next to the Welcome tab on the tab bar. Now, you should have a window that looks like this:

Eclipsemain.png

Click the arrow to the left of your artifact name, and let's get started!