マイクラPE(Pocket Edition)のサーバーを建ててみる

PC用マイクラのサーバーを建てられたので、PE版のサーバーも建ててみる。

まず、環境としては、CentOS7にユーザーminecraftがいて、/home/minecraft/が存在しているとする。

$ su minecraft

で、ユーザーを切り替えて、

$ cd ~/
$ mkdir pocketmine
$ cd pocketmine

で、サーバー用のフォルダを作って移動。

後は次のページを参考に、インストール。

https://pmmp.io/get.html

まず、環境を整えるために、必要なパッケージをインストール。

# yum install perl gcc g++ make automake libtool autoconf m4

続いてサーバー本体をインストール

$ wget -q -O – https://get.pmmp.io | bash -s –
[*] Found PocketMine-MP 1.6.2dev (build 234) using API 3.0.0-ALPHA6
[*] This stable build was released on 2017年 6月 25日 日曜日 22:15:51 JST
[-] This channel should have a signature, none found
[*] Installing/updating PocketMine-MP on directory ./
[1/3] Cleaning…
[2/3] Downloading PocketMine-MP 1.6.2dev phar… done!
[3/3] Obtaining PHP: detecting if build is available…
[3/3] Linux 64-bit PHP build available, downloading PHP_7.0.3_x86-64_Linux.tar.gz… checking… regenerating php.ini… done
[*] Everything done! Run ./start.sh to start PocketMine-MP

ちなみに、こちらのサイトからもインストール可能だが、バージョンが1.4.1。PHPもバージョン5が利用されている。

http://www.pocketmine.net/

先ほどインストールしたバージョンは、ログを見る限り1.6.2で、PHPもバージョン7を利用している。

それでは、サーバーをスタートしてみる。
太字のところ以外はエンターキーで次へ。

$ ./start.sh
[*] PocketMine-MP set-up wizard
[*] Please select a language
العربية => ara
Čeština => ces
中文 (简体) => chs
Deutsch => deu
Ελληνικά => ell
English => eng
Eesti => est
Suomi => fin
Français => fra
Gaeilge => gle
עברית => heb
Bahasa Indonesia => ind
Italiano => ita
日本語 => jpn
한국어 => kor
Latviešu => lav
Malti => mlt
Bahasa Melayu => msa
Nederlands => nld
Norsk => nor
Polski => pol
Português => por
Pyccĸий => rus
Español => spa
Svenska => swe
Tagalog => tgl
ภาษาอังกฤษ => tha
tlhIngan => tlh
Türkçe => tur
Українська => ukr
Tiếng Việt => vie
中文(繁體) => zho
[?] Language (eng):
[*] English has been correctly selected.
[*] Welcome to PocketMine-MP!\nBefore starting setting up your new server you have to accept the license.\nPocketMine-MP is licensed under the LGPL License,\nthat you can read opening the LICENSE file on this folder.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

[?] Do you accept the License? (y/N): y
[?] Do you want to skip the set-up wizard? (y/N):

[*] You are going to set up your server now.
[*] If you don’t want to change the default value, just press Enter.
[*] You can edit them later on the server.properties file.
[?] Give a name to your server (Minecraft: PE Server):
[*] Do not change the default port value if this is your first server.
[?] Server port (19132):
[*] Choose between Creative (1) or Survival (0)
[?] Default Game mode (0):
[?] Max. online players (20):
[*] The spawn protection disallows placing/breaking blocks in the spawn zone except for OPs
[?] Enable spawn protection? (Y/n):
[*] An OP is the player admin of the server. OPs can run more commands than normal players
[?] OP player name (example, your game name): nori
[*] The white-list only allows players in it to join.
[?] Do you want to enable the white-list? (y/N):
[!] Query is a protocol used by different tools to get information of your server and players logged in.
[!] If you disable it, you won’t be able to use server lists.
[?] Do you want to disable Query? (y/N):
[*] RCON is a protocol to remote connect with the server console using a password.
[?] Do you want to enable RCON? (y/N):
[*] Getting your external IP and internal IP
[!] Your external IP is 999.999.999.999. You may have to port-forward to your internal IP 192.168.1.2
[!] Be sure to check it, if you have to forward and you skip that, no external players will be able to join. [Press Enter]

[*] You have finished the set-up wizard correctly
[*] Check the Plugin Repository to add new features, minigames, or advanced protection to your server
[*] PocketMine-MP will now start. Type /help to view the list of available commands.

ここまでが設定ウィザード。

途中「sh: ifconfig: コマンドが見つかりません」と表示されるのは、ifconfigがインストールされていないから。特にサーバー自体は問題なく起動した。

次からが実際に起動時のログ。

[22:28:15] [Server thread/INFO]: Loading pocketmine.yml…
[22:28:15] [Server thread/INFO]: Loading server properties…
[22:28:15] [Server thread/INFO]: Selected English (eng) as the base language
[22:28:15] [Server thread/INFO]: Starting Minecraft: PE server version v1.1.0.55
[22:28:15] [Server thread/INFO]: Opening server on 0.0.0.0:19132
[22:28:15] [Server thread/INFO]: This server is running PocketMine-MP version 1.6.2dev-234 “Unleashed” (API 3.0.0-ALPHA6)
[22:28:15] [Server thread/INFO]: PocketMine-MP is distributed under the LGPL License
[22:28:15] [Server thread/INFO]: Loading recipes…
[22:28:15] [Server thread/INFO]: Loading resource packs…
[22:28:16] [Server thread/NOTICE]: Level “world” not found
[22:28:16] [Server thread/INFO]: Preparing level “world”
[22:28:16] [Server thread/NOTICE]: Spawn terrain for level “world” is being generated in the background
[22:28:16] [Server thread/INFO]: Starting GS4 status listener
[22:28:16] [Server thread/INFO]: Setting query port to 19132
[22:28:16] [Server thread/INFO]: Query running on 0.0.0.0:19132
[22:28:16] [Server thread/INFO]: Default game type: Survival Mode
[22:28:16] [Server thread/INFO]: Done (127.96s)! For help, type “help” or “?”

これでサーバーが起動した。

ちなみにファイアウォールのfirewalldでポートが閉じられている場合。
次のコマンドで開いておく。

# firewall-cmd –add-port=19132/udp –zone=public –permanent
# firewall-cmd –reload

ちなみに、ファイアウォールの設定は、次のコマンドで参照可能。

# firewall-cmd –list-all –zone=public

が、コマンドラインで、Pocketmineが起動中なので、設定は一旦サーバーを停止する必要がある。

stop
[22:42:45] [Server thread/INFO]: [CONSOLE: Stopping the server]
[22:42:46] [Server thread/INFO]: Unloading level “world”
[22:42:51] [Server thread/INFO]: Stopping other threads

再度起動して

$ ./start.sh
[22:46:33] [Server thread/INFO]: Loading pocketmine.yml…
[22:46:33] [Server thread/INFO]: Loading server properties…
[22:46:33] [Server thread/INFO]: Selected English (eng) as the base language
[22:46:33] [Server thread/INFO]: Starting Minecraft: PE server version v1.1.0.55
[22:46:33] [Server thread/INFO]: Opening server on 0.0.0.0:19132
[22:46:33] [Server thread/INFO]: This server is running PocketMine-MP version 1.6.2dev-234 “Unleashed” (API 3.0.0-ALPHA6)
[22:46:33] [Server thread/INFO]: PocketMine-MP is distributed under the LGPL License
[22:46:34] [Server thread/INFO]: Loading recipes…
[22:46:34] [Server thread/INFO]: Loading resource packs…
[22:46:34] [Server thread/INFO]: Preparing level “world”
[22:46:34] [Server thread/INFO]: Starting GS4 status listener
[22:46:34] [Server thread/INFO]: Setting query port to 19132
[22:46:34] [Server thread/INFO]: Query running on 0.0.0.0:19132
[22:46:34] [Server thread/INFO]: Default game type: Survival Mode
[22:46:34] [Server thread/INFO]: Done (0.656s)! For help, type “help” or “?”

スマホのマイクラPEから、サーバーに接続。
ちなみに、スマホが同じローカルネットワーク上にあるか、サーバーがグローバルアドレスで参照可能な必要がある。

世界に入ると、

次のようなログが表示される。

[23:28:44] [Server thread/NOTICE]: Player data not found for “nori”, creating new profile
[23:28:50] [Server thread/INFO]: nori[/192.168.1.3:99999] logged in with entity id 1 at (world, 256, 68, 256)
[23:29:01] [Server thread/INFO]: nori joined the game

だがしかし!!

スポーン付近の地面を掘っても掘っても、土が取れない。地面も元に戻ってしまう。

少し移動すれば土も掘れるし、木も切れる。

なぜ???

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です