2019年5月14日火曜日

Spigotメモ

#マイクラSpigotプラグイン開発
JDK1.8

C:\> choco install jdk8

IntelliJ IDEA Community

C:\> choco install intellijidea-community

参考URL

ディレクトリ
ビルド用

$ mkdir -p /mnt/c/Users/[YOURUSER]/projects/8x9/build_spigot_server

Spigot実行用

    $ mkdir -p /mnt/c/Users/[YOURUSER]/projects/8x9/spigot_server/

ビルドツール
ビルド
BuildTools | SpigotMC - High Performance Minecraft
BuildTools.jarをダウンロードしてビルド用ディレクトリにコピー
PowerShellで以下のコマンドを実行

$ java -jar BuildTools.jar --rev 1.13.2

時間かかる。CPU・メモリかなり食う
enter image description here

以下のメッセージで完了

    Success! Everything compiled successfully. Copying final .jar files now.
Copying craftbukkit-1.13.2-R0.1-SNAPSHOT.jar to C:\Users\yoshi\projects\8x9\build_spigot_server\.\craftbukkit-1.13.2.jar
  - Saved as .\craftbukkit-1.13.2.jar
Copying spigot-1.13.2-R0.1-SNAPSHOT.jar to C:\Users\yoshi\projects\8x9\build_spigot_server\.\spigot-1.13.2.jar
  - Saved as .\spigot-1.13.2.jar

出来あがった spigot-..*.jar を spigot.jar にリネームして、Spigot実行用ディレクトリにコピー

ビルドツールの実行

以下のサイトでスタートアップスクリプトを作成しSpigot実行用フォルダで実行
Installation | SpigotMC - High Performance Minecraft
スタートアップスクリプトを実行

> .\startup.bat
Loading libraries, please wait...
Loaded 0 recipes
>[16:56:49 INFO]: Loaded 0 recipes
[16:56:49 INFO]: Starting minecraft server version 1.13.2
[16:56:49 INFO]: Loading properties
[16:56:49 WARN]: server.properties does not exist
[16:56:49 INFO]: Generating new properties file
[16:56:49 WARN]: Failed to load eula.txt
[16:56:49 INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
[16:56:49 INFO]: Stopping server
[16:56:49 INFO]: Saving worlds
>続行するには何かキーを押してください . . .

初回のみ、「EULAへの同意をせよ」とのエラーになります。
eula.txtが出来ているので、それを開き、eula=falseをeula=trueに変更してください。
起動できるようになるはずです!

環境構築3 PLUGINソース取得、INTELLIJ確認

作業ディレクトリは下記を想定

$ mkdir -p /mnt/c/Users/yoshi/projects/8x9/KPS8x9M2Plugin

GitHubからソースをクローン

     $ cd projects/8x9/
     $ git clone https://github.com/8x9students/KPS8x9M2Plugin.git
     Cloning into 'KPS8x9M2Plugin'...
remote: Enumerating objects: 504, done.
remote: Counting objects: 100% (504/504), done.
remote: Compressing objects: 100% (202/202), done.
remote: Total 504 (delta 191), reused 437 (delta 138), pack-reused 0
Receiving objects: 100% (504/504), 73.15 KiB | 668.00 KiB/s, done.
Resolving deltas: 100% (191/191), done.
    $ cd KPS8x9M2Plugin
    $ cp .idea/workspace.xml.org .idea/workspace.xml
    $ cp .idea/misc.xml.org .idea/misc.xml

INTELLIJ初期設定

IntelliJで[Userフォルダ]/projects/8x9/KPS8x9M2Pluginプロジェクトを開いてください
enter image description here

0 件のコメント:

コメントを投稿