<!-- 
RSS generated by JIRA (9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13) at Sat Jan 11 08:23:47 UTC 2025

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Mojang Studios Jira</title>
    <link>https://bugs.mojang.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en</language>    <build-info>
        <version>9.12.2</version>
        <build-number>9120002</build-number>
        <build-date>10-01-2024</build-date>
    </build-info>


<item>
            <title>[BDS-18961] Bedrock Dedicated Server Unknown encoding error</title>
                <link>https://bugs.mojang.com/browse/BDS-18961</link>
                <project id="11700" key="BDS">Bedrock Dedicated Server</project>
                    <description>&lt;p&gt;Even though Minecraft Bedrock 1.20 claims to support UTF-8 and the command &quot;say &#20320;&#22909;&quot; displays chinese correctly when entering it directly into the bedrock_server.exe, I encountered an issue when attempting to run bedrock_server.exe as a subprocess in a Python program. &lt;br/&gt;
Commands with &lt;font color=&quot;#ff0000&quot;&gt;UTF-8&lt;/font&gt; characters input into this subprocess are automatically decoded into &lt;font color=&quot;#ff0000&quot;&gt;ISO-8859-1&lt;/font&gt; characters. As a result, the original Chinese characters &quot;&#20320;&#22909;&quot; on the server and cilent appear as &quot;&#228;&#189; &#229;&#165;&#189;&quot;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;a id=&quot;559280_thumb&quot; href=&quot;https://bugs.mojang.com/secure/attachment/559280/559280_image-2024-01-14-11-31-50-317.png&quot; title=&quot;image-2024-01-14-11-31-50-317.png&quot; file-preview-type=&quot;image&quot; file-preview-id=&quot;559280&quot; file-preview-title=&quot;image-2024-01-14-11-31-50-317.png&quot;&gt;&lt;img src=&quot;https://bugs.mojang.com/secure/thumbnail/559280/_thumb_559280.png&quot; style=&quot;border: 0px solid black&quot; role=&quot;presentation&quot;/&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;This screenshot shows the official bedrock_server.exe running independently.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;but in python&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;a id=&quot;559279_thumb&quot; href=&quot;https://bugs.mojang.com/secure/attachment/559279/559279_image-2024-01-14-11-33-39-088.png&quot; title=&quot;image-2024-01-14-11-33-39-088.png&quot; file-preview-type=&quot;image&quot; file-preview-id=&quot;559279&quot; file-preview-title=&quot;image-2024-01-14-11-33-39-088.png&quot;&gt;&lt;img src=&quot;https://bugs.mojang.com/secure/thumbnail/559279/_thumb_559279.png&quot; style=&quot;border: 0px solid black&quot; role=&quot;presentation&quot;/&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://bugs.mojang.com/secure/attachment/559286/559286_image-2024-01-14-17-45-56-736.png&quot; height=&quot;147&quot; width=&quot;277&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;I wrote it into a Python subprocess to facilitate remote command sending and receiving comments. Originally, I intended for comments on my live channel to be displayed as dialogues in Minecraft. However, I discovered that Chinese characters were being compiled into Latin letters.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://bugs.mojang.com/secure/attachment/559277/559277_image-2024-01-14-11-38-06-542.png&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;a id=&quot;559278_thumb&quot; href=&quot;https://bugs.mojang.com/secure/attachment/559278/559278_image-2024-01-14-11-37-51-737.png&quot; title=&quot;image-2024-01-14-11-37-51-737.png&quot; file-preview-type=&quot;image&quot; file-preview-id=&quot;559278&quot; file-preview-title=&quot;image-2024-01-14-11-37-51-737.png&quot;&gt;&lt;img src=&quot;https://bugs.mojang.com/secure/thumbnail/559278/_thumb_559278.png&quot; height=&quot;34&quot; width=&quot;755&quot; style=&quot;border: 0px solid black&quot; role=&quot;presentation&quot;/&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Even though I have enabled UTF-8 encoding for the pipeline, it still doesn&apos;t work. This issue doesn&apos;t exist when interacting with other programs. I suspect that the subprocess form may cause some internal code in the server program to handle UTF-8 characters in the same way as in previous versions, converting them into ISO-8859-1.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;I have another piece of code here that can be used to illustrate what happened.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;a id=&quot;559272_thumb&quot; href=&quot;https://bugs.mojang.com/secure/attachment/559272/559272_image-2024-01-14-12-06-00-898.png&quot; title=&quot;image-2024-01-14-12-06-00-898.png&quot; file-preview-type=&quot;image&quot; file-preview-id=&quot;559272&quot; file-preview-title=&quot;image-2024-01-14-12-06-00-898.png&quot;&gt;&lt;img src=&quot;https://bugs.mojang.com/secure/thumbnail/559272/_thumb_559272.png&quot; style=&quot;border: 0px solid black&quot; role=&quot;presentation&quot;/&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://bugs.mojang.com/secure/attachment/559271/559271_image-2024-01-14-12-06-28-403.png&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;I have attached my code in the comments section&lt;/p&gt;

&lt;p&gt;If a solution can be identified, I would be extremely grateful. If the issue lies within the server program itself, I sincerely hope it can be resolved.&#160; &#160;Thank you&#65281;&lt;/p&gt;</description>
                <environment>Windows Server 2022 Datacenter 21H2 inter 20348.1970 bedrock_server.exe for bedrock 1.20.51</environment>
        <key id="549096">BDS-18961</key>
            <summary>Bedrock Dedicated Server Unknown encoding error</summary>
                <type id="1" iconUrl="https://bugs.mojang.com/secure/viewavatar?size=xsmall&amp;avatarId=18903&amp;avatarType=issuetype">Bug</type>
                                    <status id="5" iconUrl="https://bugs.mojang.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="10001">Awaiting Response</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="ArcherLee127chen">ArcherLee127chen</reporter>
                        <labels>
                            <label>command</label>
                    </labels>
                <created>Sun, 14 Jan 2024 05:14:56 +0100</created>
                <updated>Wed, 10 Jul 2024 18:14:13 +0200</updated>
                            <resolved>Wed, 10 Jul 2024 18:14:13 +0200</resolved>
                                    <version>1.20.51</version>
                                                            <votes>1</votes>
                                    <watches>1</watches>
                                                                            <comments>
                            <comment id="1338095" author="JIRAUSER555914" created="Wed, 10 Jul 2024 18:14:13 +0200"  >&lt;p&gt;&lt;b&gt;Thank you for your report!&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;However, this issue has been temporarily closed as &lt;b&gt;&lt;font color=&quot;#ff5722&quot;&gt;Awaiting Response&lt;/font&gt;&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;Is this still an issue in the latest version? If yes, could you please add it to the affected versions (or mention it if you are not the reporter)?&lt;/p&gt;

&lt;p&gt;This ticket will automatically reopen when you reply.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Quick Links&lt;/b&gt;:&lt;br/&gt;
 &#128211; &lt;a href=&quot;https://help.minecraft.net/hc/en-us/articles/4408887473421&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Issue Guidelines&lt;/a&gt; &#8211; &#128172; &lt;a href=&quot;https://help.minecraft.net/hc/en-us/requests/new&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Mojang Support&lt;/a&gt; &#8211; &#128211; &lt;a href=&quot;https://bugs.mojang.com/projects/BDS/summary&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;Project Summary&lt;/a&gt; &amp;#8211; &#128231; &lt;a href=&quot;https://feedback.minecraft.net/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Suggestions&lt;/a&gt; &#8211; &#128214; &lt;a href=&quot;https://minecraft.wiki&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Minecraft Wiki&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1302054" author="JIRAUSER738282" created="Tue, 30 Jan 2024 10:24:31 +0100"  >&lt;p&gt;I guess it only happening on windows, in my java project i have same issue, but on linux it working, its windows(system) issue&lt;/p&gt;</comment>
                            <comment id="1299715" author="JIRAUSER769986" created="Mon, 15 Jan 2024 04:02:18 +0100"  >&lt;p&gt;&lt;b&gt;&lt;font color=&quot;#de350b&quot;&gt;If possible, I suggest adding built-in character encoding functionality for commands like &apos;say&apos; and &apos;tell&apos;, &apos;tellraw&apos;, etc. &lt;img class=&quot;emoticon&quot; src=&quot;https://bugs.mojang.com/images/icons/emoticons/wink.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/font&gt;&lt;/b&gt; &lt;/p&gt;

&lt;p&gt;&lt;font color=&quot;#57d9a3&quot;&gt;&lt;b&gt;For example:&lt;/b&gt;&#160; &#160; &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font color=&quot;#57d9a3&quot;&gt;&#160; &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;font color=&quot;#00875a&quot;&gt;/tellraw @a {&quot;rawtext&quot;:[\{&quot;text&quot;:&quot;&#228;&#189; &#229;&#165;&#189;,&quot;encoding&quot;:[&apos;iso-8859-1&apos;,&apos;utf-8&apos;]}]}&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;font color=&quot;#00875a&quot;&gt;&lt;b&gt;&amp;gt; &#20320;&#22909;&lt;/b&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;font color=&quot;#00875a&quot;&gt;/say &quot;&#228;&#189; &#229;&#165;&#189;&quot; &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;iso-8859-1&amp;#39;,&amp;#39;utf-8&amp;#39;&amp;#93;&lt;/span&gt;&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;font color=&quot;#00875a&quot;&gt;&lt;b&gt;&amp;gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;server&amp;#93;&lt;/span&gt;&#20320;&#22909;&lt;/b&gt;&lt;/font&gt;&lt;/p&gt;</comment>
                            <comment id="1299655" author="JIRAUSER769986" created="Sun, 14 Jan 2024 10:38:29 +0100"  >&lt;p&gt;#This is my Python code&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;#from selenium import webdriver&lt;br/&gt;
#from selenium.webdriver.common.by import By&lt;br/&gt;
#from bs4 import BeautifulSoup&lt;br/&gt;
import subprocess&lt;br/&gt;
import asyncio&lt;br/&gt;
import websockets&lt;br/&gt;
import shutil&lt;br/&gt;
import os&lt;br/&gt;
import time&lt;br/&gt;
from time import gmtime, strftime&lt;br/&gt;
import _thread&lt;br/&gt;
encoding = &apos;utf-8&apos;&lt;br/&gt;
chat_historty = []&lt;br/&gt;
history_queue = []&lt;br/&gt;
links = []&lt;br/&gt;
lastsend = &quot;&quot;&lt;br/&gt;
process = subprocess.Popen(&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;bedrock_server.exe&amp;#39;&amp;#93;&lt;/span&gt;, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT \&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;, text=True, encoding=encoding, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)&lt;/p&gt;


&lt;p&gt;def server_order(msg):&lt;br/&gt;
&#160; &#160; &#160; &#160; w = msg + &quot;\n&quot;&lt;br/&gt;
&#160; &#160; &#160; &#160; process.stdin.write(w)&lt;br/&gt;
&#160; &#160; &#160; &#160; process.stdin.flush()&lt;br/&gt;
&#160; &#160; &#160; &#160;&#160;&lt;br/&gt;
def server_sender(msg):&lt;br/&gt;
&#160; &#160; &#160; &#160; #w = &apos;say &apos;+msg +&apos;\n&apos;&lt;br/&gt;
&#160; &#160; &#160; &#160; #process.stdin.write(w)&lt;br/&gt;
&#160; &#160; &#160; &#160; #process.stdin.flush()&lt;br/&gt;
&#160; &#160; &#160; &#160; server_order(f&quot;say {msg}\n&quot;)&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;


&lt;p&gt;def count_subdirectories(folder_path):&lt;br/&gt;
&#160; &#160; items = os.listdir(folder_path)&lt;br/&gt;
&#160; &#160; subdirectories = &lt;span class=&quot;error&quot;&gt;&amp;#91;item for item in items if os.path.isdir(os.path.join(folder_path, item))&amp;#93;&lt;/span&gt;&lt;br/&gt;
&#160; &#160; return len(subdirectories)&lt;/p&gt;


&lt;p&gt;def run_scripts(): &#160;# a message sender&lt;br/&gt;
&#160; &#160; &#160; &#160; # still run&lt;br/&gt;
&#160; &#160; &#160; &#160; while True:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; time.sleep(3.5)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#160;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; msg = &quot;&#20320;&#22909;&quot;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; print(&quot;msg in python: &quot;, msg)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; server_order(msg) # check immediately&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; server_sender(msg) # check in game&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#160;&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#160;&lt;/p&gt;

&lt;p&gt;def read_live(): &#160;# a message sender&lt;br/&gt;
&#160; &#160; # Send comments from my live channel&lt;br/&gt;
&#160; &#160; # For privacy reasons, I did not display the cookies code here&lt;br/&gt;
&#160; &#160; pass&lt;/p&gt;

&lt;p&gt;def run_popen():&lt;br/&gt;
&#160; &#160; global lastsend&lt;br/&gt;
&#160; &#160; def run_async_function(func, args):&lt;br/&gt;
&#160; &#160; &#160; &#160; # Running asynchronous functions in a new protocol&lt;br/&gt;
&#160; &#160; &#160; &#160; loop = asyncio.new_event_loop()&lt;br/&gt;
&#160; &#160; &#160; &#160; asyncio.set_event_loop(loop)&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; try:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; loop.run_until_complete(func(args))&lt;br/&gt;
&#160; &#160; &#160; &#160; finally:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; loop.close()&lt;br/&gt;
&#160; &#160; while True:&lt;br/&gt;
&#160; &#160; &#160; &#160; try:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; output = process.stdout.readline()&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; if output == &apos;&apos; and process.poll() is not None:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; print(&quot;not null but get nothing&quot;)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; break&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; if output:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; print(&quot;get message from process =&amp;gt; &quot;, output.strip())&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; time = strftime(&apos;%a, %d %b %Y %H:%M:%S&apos;, gmtime())&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; timestamped_output = f&quot;{output.strip()}\t{time}&quot;&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; if lastsend != time:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; history_queue.append(timestamped_output)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; for L in links:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; run_async_function(L.send, timestamped_output)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lastsend = time&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#160;&lt;br/&gt;
&#160; &#160;&#160;&lt;br/&gt;
&#160; &#160; &#160; &#160; except asyncio.CancelledError:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; break&lt;br/&gt;
&#160; &#160; &#160; &#160; except websockets.exceptions.ConnectionClosedOK:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; break&lt;br/&gt;
&#160; &#160; &#160; &#160; except Exception as e:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; print(f&quot;An error occurred in run_popen: {e}&quot;)&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;async def handle_client(websocket, path):&lt;br/&gt;
&#160; &#160; links.append(websocket)&lt;br/&gt;
&#160; &#160; global history_queue&lt;br/&gt;
&#160; &#160; global process&lt;br/&gt;
&#160; &#160; print(&quot;listening&quot;)&lt;/p&gt;

&lt;p&gt;&#160; &#160; # functions&lt;br/&gt;
&#160; &#160;&#160;&lt;br/&gt;
&#160; &#160;&#160;&lt;br/&gt;
&#160; &#160; try:&lt;br/&gt;
&#160; &#160; &#160; &#160; # send history chats to websocket client&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; for history_entry in history_queue:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; await websocket.send(history_entry)&lt;br/&gt;
&#160; &#160; &#160; &#160;&#160;&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; # listening messages from websocket client&lt;br/&gt;
&#160; &#160; &#160; &#160; while True:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; message = await websocket.recv()&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; print(f&quot;Message from Client: {message}&quot;)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; server_sender(message)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; server_order(message)&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; &#160; &#160; if message == &quot;stop&quot;:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; print(&quot;stopping...&quot;)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; if process:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; process.terminate()&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; break&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; elif message == &quot;restart&quot;:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; print(&quot;need restart&quot;)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; process.kill()&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; print(&quot;killed&quot;)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; process = subprocess.Popen(&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;bedrock_server.exe&amp;#39;&amp;#93;&lt;/span&gt;, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;text=True,encoding=encoding, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; &#160; &#160; elif message == &quot;/new_world&quot;:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; if process:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; process.terminate()&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; # create target folder&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; old_worlds_folder = &quot;old_worlds&quot;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; if not os.path.exists(old_worlds_folder):&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; os.makedirs(old_worlds_folder)&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; old_name = f&quot;old_world{count_subdirectories(old_worlds_folder) + 1}&quot;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; os.mkdir(old_name)&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; shutil.move(&quot;worlds/Bedrock level&quot;, os.path.join(old_worlds_folder, old_name))&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; if process:&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; process.communicate() &#160;# wait for process stop&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; wt = 3&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; for i in range(wt):&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; wt_msg = f&quot;restart afterwards {wt - i} sec&quot;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; print(wt_msg)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; await websocket.send(wt_msg)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; await asyncio.sleep(1) &#160;# wait a sec&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; process = subprocess.Popen(&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;bedrock_server.exe&amp;#39;&amp;#93;&lt;/span&gt;, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;text=True,encoding=encoding, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; await websocket.send(&quot;restart done&#65281;&quot;)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; print(&quot;restart done!&quot;)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#160;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#160;&lt;/p&gt;

&lt;p&gt;&#160; &#160; except websockets.exceptions.ConnectionClosedOK:&lt;br/&gt;
&#160; &#160; &#160; &#160; print(&quot;The websocket client has been closed&quot;)&lt;br/&gt;
&#160; &#160; &#160; &#160; await websocket.close()&lt;br/&gt;
&#160; &#160; &#160; &#160; links.remove(websocket)&lt;/p&gt;

&lt;p&gt;&#160; &#160; finally:&lt;br/&gt;
&#160; &#160; &#160; &#160; print(&quot;Closing websocket server&quot;)&lt;br/&gt;
&#160; &#160; &#160; &#160; await websocket.close()&lt;br/&gt;
&#160; &#160; &#160; &#160; links.remove(websocket)&lt;/p&gt;


&lt;p&gt;async def main():&lt;br/&gt;
&#160; &#160; print(&quot;subprocess main started&quot;)&lt;br/&gt;
&#160; &#160; print(&quot;powered by python&quot;)&lt;/p&gt;

&lt;p&gt;&#160; &#160; start_server_coroutine = websockets.serve(handle_client, &quot;xxx.xx.xxx.xx&quot;, 8765) # Connect your websocket client here, if you have one, otherwise ignore it&lt;br/&gt;
&#160; &#160;&#160;&lt;/p&gt;

&lt;p&gt;&#160; &#160; # create task and run it&lt;br/&gt;
&#160; &#160; websocket_task = asyncio.ensure_future(start_server_coroutine)&lt;br/&gt;
&#160; &#160;&#160;&lt;br/&gt;
&#160; &#160; # run functions on other thread&lt;br/&gt;
&#160; &#160; _thread.start_new_thread(run_popen,())&lt;br/&gt;
&#160; &#160; #_thread.start_new_thread(read_live,())&lt;br/&gt;
&#160; &#160; _thread.start_new_thread(run_scripts,()) # test sending&lt;/p&gt;

&lt;p&gt;&#160; &#160; await asyncio.Future()&lt;/p&gt;


&lt;p&gt;if _&lt;em&gt;name&lt;/em&gt;_ == &quot;_&lt;em&gt;main&lt;/em&gt;_&quot;:&lt;br/&gt;
&#160; &#160; try:&lt;br/&gt;
&#160; &#160; &#160; &#160; asyncio.run(main())&lt;br/&gt;
&#160; &#160; except Exception as e:&lt;br/&gt;
&#160; &#160; &#160; &#160; print(e)&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="559280" name="image-2024-01-14-11-31-50-317.png" size="199165" author="ArcherLee127chen" created="Sun, 14 Jan 2024 04:31:51 +0100"/>
                            <attachment id="559279" name="image-2024-01-14-11-33-39-088.png" size="279954" author="ArcherLee127chen" created="Sun, 14 Jan 2024 04:33:39 +0100"/>
                            <attachment id="559278" name="image-2024-01-14-11-37-51-737.png" size="6159" author="ArcherLee127chen" created="Sun, 14 Jan 2024 04:37:51 +0100"/>
                            <attachment id="559277" name="image-2024-01-14-11-38-06-542.png" size="8560" author="ArcherLee127chen" created="Sun, 14 Jan 2024 04:38:06 +0100"/>
                            <attachment id="559274" name="image-2024-01-14-12-01-48-503.png" size="101980" author="ArcherLee127chen" created="Sun, 14 Jan 2024 05:01:48 +0100"/>
                            <attachment id="559273" name="image-2024-01-14-12-02-25-195.png" size="7354" author="ArcherLee127chen" created="Sun, 14 Jan 2024 05:02:25 +0100"/>
                            <attachment id="559272" name="image-2024-01-14-12-06-00-898.png" size="101980" author="ArcherLee127chen" created="Sun, 14 Jan 2024 05:06:01 +0100"/>
                            <attachment id="559271" name="image-2024-01-14-12-06-28-403.png" size="19975" author="ArcherLee127chen" created="Sun, 14 Jan 2024 05:06:28 +0100"/>
                            <attachment id="559286" name="image-2024-01-14-17-45-56-736.png" size="414691" author="ArcherLee127chen" created="Sun, 14 Jan 2024 10:45:57 +0100"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                <customfield id="customfield_10500" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Confirmation Status</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10300"><![CDATA[Unconfirmed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_12700" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Description</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>[Briefly describe the bug here]&lt;br/&gt;
&lt;br/&gt;
*Steps to Reproduce:*&lt;br/&gt;
# [Step 1]&lt;br/&gt;
# [Step 2]&lt;br/&gt;
# [Step 3]&lt;br/&gt;
&lt;br/&gt;
*Observed Results:*&lt;br/&gt;
[Describe what happens]&lt;br/&gt;
&lt;br/&gt;
*Expected Results:*&lt;br/&gt;
[Describe what should happen]&lt;br/&gt;
&lt;br/&gt;
*Screenshots/Videos attached:* [please attach an image or short video]&lt;br/&gt;
&lt;br/&gt;
*Notes:*</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11700" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_11100" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>Linked</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_11600" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i2g1uv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    </customfields>
    </item>
</channel>
</rss>