赞
踩
这次,我们要学习如何用Python程序,连接并操控自己的服务器
前几篇文章,我们创建的服务器都是从mcversions.net获取的,是原汁原味的服务端,这一次,我们要创建另外一种服务器——Spigot,Spigot服务器有一个小小的缺点,就是没办法装模组,但是它比原版服务端好的地方就是它可以安装插件,这次我们要让python来操控我的世界,就需要用到一个插件——RaspberryJuice
让我们开始吧!
首先,我们先下载服务器的jar文件,来到getBukkit网站
Get Bukkit | Download CraftBukkit 1.19.1 | Download Spigot 1.19.1Download the latest version of CraftBukkit and Spigot for your Minecraft server!https://getbukkit.org/这次,我们还是以1.16.3的版本为例,点击右上角download中的spigot,或者直接进入下方链接直达
点击对应版本的download按键
然后点击Spigot-1.16.3.jar这个文字(注意不是Create a Server)进行下载
然后把jar放入一个文件夹中
创建一个bat文件,写入以下内容
- @echo off
- java -jar spigot-1.16.3.jar
- pause
第一次运行,服务器自动终止(正常)
将eula.txt的eula=false改为true
再次运行
输出以下内容就是成功运行啦!
- *** Error, this build is outdated ***
- *** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***
- *** Server will start in 20 seconds ***
- Loading libraries, please wait...
- [14:04:00] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD'
- [14:04:00] [main/INFO]: Found new data pack file/bukkit, loading it automatically
- [14:04:01] [main/INFO]: Reloading ResourceManager: Default, bukkit
- [14:04:01] [Worker-Main-12/INFO]: Loaded 7 recipes
- [14:04:00] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD'
- [14:04:00] [main/INFO]: Found new data pack file/bukkit, loading it automatically
- [14:04:01] [main/INFO]: Reloading ResourceManager: Default, bukkit
- [14:04:01] [Worker-Main-12/INFO]: Loaded 7 recipes
- [14:04:01] [Server thread/INFO]: Starting minecraft server version 1.16.3
- [14:04:01] [Server thread/INFO]: Loading properties
- [14:04:02] [Server thread/INFO]: This server is running CraftBukkit version git-Spigot-2740d5a-890130b (MC: 1.16.3) (Implementing API version 1.16.3-R0.1-SNAPSHOT)
- [14:04:02] [Server thread/INFO]: Debug logging is disabled
- [14:04:02] [Server thread/INFO]: Server Ping Player Sample Count: 12
- [14:04:02] [Server thread/INFO]: Using 4 threads for Netty based IO
- [14:04:02] [Server thread/INFO]: Default game type: SURVIVAL
- [14:04:02] [Server thread/INFO]: Generating keypair
- [14:04:02] [Server thread/INFO]: Starting Minecraft server on *:25565
- [14:04:02] [Server thread/INFO]: Using default channel type
- [14:04:02] [Server thread/INFO]: Preparing level "world"
- [14:04:02] [Server thread/INFO]: -------- World Settings For [world] --------
- [14:04:02] [Server thread/INFO]: Arrow Despawn Rate: 1200 Trident Respawn Rate:1200
- [14:04:02] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
- [14:04:02] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
- [14:04:02] [Server thread/INFO]: Item Despawn Rate: 6000
- [14:04:02] [Server thread/INFO]: Item Merge Radius: 2.5
- [14:04:02] [Server thread/INFO]: View Distance: 10
- [14:04:02] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
- [14:04:02] [Server thread/INFO]: Cactus Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Cane Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Melon Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Mushroom Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Sapling Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Beetroot Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Carrot Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Potato Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Wheat Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: NetherWart Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Vine Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Cocoa Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Bamboo Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: SweetBerry Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Kelp Growth Modifier: 100%
- [14:04:02] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Ra 48 / Mi 16 / Tiv true
- [14:04:02] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
- [14:04:02] [Server thread/INFO]: Experience Merge Radius: 3.0
- [14:04:02] [Server thread/INFO]: Mob Spawn Range: 6
- [14:04:02] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
- [14:04:02] [Server thread/INFO]: Custom Map Seeds: Village: 10387312 Desert: 14357617 Igloo: 14357618 Jungle: 14357619 Swamp: 14357620 Monument: 10387313 Ocean: 14357621 Shipwreck: 165745295 End City: 10387313 Slime: 987234911 Bastion: 30084232 Fortress: 30084232 Mansion: 10387319 Fossil: 14357921 Portal: 34222645
- [14:04:02] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
- [14:04:02] [Server thread/INFO]: Max TNT Explosions: 100
- [14:04:04] [Server thread/INFO]: -------- World Settings For [world_nether] --------
- [14:04:04] [Server thread/INFO]: Arrow Despawn Rate: 1200 Trident Respawn Rate:1200
- [14:04:04] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
- [14:04:04] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
- [14:04:04] [Server thread/INFO]: Item Despawn Rate: 6000
- [14:04:04] [Server thread/INFO]: Item Merge Radius: 2.5
- [14:04:04] [Server thread/INFO]: View Distance: 10
- [14:04:04] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
- [14:04:04] [Server thread/INFO]: Cactus Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Cane Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Melon Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Mushroom Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Sapling Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Beetroot Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Carrot Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Potato Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Wheat Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: NetherWart Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Vine Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Cocoa Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Bamboo Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: SweetBerry Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Kelp Growth Modifier: 100%
- [14:04:04] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Ra 48 / Mi 16 / Tiv true
- [14:04:04] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
- [14:04:04] [Server thread/INFO]: Experience Merge Radius: 3.0
- [14:04:04] [Server thread/INFO]: Mob Spawn Range: 6
- [14:04:04] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
- [14:04:04] [Server thread/INFO]: Custom Map Seeds: Village: 10387312 Desert: 14357617 Igloo: 14357618 Jungle: 14357619 Swamp: 14357620 Monument: 10387313 Ocean: 14357621 Shipwreck: 165745295 End City: 10387313 Slime: 987234911 Bastion: 30084232 Fortress: 30084232 Mansion: 10387319 Fossil: 14357921 Portal: 34222645
- [14:04:04] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
- [14:04:04] [Server thread/INFO]: Max TNT Explosions: 100
- [14:04:04] [Server thread/WARN]: Unable to find spawn biome
- [14:04:05] [Server thread/INFO]: -------- World Settings For [world_the_end] --------
- [14:04:05] [Server thread/INFO]: Arrow Despawn Rate: 1200 Trident Respawn Rate:1200
- [14:04:05] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
- [14:04:05] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
- [14:04:05] [Server thread/INFO]: Item Despawn Rate: 6000
- [14:04:05] [Server thread/INFO]: Item Merge Radius: 2.5
- [14:04:05] [Server thread/INFO]: View Distance: 10
- [14:04:05] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
- [14:04:05] [Server thread/INFO]: Cactus Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Cane Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Melon Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Mushroom Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Sapling Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Beetroot Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Carrot Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Potato Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Wheat Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: NetherWart Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Vine Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Cocoa Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Bamboo Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: SweetBerry Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Kelp Growth Modifier: 100%
- [14:04:05] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Ra 48 / Mi 16 / Tiv true
- [14:04:05] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
- [14:04:05] [Server thread/INFO]: Experience Merge Radius: 3.0
- [14:04:05] [Server thread/INFO]: Mob Spawn Range: 6
- [14:04:05] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
- [14:04:05] [Server thread/INFO]: Custom Map Seeds: Village: 10387312 Desert: 14357617 Igloo: 14357618 Jungle: 14357619 Swamp: 14357620 Monument: 10387313 Ocean: 14357621 Shipwreck: 165745295 End City: 10387313 Slime: 987234911 Bastion: 30084232 Fortress: 30084232 Mansion: 10387319 Fossil: 14357921 Portal: 34222645
- [14:04:05] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
- [14:04:05] [Server thread/INFO]: Max TNT Explosions: 100
- [14:04:05] [Server thread/WARN]: Unable to find spawn biome
- [14:04:05] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
- [14:04:05] [Worker-Main-11/INFO]: Preparing spawn area: 0%
- [14:04:05] [Worker-Main-11/INFO]: Preparing spawn area: 4%
- [14:04:06] [Worker-Main-10/INFO]: Preparing spawn area: 15%
- [14:04:06] [Worker-Main-11/INFO]: Preparing spawn area: 24%
- [14:04:07] [Worker-Main-13/INFO]: Preparing spawn area: 44%
- [14:04:07] [Worker-Main-9/INFO]: Preparing spawn area: 57%
- [14:04:08] [Worker-Main-12/INFO]: Preparing spawn area: 69%
- [14:04:08] [Worker-Main-11/INFO]: Preparing spawn area: 89%
- [14:04:09] [Server thread/INFO]: Time elapsed: 3837 ms
- [14:04:09] [Server thread/INFO]: Preparing start region for dimension minecraft:the_nether
- [14:04:09] [Worker-Main-10/INFO]: Preparing spawn area: 0%
- [14:04:09] [Worker-Main-10/INFO]: Preparing spawn area: 5%
- [14:04:10] [Worker-Main-14/INFO]: Preparing spawn area: 17%
- [14:04:10] [Worker-Main-14/INFO]: Preparing spawn area: 30%
- [14:04:11] [Worker-Main-14/INFO]: Preparing spawn area: 43%
- [14:04:11] [Worker-Main-9/INFO]: Preparing spawn area: 58%
- [14:04:12] [Worker-Main-8/INFO]: Preparing spawn area: 75%
- [14:04:12] [Worker-Main-12/INFO]: Preparing spawn area: 90%
- [14:04:12] [Server thread/INFO]: Time elapsed: 3751 ms
- [14:04:12] [Server thread/INFO]: Preparing start region for dimension minecraft:the_end
- [14:04:12] [Worker-Main-12/INFO]: Preparing spawn area: 0%
- [14:04:13] [Worker-Main-12/INFO]: Preparing spawn area: 66%
- [14:04:13] [Server thread/INFO]: Time elapsed: 684 ms
- [14:04:13] [Server thread/INFO]: Done (10.612s)! For help, type "help"
- >
但是这样还不够,输入stop并回车,终止服务器
为了将python和服务器关联起来,我们需要用到一个插件RaspberryJuice
进入这个网站,看到如下页面
点击Download Now开始下载,这里不推荐大家使用迅雷,因为文件太小,迅雷一直卡在连接资源,所以浏览器有迅雷扩展程序的话把它先关了然后才下载,这样用了不到1秒就能成功下载啦!
下载完毕后,将jar文件复制到服务器目录下的plugins文件夹中
然后启动服务器即可
从输出中不难发现,RaspberryJuice已经成功被我们添加进去啦!
好了,安装Spigot服务器并添加RaspberryJuice的教程就到这里!
下一篇文章我们就来详细了解如何用Python的第三方库对Minecraft进行编程~
喜欢的话就点赞关注吧!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。