Founded in 2012, SpigotMC.org is home to the community behind the biggest Minecraft server software projects and provides a place for everyone involved with Minecraft servers to connect with each other whether they seeking help and support or sharing and showcasing their work. We provide a web forum, chat room and wiki for providing support as well as project hosting for content creators and hope that you too will become involved in this extensive and growing community of more than 300,000 members.
Create a Maven Project
1. From Eclipse to create the Maven project
2. Use template to create Maven Project
3. Config the Maven Project
Group Id is the name of Java Package Artifact Id is the name of Plugin run in MineCraft Version is the software version Packaging is the output type
Add API doc to Eclipse ID
It is convenient to view the information of API that adding API to Eclipse ID
Choose the Dependency Library in Maven Dependency
Right click to choose Properties, and then choose Javadoc Location. Add https://jd.bukkit.org/
Add onEnable() and onDisable() method
package com.github.yinquan.testplugin;
import org.bukkit.plugin.java.JavaPlugin;
public class PluginMain extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("onEnable has been invoked!");
}
@Override
public void onDisable() {
getLogger().info("onDisable has been invoked!"):
}
}
onEnableCalled when this plugin is enabled
onDisableCalled when this plugin in disabled
getLooger().info(String msg)If the logger is currently enabled for the INFO message level the given message is forwarded to all the registered output Handler objects.
Build the Plugin Project
In Eclipse, click Run As -> Maven install
Finish Build, the Console will print the information
The achieve file ({ProjectName}.jar) will be got.
Deploy the Plugin to MineCraft
Copy the achieve file built by Eclipse to plugins folder in Spigot Server Folder
Run the Spigot Sever
When server start running, the text are printed in console of server
I. How to build up a MineCraft Plugin
yinquanPreparing
1. Java
Setup the JDK environment:
JDK 1.8.0_161
2. Eclipse IDE
Download Eclipse IDE
Eclipse Oxygen.3 (4.7.3)
3. Spigot Server API
Spigot Server API Doc
Spigot-API_1.12.2
Create a Maven Project
1. From Eclipse to create the Maven project
2. Use template to create Maven Project
3. Config the Maven Project
Group Id
is the name of Java PackageArtifact Id
is the name of Plugin run in MineCraftVersion
is the software versionPackaging
is the output type4. Java Configuration in Maven Project
Add the code to
pom.xml
1.8
is JDK version used in this project.And then Update the Maven Project (Alt+F5)
Add the Plugin Code
1. Add Spigot API Dependency Library
spigot-api-1.11.2-R0.1-SNAPSHOT.jar
to src/lib/spigot-api-1.11.2-R0.1-SNAPSHOT-shaded.jar
to src/lib/pom.xml
groupId
artifactId
version
scope
systemPath
2. Create the Java files
src/main/java
to create a packageThen add your package name
plugin.yml
This file is needed when loading the plugin in Bukkit.This file contains the basic information of plugin
src/main/resources
to chooseNew
->File
It is convenient to view the information of API that adding API to Eclipse ID
Dependency Library
inMaven Dependency
Properties
, and then chooseJavadoc Location
. Addhttps://jd.bukkit.org/
onEnable()
andonDisable()
methodonEnable
Called when this plugin is enabledonDisable
Called when this plugin in disabledgetLooger().info(String msg)
If the logger is currently enabled for the INFO message level the given message is forwarded to all the registered output Handler objects.Build the Plugin Project
Run As
->Maven install
Deploy the Plugin to MineCraft
plugins
folder in Spigot Server FolderWhen server start running, the text are printed in console of server
Check the loaded plugin:
GitHub Link:
https://github.com/yinquan529/mincraftplugin
0 forks.
0 stars.
0 open issues.
Recent commits: