fix(lobby_transfer): replace removed @minecraft/server-admin transferPlayer with stable Player.transfer
All checks were successful
Deploy Addons / deploy (push) Successful in 15s
All checks were successful
Deploy Addons / deploy (push) Successful in 15s
Bedrock 1.26 rejects the @minecraft/server-admin 1.0.0-beta dependency at pack load, which was crashing mc-lobby on boot (exit 1 right after pack stack + block-version logging). The transferPlayer helper has been part of the stable @minecraft/server API as Player.transfer since 1.21, so we can drop the server-admin import and dependency entirely. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,10 +26,6 @@
|
|||||||
"module_name": "@minecraft/server",
|
"module_name": "@minecraft/server",
|
||||||
"version": "1.17.0"
|
"version": "1.17.0"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"module_name": "@minecraft/server-admin",
|
|
||||||
"version": "1.0.0-beta"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"uuid": "b2c3d4e5-1111-2222-3333-fedcba654321",
|
"uuid": "b2c3d4e5-1111-2222-3333-fedcba654321",
|
||||||
"version": [1, 0, 0]
|
"version": [1, 0, 0]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { world, system } from "@minecraft/server";
|
import { world, system } from "@minecraft/server";
|
||||||
import { transferPlayer } from "@minecraft/server-admin";
|
|
||||||
|
|
||||||
// Portal block → transfer target mapping (custom blocks — priority detection)
|
// Portal block → transfer target mapping (custom blocks — priority detection)
|
||||||
const PORTAL_BLOCKS = {
|
const PORTAL_BLOCKS = {
|
||||||
@@ -93,10 +92,11 @@ system.runInterval(() => {
|
|||||||
safePos.z += 4; // Move 4 blocks away from portals (portals are at z=-24)
|
safePos.z += 4; // Move 4 blocks away from portals (portals are at z=-24)
|
||||||
player.teleport(safePos);
|
player.teleport(safePos);
|
||||||
|
|
||||||
// Wait 5 ticks for position to save, then transfer
|
// Wait 5 ticks for position to save, then transfer.
|
||||||
|
// Player.transfer replaces the removed @minecraft/server-admin `transferPlayer`.
|
||||||
system.runTimeout(() => {
|
system.runTimeout(() => {
|
||||||
try {
|
try {
|
||||||
transferPlayer(player, { hostname: portal.host, port: portal.port });
|
player.transfer({ hostname: portal.host, port: portal.port });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
player.sendMessage(`§cTransfer failed: ${e.message}`);
|
player.sendMessage(`§cTransfer failed: ${e.message}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user