admin管理员组

文章数量:1026989

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...

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...

本文标签: python 3xError createconnect server for minecraft pe with using bedrockpyStack Overflow