Fix #816 - Don't respawn after /credits command

This commit is contained in:
BillyGalbreath
2021-12-31 06:52:14 -06:00
parent aa043148fa
commit 2d51101945

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Add credits command
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 1c46781ad2ce2042ded7dc69806d65cc0d0a2047..be6009edf26ee468980e7d0f33b989f0121f3011 100644
index d0d5aeb92c0b25643003b17a73c7580c3310e353..40735237cc87a476d08f1ffcb1b67ce563091230 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -205,6 +205,7 @@ public class Commands {
@@ -17,7 +17,7 @@ index 1c46781ad2ce2042ded7dc69806d65cc0d0a2047..be6009edf26ee468980e7d0f33b989f0
org.purpurmc.purpur.command.PingCommand.register(this.dispatcher); // Purpur
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 46ac9fd96ab11a6f1ed0af97beded2eb0e2feab9..facf2b59f7f9a81b34ed736aca2e7494ef37a47a 100644
index 37e6285c68a4c4e20e752ab7484ac199ea22925b..e95b4a1f07facda1daf1e83560e98e649a1b79ec 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -162,6 +162,7 @@ public class PurpurConfig {
@@ -38,10 +38,10 @@ index 46ac9fd96ab11a6f1ed0af97beded2eb0e2feab9..facf2b59f7f9a81b34ed736aca2e7494
}
diff --git a/src/main/java/org/purpurmc/purpur/command/CreditsCommand.java b/src/main/java/org/purpurmc/purpur/command/CreditsCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..d7e8ee9f575b002a333afbd3c675be4694bec2c7
index 0000000000000000000000000000000000000000..2189ca24f9fe53ad20ffba73ea73f6a0dc7891b8
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/command/CreditsCommand.java
@@ -0,0 +1,35 @@
@@ -0,0 +1,34 @@
+package org.purpurmc.purpur.command;
+
+import com.mojang.brigadier.CommandDispatcher;
@@ -69,7 +69,6 @@ index 0000000000000000000000000000000000000000..d7e8ee9f575b002a333afbd3c675be46
+ private static int execute(CommandSourceStack sender, Collection<ServerPlayer> targets) {
+ for (ServerPlayer player : targets) {
+ ClientboundGameEventPacket packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, 1F);
+ player.wonGame = true;
+ player.connection.send(packet);
+ String output = String.format(PurpurConfig.creditsCommandOutput, player.getGameProfile().getName());
+ sender.sendSuccess(output, false);