spigot plugin 설정
2025. 3. 18. 21:26ㆍ마인크래프트
Maven Project 생성
Build Path: JDK17 설정
/src/resources/config.yml
name: Plugin
version: 1.0
main: hys.MobPlugin
api-version: 1.20
description: My first Spigot plugin!
commands:
hello:
description: Say hello!
usage: /hello
pom.xml
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mincraft</groupId>
<artifactId>plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>plugin</name>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Sample
package hys
public class MobPlugin extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("MyFirstPlugin is enabled!");
}
@Override
public void onDisable() {
getLogger().info("MyFirstPlugin is disabled!");
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (label.equalsIgnoreCase("hello")) {
sender.sendMessage("Hello, world!");
return true;
}
return false;
}
}
확인: 명령창
/hello
# 결과
Hello, world!
'마인크래프트' 카테고리의 다른 글
블록을 깨면 나를 공격하지 않는 좀비가 나오게 코딩 (0) | 2025.03.19 |
---|---|
블록을 깨면 그 위치에 좀비가 나오게 코딩 (0) | 2025.03.19 |
Minecraft 이전 (1) | 2025.02.22 |
Minecraft 난이도 확인 (0) | 2025.02.17 |
Minecraft 1.21.4 업그레이드 (0) | 2025.02.17 |