DisCoreBotは、Minecraftサーバー(Spigotおよびその派生)とDiscordを連携させるためのコアプラグインです。
- インストール
Modrinth または GitHub Releases からJARファイルをダウンロードし、サーバーの
pluginsフォルダに配置してください。 - トークン設定
サーバーを起動すると
plugins/DisCoreBot/内にconfig.ymlが生成されます。bot-token項目にDiscord Botのトークンを入力してください。 - アドオンの構成
サーバーを再起動すると、内蔵アドオン(Built-in Addons)の設定ファイルが
plugins/DisCoreBot/addons/内に生成されます。各設定ファイルのenabledをfalseに書き換えることで、特定のアドオンを無効化できます。 - 外部アドオンの導入
他のプラグインと同様に
pluginsフォルダへ配置してください。 ※外部アドオン起因のバグやエラーについては、各アドオンの開発者へ報告してください。 - 設定の反映
設定変更後はサーバーの再起動を推奨します。
/discorebot reloadコマンドはコア機能の再読み込みに限定されており、すべての変更を反映するわけではありません。
アドオン開発や他プラグインからの連携には、以下のイベントおよびAPIを利用できます。
build.gradle.ktsに以下の行を追加してください。
repositories {
mavenCentral()
maven("https://jitpack.io")
}
dependencies {
compileOnly("com.github.mrbest2525:discorebot:v1.1.0)
}
DisCoreBotへ必要な情報を登録するために使用します。
- チャンネルと識別IDの登録
registerM2D(NamespacedKey key, String channelId) - Discordスラッシュコマンドの登録
registerSlashCommand(SlashCommandData data, Consumer<SlashCommandInteractionEvent> executor)
Discordからメッセージが送信された際に発火します。
- JDAイベントの取得
getEvent()メソッドからJDAの生イベントにアクセスできます。 - ヘルパーメソッド
getMessage(): 送信されたメッセージを取得します。getChannelID(): メッセージが送信されたチャンネルIDを取得します。getAuthorName(): 送信したユーザーの名前を取得します。
DisCoreBotApi を使用することで、以下の機能を利用できます。
事前に登録した識別IDとチャンネルIDを使用してメッセージを送信します。
- メッセージの作成:
WebhookMessageBuilderを使用してメッセージをビルドしてください。埋め込みメッセージ(Embed)も同様の手順で作成・送信可能です。 - 送信処理: このメソッドで指定されたメッセージは一度送信キューに取り込まれた後、非同期で順次送信されます。
DisCoreBot is a core plugin designed to integrate Minecraft servers (Spigot and its forks) with Discord.
- Installation
Download the JAR file from Modrinth or GitHub Releases and place it in your server's
pluginsfolder. - Token Configuration
Upon starting the server, a
config.ymlwill be generated inplugins/DisCoreBot/. Enter your Discord Bot token in thebot-tokenfield. - Add-on Configuration
After restarting the server, configuration files for Built-in Addons will be generated in
plugins/DisCoreBot/addons/. You can disable specific addons by settingenabledtofalsein their respective config files. - Installing External Add-ons
Install them into the
pluginsfolder just like any other plugin. Note: Please report bugs or errors caused by external add-ons to their respective developers. - Applying Changes
A server restart is recommended after changing settings. The
/discorebot reloadcommand is limited to reloading core functions and may not reflect all changes.
For add-on development or integration with other plugins, the following events and APIs are available.
Add the following lines to build.gradle.kts:
repositories {
mavenCentral()
maven("https://jitpack.io")
}
dependencies {
compileOnly("com.github.mrbest2525:discorebot:v1.1.0)
}
Used to register necessary information to DisCoreBot.
- Register Channel and Identification ID
registerM2D(NamespacedKey key, String channelId) - Register Discord Slash Commands
registerSlashCommand(SlashCommandData data, Consumer<SlashCommandInteractionEvent> executor)
Fired when a message is sent from Discord.
- Get JDA Event
Access the raw JDA event via the
getEvent()method. - Helper Methods
getMessage(): Retrieves the sent message.getChannelID(): Retrieves the channel ID where the message was sent.getAuthorName(): Retrieves the name of the user who sent the message.
Additional features are available via DisCoreBotApi.
Sending Messages: DisCoreBotApi#sendMessage(NamespacedKey id, String channel, WebhookMessage message)
Sends a message using a previously registered identification ID and channel ID.
- Creating Messages: Build your message using
WebhookMessageBuilder. Embedded messages (Embeds) can also be created and sent using this feature. - Transmission Process: Messages specified in this method are first added to a transmission queue and then sent sequentially and asynchronously.