aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
diff options
context:
space:
mode:
authorRoman / Linnea Gräf <roman.graef@gmail.com>2023-06-27 22:28:21 +0200
committerGitHub <noreply@github.com>2023-06-27 22:28:21 +0200
commit9ab6d23f94135da8555faaf8ef36f29d70029ceb (patch)
tree597ce50bdb7b36739b30aa3dc96c632b3b452b66 /src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
parent5c863511cabc4e1bb3b1bfcfbadabf9fd6d4dd41 (diff)
downloadnotenoughupdates-9ab6d23f94135da8555faaf8ef36f29d70029ceb.tar.gz
notenoughupdates-9ab6d23f94135da8555faaf8ef36f29d70029ceb.tar.bz2
notenoughupdates-9ab6d23f94135da8555faaf8ef36f29d70029ceb.zip
Add joinServer command (#738)
Diffstat (limited to 'src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt')
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
index 3292a9cf..e72a1ed4 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
@@ -36,6 +36,7 @@ import io.github.moulberry.notenoughupdates.util.brigadier.*
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.GuiScreen
import net.minecraft.command.ICommandSender
+import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.launchwrapper.Launch
import net.minecraft.util.ChatComponentText
@@ -45,7 +46,6 @@ import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.function.Predicate
import kotlin.math.floor
-import kotlin.math.nextDown
@NEUAutoSubscribe
class DevTestCommand {
@@ -106,6 +106,23 @@ class DevTestCommand {
requires {
canPlayerExecute(it)
}
+ thenLiteral("joinServer") {
+ thenArgument("serverId", RestArgumentType) { serverId ->
+ thenExecute {
+ try {
+ MC.sessionService.joinServer(
+ MC.session.profile,
+ MC.session.token,
+ get(serverId)
+ )
+ reply("Joined server ${get(serverId)}")
+ } catch (e: Exception) {
+ e.printStackTrace()
+ reply("Failed to join server")
+ }
+ }
+ }.withHelp("Send a joinServer request to mojang (to test authentication with the cape server)")
+ }
thenLiteral("testsearch") {
thenArgument("name", RestArgumentType) { arg ->
thenExecute {