diff options
author | Linnea Gräf <nea@nea.moe> | 2024-04-18 13:32:40 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-04-18 13:32:40 +0200 |
commit | 12f7f03344decf77d96997bf2d4898c6b978bb3c (patch) | |
tree | ed9d29ad18498ff524a88a893818b390129a88f3 /src/main | |
parent | c405a779bb12dd8e07d85623ce5e1e2ad903afe1 (diff) | |
download | LocalTransactionLedger-12f7f03344decf77d96997bf2d4898c6b978bb3c.tar.gz LocalTransactionLedger-12f7f03344decf77d96997bf2d4898c6b978bb3c.tar.bz2 LocalTransactionLedger-12f7f03344decf77d96997bf2d4898c6b978bb3c.zip |
Add kistmet reroll tracker
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/moe/nea/ledger/DungeonChestDetection.kt | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/src/main/java/moe/nea/ledger/DungeonChestDetection.kt b/src/main/java/moe/nea/ledger/DungeonChestDetection.kt index 1cdc2d9..2418354 100644 --- a/src/main/java/moe/nea/ledger/DungeonChestDetection.kt +++ b/src/main/java/moe/nea/ledger/DungeonChestDetection.kt @@ -17,7 +17,24 @@ class DungeonChestDetection(val logger: LedgerLogger) { } }, Damage: 0s - }*/ + } + + { + id: "minecraft:feather", + Count: 1b, + tag: { + overrideMeta: 1b, + ench: [], + HideFlags: 254, + display: { + Lore: ["§7Consume a §9Kismet Feather §7to reroll", "§7the loot within this chest.", "", "§7You may only use a feather once", "§7per dungeon run.", "", "§eClick to reroll this chest!"], + Name: "§aReroll Chest" + }, + AttributeModifiers: [] + }, + Damage: 0s +} + */ val costPattern = Pattern.compile("(?<cost>$SHORT_NUMBER_PATTERN) Coins") @@ -30,7 +47,25 @@ class DungeonChestDetection(val logger: LedgerLogger) { var lastOpenedChest: ChestCost? = null @SubscribeEvent - fun onSlotClick(event: GuiClickEvent) { + fun onKismetClick(event: GuiClickEvent) { + val slot = event.slotIn ?: return + if (!slot.inventory.displayName.unformattedText.unformattedString().endsWith(" Chest")) return + val stack = slot.stack ?: return + if (stack.getDisplayNameU() == "§aReroll Chest") { + logger.logEntry( + LedgerEntry( + "KISMET_REROLL", + Instant.now(), + 0.0, + itemId = "KISMET_FEATHER", + itemAmount = 1 + ) + ) + } + } + + @SubscribeEvent + fun onRewardChestClick(event: GuiClickEvent) { val slot = event.slotIn ?: return if (!slot.inventory.displayName.unformattedText.unformattedString().endsWith(" Chest")) return val stack = slot.stack ?: return |