最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

python 3.x - Error create+connect server for minecraft pe with using bedrockpy - Stack Overflow

matteradmin7PV0评论

I am writing my own server for Minecraft PE using libraries Bedrockpy for python, here is the server code:



from bedrock.server import Server

import json



app = Server()



@app.server_event

async def ready(ctx):

    print(ctx.host, ctx.port)



@app.game_event

async def mob_killed(ctx):

    mob = ctx._data['victim']['type']

    text = f"§p[System]: Вы победили §c{mob}\n§aВам начисленно 10 очков опыта"

    raw_text = json.dumps({"rawtext": [{"text": text}]})

    await ctx.server.run(f'tellraw @s {raw_text}')



@app.game_event

async def player_message(ctx):

    print(ctx._data["message"])

    if ctx._data["message"] == "!help":

        text = "§p=====[HELP]=====\n  §a[Command List]\n    1. !help\n    2. !user\n§c=====[WARNING]=====\n§aКоманды должны иметь обязательный префикс '!'"

        raw_text = json.dumps({"rawtext": [{"text": text}]})

        await ctx.server.run(f"tellraw @s {raw_text}")



app.start("GameDev.aternos.me", 37921)

Everything works fine if you run the server on the local host Everything works fine if I run the server on the local host, but only I can connect to it on command:

/connect 127.0.0.1:37291

Decided to connect this system to an external server: GameDev.aternos.me Need to:

  1. Make it so that other players can connect to the server written in python.
  2. If there is a way to deploy the server in the cloud (optional)

I work with the console Termux, because there is no possibility to write code from a PC now... If there is any way to create a Minecraft server pe If there is any way to create a Minecraft Bedrock server using Python, please help...

Post a comment

comment list (0)

  1. No comments so far