From ba9c370c88f02b3bffff97d0a347e1c29f847d02 Mon Sep 17 00:00:00 2001 From: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Date: Tue, 27 Jun 2023 18:26:40 +1000 Subject: Fix pv not having a skyblock check (#716) Co-authored-by: nea --- .../commands/misc/ProfileViewerCommands.kt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/main/kotlin/io') diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ProfileViewerCommands.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ProfileViewerCommands.kt index da97f0d2..41cd6b0f 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ProfileViewerCommands.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ProfileViewerCommands.kt @@ -19,7 +19,6 @@ package io.github.moulberry.notenoughupdates.commands.misc -import com.mojang.brigadier.arguments.StringArgumentType.string import com.mojang.brigadier.context.CommandContext import io.github.moulberry.notenoughupdates.NotEnoughUpdates import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe @@ -36,7 +35,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @NEUAutoSubscribe class ProfileViewerCommands { companion object { - fun CommandContext.openPv(name: String) { + fun CommandContext.openPv(name: String?) { + if (!NotEnoughUpdates.INSTANCE.isOnSkyblock) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/pv ${name ?: ""}") + return + } if (!OpenGlHelper.isFramebufferEnabled()) { reply("${RED}Some parts of the profile viewer do not work with OptiFine Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it.") } @@ -46,7 +49,9 @@ class ProfileViewerCommands { return } - NotEnoughUpdates.profileViewer.loadPlayerByName(name) { profile -> + NotEnoughUpdates.profileViewer.loadPlayerByName( + name ?: Minecraft.getMinecraft().thePlayer.name + ) { profile -> if (profile == null) { reply("${RED}Invalid player name/API key. Maybe the API is down? Try /api new.") } else { @@ -64,9 +69,9 @@ class ProfileViewerCommands { event.command(name) { thenExecute { before() - openPv(Minecraft.getMinecraft().thePlayer.name) + openPv(null) } - thenArgument("player", string()) { player -> + thenArgument("player", RestArgumentType) { player -> suggestsList { Minecraft.getMinecraft().theWorld.playerEntities.map { it.name } } thenExecute { before() -- cgit