diff options
| author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-06-07 12:59:25 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-07 12:59:25 +1000 |
| commit | 999ff2256c1384a5ca4db2e7069207127404cfff (patch) | |
| tree | 0627f6370b1f94d2697ed1af7827046e75c880c9 /src/main/java | |
| parent | 0d4efbd22a8ee629fe2f504fe3aa7acb78a66a2e (diff) | |
| download | skyhanni-999ff2256c1384a5ca4db2e7069207127404cfff.tar.gz skyhanni-999ff2256c1384a5ca4db2e7069207127404cfff.tar.bz2 skyhanni-999ff2256c1384a5ca4db2e7069207127404cfff.zip | |
Backend: Use event.cancel() over event.isCanceled = true for LorenzEvents (#1915)
Diffstat (limited to 'src/main/java')
63 files changed, 108 insertions, 109 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt index 359d23f75..15c52b009 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt @@ -107,7 +107,7 @@ object GetFromSackAPI { if (event.clickedButton != 1) return // filter none right clicks addToQueue(inventoryMap[event.slotId] ?: return) inventoryMap.remove(event.slotId) - event.isCanceled = true + event.cancel() } @SubscribeEvent @@ -130,11 +130,11 @@ object GetFromSackAPI { queuedHandler(replacedEvent) bazaarHandler(replacedEvent) if (replacedEvent.isCanceled) { - event.isCanceled = true + event.cancel() return } if (replacedEvent !== event) { - event.isCanceled = true + event.cancel() ChatUtils.sendMessageToServer(replacedEvent.message) } } @@ -152,7 +152,7 @@ object GetFromSackAPI { CommandResult.WRONG_AMOUNT -> ChatUtils.userError("Invalid amount!") CommandResult.INTERNAL_ERROR -> {} } - event.isCanceled = true + event.cancel() } private fun bazaarHandler(event: MessageSendToServerEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt index ef032f6fc..a3991aa7c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt @@ -108,7 +108,7 @@ object ChatManager { originatingModContainer ).postAndCatch() ) { - event.isCanceled = true + event.cancel() messageHistory[IdentityCharacteristics(component)] = result.copy(actionKind = ActionKind.OUTGOING_BLOCKED) } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt index d74deb777..bf9980084 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt @@ -37,7 +37,7 @@ object MinecraftData { packet.volume ).postAndCatch() ) { - event.isCanceled = true + event.cancel() } } @@ -63,7 +63,7 @@ object MinecraftData { packet.particleArgs, ).postAndCatch() ) { - event.isCanceled = true + event.cancel() } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/TitleData.kt b/src/main/java/at/hannibal2/skyhanni/data/TitleData.kt index 91203cbca..2a7da7902 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TitleData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TitleData.kt @@ -17,7 +17,7 @@ object TitleData { val message = packet.message ?: return val formattedText = message.formattedText if (TitleReceivedEvent(formattedText).postAndCatch()) { - event.isCanceled = true + event.cancel() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt index aaaa1dd2e..48aea06e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt @@ -69,7 +69,6 @@ abstract class LorenzEvent : Event() { fun postWithoutCatch() = MinecraftForge.EVENT_BUS.post(this) - // TODO let walker use this function for all 101 other uses fun cancel() { isCanceled = true } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/HideDamageSplash.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/HideDamageSplash.kt index 6bc0094e3..215d4a0a3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/HideDamageSplash.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/HideDamageSplash.kt @@ -19,7 +19,7 @@ object HideDamageSplash { if (!SkyHanniMod.feature.combat.hideDamageSplash) return if (DamageIndicatorManager.isDamageSplash(event.entity)) { - event.isCanceled = true + event.cancel() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt index 21a70fe4e..58455cee7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt @@ -870,7 +870,7 @@ class DamageIndicatorManager { if (entityData != null) { if (config.hideDamageSplash) { - event.isCanceled = true + event.cancel() } if (entityData.bossType == BossType.DUMMY) { val uuid = entity.uniqueID @@ -887,7 +887,7 @@ class DamageIndicatorManager { if (name.contains("Overflux")) return if (name.contains("Mana Flux")) return if (name.contains("Radiant")) return - event.isCanceled = true + event.cancel() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AshfangMinisNametagHider.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AshfangMinisNametagHider.kt index 53c5d9650..55c3f7833 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AshfangMinisNametagHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AshfangMinisNametagHider.kt @@ -25,7 +25,7 @@ object AshfangMinisNametagHider { val name = entity.name if (name.contains("§cArachne's Brood§r")) { - event.isCanceled = true + event.cancel() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt index 09626067c..ba65fac3a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt @@ -13,7 +13,7 @@ object SendCoordinatedCommand { fun onMessageSendToServer(event: MessageSendToServerEvent) { val message = event.message if (message.startsWith("/sendcoords")) { - event.isCanceled = true + event.cancel() val description = message.substringAfter("/sendcoords").trim() sendCoordinates(description) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt index 401ac7fbb..e3d6a5713 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt @@ -34,7 +34,7 @@ object ViewRecipeCommand { group("item").uppercase().replace(" ", "_") } ?: return - event.isCanceled = true + event.cancel() HypixelCommands.viewRecipe(item) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt index e49ca5152..b78e6cf63 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt @@ -16,7 +16,7 @@ object WarpIsCommand { if (!SkyHanniMod.feature.misc.commands.replaceWarpIs) return if (event.message.lowercase() == "/warp is") { - event.isCanceled = true + event.cancel() HypixelCommands.island() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt index 880bd5a69..b8e14d280 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt @@ -38,7 +38,7 @@ object WikiManager { val message = event.message.lowercase() if (!(message.startsWith("/wiki"))) return - event.isCanceled = true + event.cancel() if (message == "/wiki") { sendWikiMessage() return 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() } |
