diff options
author | Walker Selby <git@walkerselby.com> | 2023-09-29 11:30:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-29 20:30:27 +0200 |
commit | 343d5d9cea12beaf7a8dfabda2f61ad940be592a (patch) | |
tree | ceb0a82790eaa1a1babfe4a2e05220378037a748 /src/main/java/at/hannibal2/skyhanni/features/misc | |
parent | b364b6da62668ea44dfc23180fe70c13ec707804 (diff) | |
download | skyhanni-343d5d9cea12beaf7a8dfabda2f61ad940be592a.tar.gz skyhanni-343d5d9cea12beaf7a8dfabda2f61ad940be592a.tar.bz2 skyhanni-343d5d9cea12beaf7a8dfabda2f61ad940be592a.zip |
Random Code Cleanup (#516)
Sonar Lint for the win #516
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
13 files changed, 108 insertions, 164 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ChumBucketHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ChumBucketHider.kt index c4c071a19..4c320c751 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ChumBucketHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ChumBucketHider.kt @@ -60,15 +60,13 @@ class ChumBucketHider { } // Chum Bucket - if (config.hideBucket.get()) { - if (entity.inventory.any { it != null && (it.name == "§fEmpty Chum Bucket" || it.name == "§aEmpty Chumcap Bucket")}) { - val entityLocation = entity.getLorenzVec() - for (title in titleEntity) { - if (entityLocation.equalsIgnoreY(title.getLorenzVec())) { - hiddenEntities.add(entity) - event.isCanceled = true - return - } + if (config.hideBucket.get() && entity.inventory.any { it != null && (it.name == "§fEmpty Chum Bucket" || it.name == "§aEmpty Chumcap Bucket") }) { + val entityLocation = entity.getLorenzVec() + for (title in titleEntity) { + if (entityLocation.equalsIgnoreY(title.getLorenzVec())) { + hiddenEntities.add(entity) + event.isCanceled = true + return } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt index 671097085..fb74409ab 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt @@ -50,15 +50,12 @@ class CollectionTracker { val rawName = fixTypo(args.joinToString(" ").lowercase().replace("_", " ")) if (rawName == "gemstone") { LorenzUtils.chat("§c[SkyHanni] Gemstone collection is not supported!") -// setNewCollection("GEMSTONE_COLLECTION", "Gemstone") return } else if (rawName == "mushroom") { LorenzUtils.chat("§c[SkyHanni] Mushroom collection is not supported!") -// setNewCollection("MUSHROOM_COLLECTION", "Mushroom") return } -// val foundInternalName = NEUItems.getInternalNameOrNullIgnoreCase(rawName) ?: rawName.replace(" ", "_") val foundInternalName = NEUItems.getInternalNameOrNullIgnoreCase(rawName) if (foundInternalName == null) { LorenzUtils.chat("§c[SkyHanni] Item '$rawName' does not exist!") @@ -172,21 +169,17 @@ class CollectionTracker { val currentlyInInventory = countCurrentlyInInventory() val diff = currentlyInInventory - lastAmountInInventory - if (diff != 0) { - if (diff > 0) { + if (diff != 0 && diff > 0) { gainItems(diff) - } } lastAmountInInventory = currentlyInInventory } private fun updateGain() { - if (recentGain != 0) { - if (System.currentTimeMillis() > lastGainTime + RECENT_GAIN_TIME) { - recentGain = 0 - updateDisplay() - } + if (recentGain != 0 && System.currentTimeMillis() > lastGainTime + RECENT_GAIN_TIME) { + recentGain = 0 + updateDisplay() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt index 7f7a0cc91..3a9a47830 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt @@ -29,10 +29,8 @@ class JoinCrystalHollows { LorenzUtils.chat("§e[SkyHanni] Buy a §2Crystal Hollows Pass §efrom §5Gwendolyn") } } - if (message == "§e[NPC] §5Gwendolyn§f: §rGreat! Now hop on into the Minecart and I'll get you on your way!") { - if (inTime()) { - LorenzUtils.clickableChat("§e[SkyHanni] Click here to warp to Crystal Hollows!", "warp ch") - } + if (message == "§e[NPC] §5Gwendolyn§f: §rGreat! Now hop on into the Minecart and I'll get you on your way!" && inTime()) { + LorenzUtils.clickableChat("§e[SkyHanni] Click here to warp to Crystal Hollows!", "warp ch") } } @@ -40,10 +38,8 @@ class JoinCrystalHollows { fun onIslandChange(event: IslandChangeEvent) { if (!isEnabled()) return - if (event.newIsland == IslandType.DWARVEN_MINES) { - if (inTime()) { + if (event.newIsland == IslandType.DWARVEN_MINES && inTime()) { LorenzUtils.chat("§e[SkyHanni] Buy a §2Crystal Hollows Pass §efrom §5Gwendolyn§e!") - } } if (event.newIsland == IslandType.CRYSTAL_HOLLOWS) { lastWrongPassTime = 0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt index 4b177722d..0e88420c6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt @@ -17,31 +17,23 @@ class ParticleHider { @SubscribeEvent fun onHypExplosions(event: ReceiveParticleEvent) { val distanceToPlayer = event.distanceToPlayer - if (SkyHanniMod.feature.misc.hideFarParticles) { - if (distanceToPlayer > 40 && !inM7Boss()) { - event.isCanceled = true - return - } + if (SkyHanniMod.feature.misc.hideFarParticles && distanceToPlayer > 40 && !inM7Boss()) { + event.isCanceled = true + return } val type = event.type - if (SkyHanniMod.feature.misc.hideCloseRedstoneparticles) { - if (type == EnumParticleTypes.REDSTONE) { - if (distanceToPlayer < 2) { - event.isCanceled = true - return - } - } + if (SkyHanniMod.feature.misc.hideCloseRedstoneparticles && type == EnumParticleTypes.REDSTONE && distanceToPlayer < 2) { + event.isCanceled = true + return } - if (SkyHanniMod.feature.misc.hideFireballParticles) { - if (type == EnumParticleTypes.SMOKE_NORMAL || type == EnumParticleTypes.SMOKE_LARGE) { - for (entity in EntityUtils.getEntities<EntitySmallFireball>()) { - val distance = entity.getLorenzVec().distance(event.location) - if (distance < 5) { - event.isCanceled = true - return - } + if (SkyHanniMod.feature.misc.hideFireballParticles && (type == EnumParticleTypes.SMOKE_NORMAL || type == EnumParticleTypes.SMOKE_LARGE)) { + for (entity in EntityUtils.getEntities<EntitySmallFireball>()) { + val distance = entity.getLorenzVec().distance(event.location) + if (distance < 5) { + event.isCanceled = true + return } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt index b4a0ec53f..e59ccab3b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt @@ -140,7 +140,6 @@ object QuickModMenuSwitch { when (mod.command) { "patcher" -> { println("try opening patcher") - // GuiUtil.open(Objects.requireNonNull(Patcher.instance.getPatcherConfig().gui())) val patcher = Class.forName("club.sk1er.patcher.Patcher") val instance = patcher.getDeclaredField("instance").get(null) val config = instance.javaClass.getDeclaredMethod("getPatcherConfig").invoke(instance) @@ -159,7 +158,6 @@ object QuickModMenuSwitch { "hytil" -> { println("try opening hytil") - // HytilsReborn.INSTANCE.getConfig().openGui() val hytilsReborn = Class.forName("cc.woverflow.hytils.HytilsReborn") val instance = hytilsReborn.getDeclaredField("INSTANCE").get(null) val config = instance.javaClass.getDeclaredMethod("getConfig").invoke(instance) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt index 610acc9a2..f87e249a4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt @@ -26,9 +26,7 @@ class ServerRestartTitle { val minutes = group("minutes").toInt() val seconds = group("seconds").toInt() val totalSeconds = minutes * 60 + seconds - if (totalSeconds > 120) { - if (totalSeconds % 30 != 0) return - } + if (totalSeconds > 120 && totalSeconds % 30 != 0) return val time = TimeUtils.formatDuration(totalSeconds.toLong() * 1000) TitleUtils.sendTitle("§cServer Restart in §b$time", 2.seconds) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt index 611a40853..5999b3c62 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt @@ -276,18 +276,14 @@ object GhostCounter { val res = current.formatNumber().toString() gain = (res.toLong() - lastXp.toLong()).toDouble().roundToInt() num = (gain.toDouble() / gained) - if (gained in 150.0..450.0) { - if (lastXp != "0") { - if (num >= 0) { - KILLS.add(num) - KILLS.add(num, true) - Option.GHOSTSINCESORROW.add(num) - Option.KILLCOMBO.add(num) - Option.SKILLXPGAINED.add(gained * num.roundToLong()) - Option.SKILLXPGAINED.add(gained * num.roundToLong(), true) - hidden?.bestiaryCurrentKill = hidden?.bestiaryCurrentKill?.plus(num) ?: num - } - } + if (gained in 150.0..450.0 && lastXp != "0" && num >= 0) { + KILLS.add(num) + KILLS.add(num, true) + Option.GHOSTSINCESORROW.add(num) + Option.KILLCOMBO.add(num) + Option.SKILLXPGAINED.add(gained * num.roundToLong()) + Option.SKILLXPGAINED.add(gained * num.roundToLong(), true) + hidden?.bestiaryCurrentKill = hidden?.bestiaryCurrentKill?.plus(num) ?: num } lastXp = res } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt index bc5380f81..94d5b4eeb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt @@ -642,8 +642,8 @@ object EstimatedItemValue { // efficiency 1-5 is cheap, 6-10 is handled by silex if (rawName == "efficiency") continue - if (rawName == "scavenger" && rawLevel == 5) { - if (internalName in hasAlwaysScavenger) continue + if (rawName == "scavenger" && rawLevel == 5 && internalName in hasAlwaysScavenger) { + continue } var level = rawLevel diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/PlayerTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/PlayerTabComplete.kt index 27430c5de..28c9733a4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/PlayerTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/PlayerTabComplete.kt @@ -55,38 +55,29 @@ object PlayerTabComplete { return buildList { - if (config.friends) { - if (PlayerCategory.FRIENDS !in ignored) { - FriendAPI.getAllFriends().filter { it.bestFriend || !config.onlyBestFriends } - .forEach { add(it.name) } - } + if (config.friends && PlayerCategory.FRIENDS !in ignored) { + FriendAPI.getAllFriends().filter { it.bestFriend || !config.onlyBestFriends } + .forEach { add(it.name) } } - if (config.islandPlayers) { - if (PlayerCategory.ISLAND_PLAYERS !in ignored) { - for (entity in Minecraft.getMinecraft().theWorld.playerEntities) { - if (!entity.isNPC() && entity is EntityOtherPlayerMP) { - add(entity.name) - } + if (config.islandPlayers && PlayerCategory.ISLAND_PLAYERS !in ignored) { + for (entity in Minecraft.getMinecraft().theWorld.playerEntities) { + if (!entity.isNPC() && entity is EntityOtherPlayerMP) { + add(entity.name) } } } - if (config.party) { - if (PlayerCategory.PARTY !in ignored) { - for (member in PartyAPI.partyMembers) { - add(member) - } + if (config.party && PlayerCategory.PARTY !in ignored) { + for (member in PartyAPI.partyMembers) { + add(member) } - } - if (config.vipVisits) { - if (command == "visit") { - vipVisitsJson?.let { - for (visit in it.vipVisits) { - add(visit) - } + if (config.vipVisits && command == "visit") { + vipVisitsJson?.let { + for (visit in it.vipVisits) { + add(visit) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt index be912f393..8d7c52c7b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt @@ -27,10 +27,8 @@ class TiaRelayHelper { if (!LorenzUtils.inSkyBlock) return val soundName = event.soundName - if (config.tiaRelayMute) { - if (soundName == "mob.wolf.whine") { - event.isCanceled = true - } + if (config.tiaRelayMute && soundName == "mob.wolf.whine") { + event.isCanceled = true } if (!config.soundHelper) return @@ -114,13 +112,11 @@ class TiaRelayHelper { return } - if (!sounds.contains(slotNumber)) { - if (stack.getLore().any { it.contains("Hear!") }) { - event.stackTip = "Hear!" - event.offsetX = 5 - event.offsetY = -5 - return - } + if (!sounds.contains(slotNumber) && stack.getLore().any { it.contains("Hear!") }) { + event.stackTip = "Hear!" + event.offsetX = 5 + event.offsetY = -5 + return } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index 336a987fc..fab56b5af 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -69,13 +69,11 @@ object TrevorFeatures { fixedRateTimer(name = "skyhanni-update-trapper", period = 1000L) { Minecraft.getMinecraft().addScheduledTask { try { - if (config.trapperSolver) { - if (onFarmingIsland()) { - updateTrapper() - TrevorTracker.saveAndUpdate() - TrevorTracker.calculatePeltsPerHour() - if (questActive) TrevorSolver.findMob() - } + if (config.trapperSolver && onFarmingIsland()) { + updateTrapper() + TrevorTracker.saveAndUpdate() + TrevorTracker.calculatePeltsPerHour() + if (questActive) TrevorSolver.findMob() } } catch (error: Throwable) { CopyErrorCommand.logError(error, "Encountered an error when updating the trapper solver") @@ -137,11 +135,9 @@ object TrevorFeatures { val siblings = event.chatComponent.siblings for (sibling in siblings) { - if (sibling.chatStyle.chatClickEvent != null) { - if (sibling.chatStyle.chatClickEvent.value.contains("YES")) { - lastChatPromptTime = System.currentTimeMillis() - lastChatPrompt = sibling.chatStyle.chatClickEvent.value.drop(1) - } + if (sibling.chatStyle.chatClickEvent != null && sibling.chatStyle.chatClickEvent.value.contains("YES")) { + lastChatPromptTime = System.currentTimeMillis() + lastChatPrompt = sibling.chatStyle.chatClickEvent.value.drop(1) } } } @@ -220,14 +216,12 @@ object TrevorFeatures { var entityTrapper = Minecraft.getMinecraft().theWorld.getEntityByID(trapperID) if (entityTrapper !is EntityLivingBase) entityTrapper = Minecraft.getMinecraft().theWorld.getEntityByID(backupTrapperID) - if (entityTrapper is EntityLivingBase) { - if (config.trapperTalkCooldown) { - RenderLivingEntityHelper.setEntityColor(entityTrapper, currentStatus.color) - { config.trapperTalkCooldown } - entityTrapper.getLorenzVec().let { - if (it.distanceToPlayer() < 15) { - event.drawString(it.add(0.0, 2.23, 0.0), currentLabel) - } + if (entityTrapper is EntityLivingBase && config.trapperTalkCooldown) { + RenderLivingEntityHelper.setEntityColor(entityTrapper, currentStatus.color) + { config.trapperTalkCooldown } + entityTrapper.getLorenzVec().let { + if (it.distanceToPlayer() < 15) { + event.drawString(it.add(0.0, 2.23, 0.0), currentLabel) } } } @@ -261,14 +255,12 @@ object TrevorFeatures { if (NEUItems.neuHasFocus()) return val key = if (Keyboard.getEventKey() == 0) Keyboard.getEventCharacter().code + 256 else Keyboard.getEventKey() if (config.keyBindWarpTrapper == key) { - if (lastChatPromptTime != -1L && config.acceptQuest && !questActive) { - if (System.currentTimeMillis() - 200 > lastChatPromptTime && System.currentTimeMillis() < lastChatPromptTime + 5000) { - lastChatPromptTime = -1L - LorenzUtils.sendCommandToServer(lastChatPrompt) - lastChatPrompt = "" - timeLastWarped = System.currentTimeMillis() - return - } + if (lastChatPromptTime != -1L && config.acceptQuest && !questActive && System.currentTimeMillis() - 200 > lastChatPromptTime && System.currentTimeMillis() < lastChatPromptTime + 5000) { + lastChatPromptTime = -1L + LorenzUtils.sendCommandToServer(lastChatPrompt) + lastChatPrompt = "" + timeLastWarped = System.currentTimeMillis() + return } if (System.currentTimeMillis() - timeLastWarped > 3000 && config.warpToTrapper) { if (System.currentTimeMillis() < teleportBlock + 5000) return @@ -283,10 +275,8 @@ object TrevorFeatures { if (!inTrapperDen()) return if (!config.trapperTalkCooldown) return val entity = event.entity - if (entity is EntityArmorStand) { - if (entity.name == "§e§lCLICK") { - event.isCanceled = true - } + if (entity is EntityArmorStand && entity.name == "§e§lCLICK") { + event.isCanceled = true } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt index f5d87d5e6..f86ea9087 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt @@ -53,33 +53,31 @@ object TrevorSolver { val name = entity.name val entityHealth = if (entity is EntityLivingBase) entity.baseMaxHealth.derpy() else 0 currentMob = TrevorMobs.entries.firstOrNull { it.mobName.contains(name) } - if (animalHealths.any { it == entityHealth }) { - if (currentMob != null) { - if (foundID == entity.entityId) { - val dist = entity.position.toLorenzVec().distanceToPlayer() - if ((currentMob == TrevorMobs.RABBIT || currentMob == TrevorMobs.SHEEP) && mobLocation == CurrentMobArea.OASIS) { - println("This is unfortunate") - } else canSee = LocationUtils.canSee( - LocationUtils.playerEyeLocation(), - entity.position.toLorenzVec().add(0.0, 0.5, 0.0) - ) && dist < currentMob!!.renderDistance + if (animalHealths.any { it == entityHealth } && currentMob != null) { + if (foundID == entity.entityId) { + val dist = entity.position.toLorenzVec().distanceToPlayer() + if ((currentMob == TrevorMobs.RABBIT || currentMob == TrevorMobs.SHEEP) && mobLocation == CurrentMobArea.OASIS) { + println("This is unfortunate") + } else canSee = LocationUtils.canSee( + LocationUtils.playerEyeLocation(), + entity.position.toLorenzVec().add(0.0, 0.5, 0.0) + ) && dist < currentMob!!.renderDistance - if (!canSee) { - val nameTagEntity = Minecraft.getMinecraft().theWorld.getEntityByID(foundID + 1) - if (nameTagEntity is EntityArmorStand) canSee = true - } - if (canSee) { - if (mobLocation != CurrentMobArea.FOUND) { - TitleUtils.sendTitle("§2Saw ${currentMob!!.mobName}!", 3.seconds) - } - mobLocation = CurrentMobArea.FOUND - mobCoordinates = entity.position.toLorenzVec() + if (!canSee) { + val nameTagEntity = Minecraft.getMinecraft().theWorld.getEntityByID(foundID + 1) + if (nameTagEntity is EntityArmorStand) canSee = true + } + if (canSee) { + if (mobLocation != CurrentMobArea.FOUND) { + TitleUtils.sendTitle("§2Saw ${currentMob!!.mobName}!", 3.seconds) } - } else { - foundID = entity.entityId + mobLocation = CurrentMobArea.FOUND + mobCoordinates = entity.position.toLorenzVec() } - return + } else { + foundID = entity.entityId } + return } } if (foundID != -1) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt index 18620137b..9d68aebde 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt @@ -66,16 +66,14 @@ class GuiOptionEditorUpdateCheck(option: ProcessedOption) : GuiOptionEditor(opti override fun mouseInput(x: Int, y: Int, width: Int, mouseX: Int, mouseY: Int): Boolean { val width = width - 20 - if (Mouse.getEventButtonState()) { - if ((mouseX - getButtonPosition(width) - x) in (0..button.width) && (mouseY - 10 - y) in (0..button.height)) { - when (UpdateManager.updateState) { - UpdateManager.UpdateState.AVAILABLE -> UpdateManager.queueUpdate() - UpdateManager.UpdateState.QUEUED -> {} - UpdateManager.UpdateState.DOWNLOADED -> {} - UpdateManager.UpdateState.NONE -> UpdateManager.checkUpdate() - } - return true + if (Mouse.getEventButtonState() && (mouseX - getButtonPosition(width) - x) in (0..button.width) && (mouseY - 10 - y) in (0..button.height)) { + when (UpdateManager.updateState) { + UpdateManager.UpdateState.AVAILABLE -> UpdateManager.queueUpdate() + UpdateManager.UpdateState.QUEUED -> {} + UpdateManager.UpdateState.DOWNLOADED -> {} + UpdateManager.UpdateState.NONE -> UpdateManager.checkUpdate() } + return true } return false } |