<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>example.plugin</groupId> <artifactId>ExamplePlugin</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <repositories> <repository> <id>mengcraft</id> <url>http://ci.mengcraft.com:8080/plugin/repository/everything/</url> </repository> </repositories> <name>Example</name> <url>http://nukkit.memo.wiki/</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>cn.nukkit</groupId> <artifactId>nukkit</artifactId> <version>1.0-SNAPSHOT</version> <scope>provided</scope> </dependency> </dependencies> <build> <finalName>${project.artifactId}-${project.version}</finalName> <defaultGoal>clean install</defaultGoal> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.3.1</version> <configuration> <archive> <addMavenDescriptor>false</addMavenDescriptor> </archive> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> </project>9.左のツリーでExamplePlugin右クリック→Maven→プロジェクトの更新→OK をします。
package example.plugin.exampleplugin; import cn.nukkit.Player; import cn.nukkit.event.Listener; import cn.nukkit.event.player.PlayerJoinEvent; import cn.nukkit.plugin.PluginBase; import cn.nukkit.utils.TextFormat; public class Main extends PluginBase implements Listener{ public void onEnable(){ getLogger().info("起動しました。"); this.getServer().getPluginManager().registerEvents(this, this); } public void onJoin(PlayerJoinEvent e){ Player p = e.getPlayer(); String name = p.getName(); p.sendMessage(TextFormat.GREEN + name + "さん、ようこそサーバーへ!"); } }
name: ExamplePlugin main: example.plugin.exampleplugin.Main version: 1.0.0 author: Itsu api: ["1.0.0"]