赞
踩
你有没有这种想法:
想用自己在网上下载的皮肤,但是网易版不支持,用PCL2、HMCL或BakaXL又不能联机(2023年2月27日)
想自己开一个服务器,让自己成为OP大佬。
内网穿透复杂而贵。
.......
那么,接下来,让我们一步步搭建MC服务器吧!
首先,准备工作不能少,以下为要准备的东西:
- Windows11/10电脑
- 正版账号(可有可无)
- Minecraft 1.19.3服务器JAR文件(链接:https://piston-data.mojang.com/v1/objects/c9df48efed58511cdd0213c56b9013a7b5c9ac1f/server.jar)
- Java19/18
- 一个https://frp.starryfrp.com/账号(星空内网穿透账号)
验证,首先,没有电脑的快去买吧!没正版的我不敢保证可以运行。JAR文件直接点链接。JAVA安装请看下面的教程:
b. 按照提示一步步来。
按下Win+R,或者按下Win+X,选择PowerShell或CMD(最好是管理员),输入java -version,如果出现类似于:
java version "19.0.2" 2023-01-17
Java(TM) SE Runtime Environment (build 19.0.2+7-44)
Java HotSpot(TM) 64-Bit Server VM (build 19.0.2+7-44, mixed mode, sharing)
的话就是安装成功,如果出现未知的命令就要按照此方法一步步配置了:
a. 在Windows搜索框里搜索高级系统设置,点击,选择环境变量,点击系统变量中的Path,
点击编辑。
b. 点击新建,输入你的Java安装路径(比如:C:\Program Files\Common Files\Oracle\Java\javapath)
c. 点击新建,输入你的Java安装路径(比如:C:\ProgramData\Oracle\Java\javapath)
注册账号,看前面。
前面准备工作做完了,开始真正的搭建吧!
将下载好的server.jar拷贝至一个空文件夹,将CMD或 PowerShell位置导在那里,输入指令(内存大于6G):
java -server -XX:+UseG1GC -Xmx4096M -Xms1024M -jar G:/Minecraft_Sever/server.jar nogui
结束后编辑eula.txt,将false改为true。
重新运行指令,应出现如下内容:
Starting net.minecraft.server.Main [11:59:25] [ServerMain/INFO]: Building unoptimized datafixer [11:59:26] [ServerMain/WARN]: You specified a resource pack without providing a sha1 hash. Pack will be updated on the client only if you change the name of the pack. [11:59:26] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD' [11:59:28] [ServerMain/INFO]: Loaded 7 recipes [11:59:28] [ServerMain/INFO]: Loaded 1179 advancements ^N^N[11:59:29] [Server thread/INFO]: Starting minecraft server version 1.19.3 [11:59:29] [Server thread/INFO]: Loading properties [11:59:29] [Server thread/INFO]: Default game type: SURVIVAL [11:59:29] [Server thread/INFO]: Generating keypair [11:59:29] [Server thread/INFO]: Starting Minecraft server on *:12486 [11:59:29] [Server thread/INFO]: Using default channel type [11:59:29] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE! [11:59:29] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware. [11:59:29] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose. [11:59:29] [Server thread/WARN]: To change this, set "online-mode" to "true" in the server.properties file. [11:59:29] [Server thread/INFO]: Preparing level "world" [11:59:31] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld [11:59:34] [Worker-Main-5/INFO]: Preparing spawn area: 0% [11:59:34] [Worker-Main-5/INFO]: Preparing spawn area: 0% [11:59:34] [Worker-Main-5/INFO]: Preparing spawn area: 0% [11:59:34] [Worker-Main-5/INFO]: Preparing spawn area: 0% [11:59:34] [Worker-Main-5/INFO]: Preparing spawn area: 0% [11:59:34] [Worker-Main-5/INFO]: Preparing spawn area: 0% [11:59:34] [Worker-Main-5/INFO]: Preparing spawn area: 0% [11:59:34] [Worker-Main-4/INFO]: Preparing spawn area: 13% [11:59:35] [Worker-Main-6/INFO]: Preparing spawn area: 95% [11:59:35] [Server thread/INFO]: Time elapsed: 4053 ms [11:59:35] [Server thread/INFO]: Done (5.573s)! For help, type "help" [11:59:35] [Server thread/INFO]: Starting GS4 status listener [11:59:35] [Server thread/INFO]: Thread Query Listener started [11:59:35] [Query Listener #1/INFO]: Query running on 0.0.0.0:25565 [12:05:00] [Server thread/INFO]: John_MC_Python[/127.0.0.1:65441] logged in with entity id 181 at (-5.5, 70.0, -7.5) [12:05:00] [Server thread/INFO]: John_MC_Python joined the game [12:05:30] [Server thread/INFO]: John_MC_Python lost connection: Disconnected [12:05:30] [Server thread/INFO]: John_MC_Python left the game op [12:06:12] [Server thread/INFO]: Unknown or incomplete command, see below for error [12:06:12] [Server thread/INFO]: op<--[HERE] [12:06:45] [Server thread/INFO]: John_MC_Python[/127.0.0.1:65478] logged in with entity id 239 at (-5.5, 70.0, -7.5) [12:06:45] [Server thread/INFO]: John_MC_Python joined the game op John_MC_Python [12:07:19] [Server thread/INFO]: Made John_MC_Python a server operator [12:07:36] [Server thread/INFO]: [John_MC_Python: Set the time to 1000] [12:07:43] [Server thread/INFO]: [John_MC_Python: Set the weather to clear] [12:10:51] [Server thread/INFO]: John_MC_Python lost connection: Disconnected [12:10:51] [Server thread/INFO]: John_MC_Python left the game stop [12:22:17] [Server thread/INFO]: Stopping the server [12:22:17] [Server thread/INFO]: Stopping server [12:22:17] [Server thread/INFO]: Saving players [12:22:17] [Server thread/INFO]: Saving worlds [12:22:19] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld [12:22:24] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_nether [12:22:24] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_end [12:22:24] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved [12:22:24] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved [12:22:24] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved [12:22:24] [Server thread/INFO]: ThreadedAnvilChunkStorage: All dimensions are saved [12:22:24] [Server thread/INFO]: Thread Query Listener stopped G:\Minecraft_Sever>java -server -XX:+UseG1GC -Xmx4096M -Xms1024M -jar G:/Minecraft_Sever/server.jar Starting net.minecraft.server.Main [12:22:35] [ServerMain/INFO]: Building unoptimized datafixer [12:22:36] [ServerMain/WARN]: You specified a resource pack without providing a sha1 hash. Pack will be updated on the client only if you change the name of the pack. [12:22:36] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD' [12:22:38] [ServerMain/INFO]: Loaded 7 recipes [12:22:38] [ServerMain/INFO]: Loaded 1179 advancements [12:22:40] [Server thread/INFO]: Starting minecraft server version 1.19.3 [12:22:40] [Server thread/INFO]: Loading properties [12:22:40] [Server thread/INFO]: Default game type: SURVIVAL [12:22:40] [Server thread/INFO]: Generating keypair [12:22:40] [Server thread/INFO]: Starting Minecraft server on *:12486 [12:22:40] [Server thread/INFO]: Using default channel type [12:22:40] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE! [12:22:40] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware. [12:22:40] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose. [12:22:40] [Server thread/WARN]: To change this, set "online-mode" to "true" in the server.properties file. [12:22:40] [Server thread/INFO]: Preparing level "world" [12:22:42] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld [12:22:45] [Worker-Main-5/INFO]: Preparing spawn area: 0% [12:22:45] [Worker-Main-5/INFO]: Preparing spawn area: 0% [12:22:45] [Worker-Main-4/INFO]: Preparing spawn area: 0% [12:22:45] [Worker-Main-4/INFO]: Preparing spawn area: 0% [12:22:45] [Worker-Main-4/INFO]: Preparing spawn area: 0% [12:22:45] [Worker-Main-4/INFO]: Preparing spawn area: 0% [12:22:45] [Worker-Main-1/INFO]: Preparing spawn area: 8% [12:22:46] [Worker-Main-7/INFO]: Preparing spawn area: 89% [12:22:46] [Server thread/INFO]: Time elapsed: 3571 ms [12:22:46] [Server thread/INFO]: Done (5.475s)! For help, type "help" [12:22:46] [Server thread/INFO]: Starting GS4 status listener [12:22:46] [Server thread/INFO]: Thread Query Listener started [12:22:46] [Query Listener #1/INFO]: Query running on 0.0.0.0:25565 [12:25:29] [Server thread/INFO]: Stopping the server [12:25:29] [Server thread/INFO]: Stopping server [12:25:29] [Server thread/INFO]: Saving players [12:25:29] [Server thread/INFO]: Saving worlds [12:25:31] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld [12:25:36] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_end [12:25:36] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_nether [12:25:36] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved [12:25:36] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved [12:25:36] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved [12:25:36] [Server thread/INFO]: ThreadedAnvilChunkStorage: All dimensions are saved [12:25:36] [Server thread/INFO]: Thread Query Listener stopped G:\Minecraft_Sever>java -server -XX:+UseG1GC -Xmx4096M -Xms1024M -jar G:/Minecraft_Sever/server.jar Starting net.minecraft.server.Main [12:26:32] [ServerMain/INFO]: Building unoptimized datafixer [12:26:34] [ServerMain/WARN]: You specified a resource pack without providing a sha1 hash. Pack will be updated on the client only if you change the name of the pack. [12:26:34] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD' [12:26:35] [ServerMain/INFO]: Loaded 7 recipes [12:26:36] [ServerMain/INFO]: Loaded 1179 advancements [12:26:37] [Server thread/INFO]: Starting minecraft server version 1.19.3 [12:26:37] [Server thread/INFO]: Loading properties [12:26:37] [Server thread/INFO]: Default game type: SURVIVAL [12:26:37] [Server thread/INFO]: Generating keypair [12:26:37] [Server thread/INFO]: Starting Minecraft server on *:12486 [12:26:38] [Server thread/INFO]: Using default channel type [12:26:38] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE! [12:26:38] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware. [12:26:38] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose. [12:26:38] [Server thread/WARN]: To change this, set "online-mode" to "true" in the server.properties file. [12:26:38] [Server thread/INFO]: Preparing level "world" [12:26:40] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld [12:26:43] [Worker-Main-5/INFO]: Preparing spawn area: 0% [12:26:43] [Worker-Main-2/INFO]: Preparing spawn area: 0% [12:26:43] [Worker-Main-2/INFO]: Preparing spawn area: 0% [12:26:43] [Worker-Main-6/INFO]: Preparing spawn area: 0% [12:26:43] [Worker-Main-2/INFO]: Preparing spawn area: 0% [12:26:43] [Worker-Main-6/INFO]: Preparing spawn area: 0% [12:26:43] [Worker-Main-5/INFO]: Preparing spawn area: 0% [12:26:43] [Worker-Main-3/INFO]: Preparing spawn area: 43% [12:26:44] [Server thread/INFO]: Time elapsed: 3957 ms [12:26:44] [Server thread/INFO]: Done (5.565s)! For help, type "help" [12:26:44] [Server thread/INFO]: Starting GS4 status listener [12:26:44] [Server thread/INFO]: Thread Query Listener started [12:26:44] [Query Listener #1/INFO]: Query running on 0.0.0.0:25565
(如果结尾部分有些没出现,属于正常现象。)
这时 Minecraft服务器就启动成功了,输入stop可以停止(不要Ctrl+C!!!),输入op 玩家名可以设置管理员,可以按照以下内容在停止服务器后用记事本或写字板编辑服务器配置文件server.properties:
allow-nether=true #是否开启地狱
level-name=world #默认世界名称(最好不要改)
enable-query=false #没有什么大用处
allow-flight=false #没有什么大用处
announce-player-achievements=true #意义不明
server-port=25566 #服务器端口(127.0.0.1:25565中的冒号后面是这个server-port的数值)
enable-rcon=false #是否开启rcon监听(没有什么用)
force-gamemode=false #force游戏模式
level-seed= #我的世界地图种子(没有特殊需要就不填)
server-ip= #服务器指向IP(默认不要改放空)
max-build-height=256 #服务器最大建筑高度
spawn-npcs=true #是否有主城NPC
white-list=false #是否开启白名单(开启后在白名单内的玩家才能进入服务器,否则进入不了。不要随便开)
spawn-animals=true #主城是否有动物
snooper-enabled=true #意义不明
hardcore=false #我的世界极限模式是否开启(玩过的都知道)
online-mode=false #是否开启正版验证,需用我的世界官方启动器才能进入
resource-pack= #服务器资源包:填下载地址(不需要就不填)
pvp=true #是否开启服务器PVP
difficulty=1 #服务器难度: 0和平 1简单 2中等 3困难
enable-command-block=false #是否开启命令方块
player-idle-timeout=0 #意义不明
gamemode=0 #玩家默认进入游戏的游戏模式 1创造 0生存 2冒险模式3旁观者
max-players=20 #服务器最大玩家数(超过后玩家无法进入)
spawn-monsters=true #主城是否刷新怪物
view-distance=10 #意义不明
generate-structures=true #意义不明
spawn-protection=16 #服务器最大保护区(玩家破坏建筑不了)
motd=A Minecraft Server MOTD指的是在玩家添加服务器后下面会显示这里面的内容(不能为特殊符号)
motd想要输入中文的话需要点击以下链接:在线 Unicode 编码转换 | 菜鸟工具 (runoob.com)将中文转为Unicode。
前面都是服务器,如果你和你的朋友在同一个网玩,那么在这就可以了,直接让好友输入你的IP,查看方式:输入指令:ipconfig即可。
如果是跨网络游玩,有两种方式,第一种,用联通/电信的可以申请家用公网IP,一般在2000~3000元,第二种,用内网穿透服务,前面都注册完帐号了吧,登录,花两元实名认证,开免费隧道,IP填你的IP,端口是刚才配置文件中server-port的值,用TCP,用#59,下载客户端,启动,让朋友输入客户端提示的域名,如cn-js-zz.starryfrp.com:88888(每天签到领流量,防止流量不够用)。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。