1
0
Files

20 lines
459 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// priority: 0
// 玩家切换世界时设置为冒险模式(KubeJS Additions
onEvent('player.change_dimension', (event) => {
const evServer = event.getServer();
const evPlayer = event.getPlayer();
const player = evServer ? evServer.getPlayer(evPlayer) : null;
if (!player) {
console.error('自动切换游戏模式失败:找不到玩家');
return;
}
if (player.isCreativeMode()) {
player.setGameMode('adventure');
}
});