跳至主要內容

每開啟 10 次村莊中的戰利品箱後觸發

芒果凍布丁原創2025年5月25日小於 1 分鐘

const dataKey = "villageChestsOpened";
const maxOpenTimes = 10;

BlockEvents.rightClicked("chest", (event) => {
  const { player, block } = event;

  if (block.entityData.getString("LootTable").includes("chests/village/")) {
    player.persistentData.putLong(
      dataKey,
      player.persistentData.getLong(dataKey) + 1
    );
    player.tell("You've opened a village chest!");

    if (player.persistentData.getLong(dataKey) >= maxOpenTimes) {
      player.tell("  You've opened 10 village chests!");
      player.persistentData.putLong(dataKey, 0);
    }
  }
});
上次編輯於: 2025/5/25 上午2:00:55
貢獻者: Mango