From 999ff2256c1384a5ca4db2e7069207127404cfff Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:59:25 +1000 Subject: Backend: Use event.cancel() over event.isCanceled = true for LorenzEvents (#1915) --- .../dungeon/DungeonBossHideDamageSplash.kt | 2 +- .../skyhanni/features/dungeon/DungeonCleanEnd.kt | 6 ++-- .../skyhanni/features/dungeon/DungeonHideItems.kt | 38 +++++++++++----------- .../features/dungeon/DungeonLividFinder.kt | 2 +- .../skyhanni/features/dungeon/TerracottaPhase.kt | 4 +-- 5 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/dungeon') diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt index 53f1b4f6b..166faccc1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt @@ -18,7 +18,7 @@ object DungeonBossHideDamageSplash { if (!DungeonAPI.inBossRoom) return if (DamageIndicatorManager.isDamageSplash(event.entity)) { - event.isCanceled = true + event.cancel() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt index 0e283c774..3b9f023d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt @@ -106,20 +106,20 @@ object DungeonCleanEnd { return } - event.isCanceled = true + event.cancel() } @SubscribeEvent fun onReceiveParticle(event: ReceiveParticleEvent) { if (shouldBlock()) { - event.isCanceled = true + event.cancel() } } @SubscribeEvent fun onPlaySound(event: PlaySoundEvent) { if (shouldBlock() && !chestsSpawned && event.soundName.startsWith("note.")) { - event.isCanceled = true + event.cancel() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt index f80063303..9d2c531a5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt @@ -65,11 +65,11 @@ object DungeonHideItems { if (entity is EntityItem) { val stack = entity.entityItem if (config.hideReviveStone && stack.cleanName() == "Revive Stone") { - event.isCanceled = true + event.cancel() } if (config.hideJournalEntry && stack.cleanName() == "Journal Entry") { - event.isCanceled = true + event.cancel() } } @@ -79,44 +79,44 @@ object DungeonHideItems { val skullTexture = head?.getSkullTexture() if (config.hideSuperboomTNT) { if (entity.name.startsWith("§9Superboom TNT")) { - event.isCanceled = true + event.cancel() } if (head != null && head.cleanName() == "Superboom TNT") { - event.isCanceled = true + event.cancel() hideParticles[entity] = System.currentTimeMillis() } } if (config.hideBlessing) { if (entity.name.startsWith("§dBlessing of ")) { - event.isCanceled = true + event.cancel() } if (skullTexture == BLESSING_TEXTURE) { - event.isCanceled = true + event.cancel() } } if (config.hideReviveStone) { if (entity.name == "§6Revive Stone") { - event.isCanceled = true + event.cancel() } if (skullTexture == REVIVE_STONE_TEXTURE) { - event.isCanceled = true + event.cancel() hideParticles[entity] = System.currentTimeMillis() } } if (config.hidePremiumFlesh) { if (entity.name == "§9Premium Flesh") { - event.isCanceled = true + event.cancel() hideParticles[entity] = System.currentTimeMillis() } if (skullTexture == PREMIUM_FLESH_TEXTURE) { - event.isCanceled = true + event.cancel() } } @@ -127,15 +127,15 @@ object DungeonHideItems { if (lastMove + 100 > System.currentTimeMillis()) { return } - event.isCanceled = true + event.cancel() } } if (config.hideHealerOrbs) { when { - entity.name.startsWith("§c§lDAMAGE §e") -> event.isCanceled = true - entity.name.startsWith("§c§lABILITY DAMAGE §e") -> event.isCanceled = true - entity.name.startsWith("§a§lDEFENSE §e") -> event.isCanceled = true + entity.name.startsWith("§c§lDAMAGE §e") -> event.cancel() + entity.name.startsWith("§c§lABILITY DAMAGE §e") -> event.cancel() + entity.name.startsWith("§a§lDEFENSE §e") -> event.cancel() } when (skullTexture) { @@ -143,7 +143,7 @@ object DungeonHideItems { SUPPORT_ORB_TEXTURE, DAMAGE_ORB_TEXTURE, -> { - event.isCanceled = true + event.cancel() hideParticles[entity] = System.currentTimeMillis() return } @@ -153,14 +153,14 @@ object DungeonHideItems { if (config.hideHealerFairy) { // Healer Fairy texture is stored in id 0, not id 4 for some reasos. if (entity.inventory[0]?.getSkullTexture() == HEALER_FAIRY_TEXTURE) { - event.isCanceled = true + event.cancel() return } } if (config.hideSoulweaverSkulls) { if (skullTexture == SOUL_WEAVER_HIDER) { - event.isCanceled = true + event.cancel() return } } @@ -176,10 +176,10 @@ object DungeonHideItems { val distance = packetLocation.distance(armorStand.getLorenzVec()) if (distance < 2) { if (event.type == EnumParticleTypes.FIREWORKS_SPARK) { - event.isCanceled = true + event.cancel() } if (event.type == EnumParticleTypes.REDSTONE) { - event.isCanceled = true + event.cancel() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt index 0743aafc9..989368595 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt @@ -119,7 +119,7 @@ object DungeonLividFinder { if (entity != livid && entity != lividArmorStand) { if (entity.name.contains("Livid")) { - event.isCanceled = true + event.cancel() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt index dbc9bcdaa..14e359c29 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt @@ -33,14 +33,14 @@ object TerracottaPhase { @SubscribeEvent(priority = EventPriority.HIGH) fun onRenderLiving(event: SkyHanniRenderEntityEvent.Specials.Pre) { if (isActive() && config.hideDamageSplash && DamageIndicatorManager.isDamageSplash(event.entity)) { - event.isCanceled = true + event.cancel() } } @SubscribeEvent fun onReceiveParticle(event: ReceiveParticleEvent) { if (isActive() && config.hideParticles) { - event.isCanceled = true + event.cancel() } } -- cgit