fix(kubejs): update kubejs scripts
This commit is contained in:
parent
28a30d94c0
commit
57be389894
13 changed files with 921 additions and 251 deletions
|
|
@ -1,24 +1,29 @@
|
|||
// Makes Tickets of Eternal Keeping not consumed on death.
|
||||
|
||||
/** @type {Object<string, ?Internal.ItemStack>} */
|
||||
const tickets = {};
|
||||
|
||||
EntityEvents.death((event) => {
|
||||
// Register ticket on player death
|
||||
EntityEvents.death("player", (event) => {
|
||||
const player = event.player;
|
||||
if (event.entity.isPlayer()) {
|
||||
tickets[player.uuid] = null;
|
||||
const uuid = String(player.uuid);
|
||||
|
||||
player.inventory.allItems.forEach((item) => {
|
||||
if (item.nbt && item.nbt.EternalKeep) tickets[player.uuid] = item.copy();
|
||||
if (
|
||||
event.entity.isPlayer() &&
|
||||
String(player.level.dimension) !== "retards:adventure"
|
||||
) {
|
||||
tickets[uuid] = null;
|
||||
|
||||
iterateInventory(player, (item) => {
|
||||
if (item.nbt && item.nbt.get("EternalKeep")) tickets[uuid] = item.copy();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Give ticket on player respawn
|
||||
PlayerEvents.respawned((event) => {
|
||||
const player = event.player;
|
||||
const uuid = String(player.uuid);
|
||||
|
||||
const ticket = tickets[player.uuid];
|
||||
|
||||
if (ticket != null) player.give(Item.of(ticket, 1));
|
||||
|
||||
tickets[player.uuid] = null;
|
||||
const ticket = tickets[uuid];
|
||||
if (ticket) player.give(Item.of(ticket, 1));
|
||||
tickets[uuid] = null;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue