한경대

Paper 1.21.11용 플러그인을 만들어줘.

/자랑 명령어를 추가한다.

플레이어가 손에 들고 있는 아이템을 확인한다. 아이템이 없으면 "손에 아이템을 들고 사용해주세요."라고 한다.

아이템이 있으면 DiscordSRV 1.30.5를 이용해서 Discord의 global 채널에 Embed로 전송한다.

Embed에는 다음 정보를 표시한다:

  • 플레이어 이름
  • 아이템 이름
  • 수량
  • 아이템 타입
  • Lore
  • 인챈트

Embed 제목은 "🎉 아이템 자랑!" 색상은 주황색으로 한다.

DiscordSRV가 없으면 오류 메시지를 표시한다.

Kodari AI
KodariSep 9 at 10:45 am 2
ItemShowcase
ItemShowcase is a Paper 1.21.11 Minecraft plugin that adds a /자랑 command for players to show off their held items. When a player executes the command, the plugin verifies the player is holding an item and displays an error if their hand is empty. If an item is present, the plugin integrates with DiscordSRV 1.30.5 to send a rich embed message to the Discord global channel. The embed includes the player's name, item name, quantity, item type, lore, and enchantments, with the title "🎉 아이템 자랑!" and an orange color. If DiscordSRV is not installed, the plugin displays an error message to the player.

구현 계획:

  1. Paper 1.21.11용 Gradle 프로젝트와 플러그인 메타데이터를 생성한다.

  2. /자랑 명령어에서 손 아이템과 메타데이터를 수집한다.

  3. DiscordSRV의 global 대상 채널로 주황색 Embed를 전송하고, 미설치·채널 미설정 상황을 안내한다.

생성 완료했습니다.

  • Paper 1.21.11 플러그인 프로젝트 구성

  • /자랑 명령어 추가

  • 손에 든 아이템이 없을 때 안내 메시지

  • DiscordSRV 미설치·비활성화 시 오류 메시지

  • DiscordSRV의 global 채널로 Embed 전송

  • Embed 제목: 🎉 아이템 자랑!

  • Embed 색상: 주황색

  • 플레이어 이름, 아이템 이름, 수량, 타입, Lore, 인챈트 표시

  • DiscordSRV 설정에 global 채널 매핑이 필요합니다.

빌드는 다음 명령어로 실행하면 됩니다.

Shell
./gradlew build
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
6 336
src/main/java/com/kodari/itemshowcase/ItemShowcasePlugin.java
package com.kodari.itemshowcase;

import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class ItemShowcasePlugin extends JavaPlugin {

    @Override
    public void onEnable() {
        PluginCommand command = getCommand("자랑");
        if (command == null) {
            getLogger().severe("/자랑 명령어를 등록할 수 없습니다.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        command.setExecutor(new ItemShowcaseCommand(this));
    }
}