<!-- 
RSS generated by JIRA (9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13) at Sat Jan 11 08:23:48 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-18964] Cannot call functions in a beforeEvent</title>
                <link>https://bugs.mojang.com/browse/BDS-18964</link>
                <project id="11700" key="BDS">Bedrock Dedicated Server</project>
                    <description>&lt;p&gt;Mojang please fix this, it is limiting us developers and causing immeasurable headaches. I&apos;m tired of having to come up with dumb workarounds that bloats my code, wrapping my code in a system.run() that doesn&apos;t work half the time, and giving up on some projects because I&apos;m unable to call some functions in a beforeEvent.&#160;&lt;/p&gt;

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

&lt;p&gt;Tested JS Code:&lt;br/&gt;
world.beforeEvents.playerLeave.subscribe(({ player }) =&amp;gt;&lt;/p&gt;

{ // teleporting a player back to spawn when they leave &#160; &#160; player.teleport(new Vector(0, 0, 0)) }

&lt;p&gt;)&lt;/p&gt;

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

&lt;p&gt;Affects @minecraft/server version 1.3.0-beta and up&lt;br/&gt;
&#160;&lt;br/&gt;
Expected Result: Player is teleported to 0, 0, 0 before they leave the realm.&lt;br/&gt;
Actual Result: &lt;span class=&quot;error&quot;&gt;&amp;#91;Scripting&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;error&amp;#93;&lt;/span&gt;-ReferenceError: Native function &lt;span class=&quot;error&quot;&gt;&amp;#91;Entity::teleport&amp;#93;&lt;/span&gt; does not have required privileges. &#160; &#160;at &amp;lt;anonymous&amp;gt; (main.js:33)&lt;br/&gt;
&#160;&lt;br/&gt;
Every function that sets something does not work in a beforeEvent.&lt;/p&gt;</description>
                <environment></environment>
        <key id="549097">BDS-18964</key>
            <summary>Cannot call functions in a beforeEvent</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="AncientNewJersey">AncientNewJersey</reporter>
                        <labels>
                    </labels>
                <created>Sun, 14 Jan 2024 05:56:35 +0100</created>
                <updated>Wed, 12 Jun 2024 08:47:10 +0200</updated>
                            <resolved>Wed, 12 Jun 2024 08:47:10 +0200</resolved>
                                    <version>1.20.51</version>
                                                            <votes>1</votes>
                                    <watches>0</watches>
                                                                            <comments>
                            <comment id="1330229" author="JIRAUSER615561" created="Tue, 11 Jun 2024 20:55:09 +0200"  >&lt;p&gt;It&apos;s by design for now that in a before event you can&apos;t run essentially any &quot;update functions&quot; in a before event, because the rest of the Minecraft infra is in an un-ideal state to be able to process those changes.&#160; The main thing is to wrap them in a system.run (which will typically run a half-tick later) in a before event, and you should ensure you &quot;re-fetch&quot; things like entity objects inside of that functions.. Definitely feel that this is somewhat painful..&lt;/p&gt;</comment>
                            <comment id="1330120" author="weszaj_waw" created="Tue, 11 Jun 2024 11:39:46 +0200"  >&lt;p&gt;Is this only happening on a Dedicated Server, Featured Server, realms, multiplayer or singleplayer? What platform/device are you using?&lt;br/&gt;
This ticket will automatically reopen when you reply.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </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|i2g1v3:</customfieldvalue>

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