Files
paper-mc/paper-server/patches/rejected/net/minecraft/server/commands/GameModeCommand.java.patch
Bjarne Koll b745ab65e6 Begin 1.21.6-pre1
Initial move of patches to rejected and non rejected source patches to
publish to patch-roulette.
2025-05-28 13:23:32 +02:00

27 lines
1.4 KiB
Diff

From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/commands/GameModeCommand.java b/net/minecraft/server/commands/GameModeCommand.java
index c112ca29596a68c6ba12dcc4d33460b4c181fa47..c44cdbbdc06b25bd20a208386545a10af9b96df8 100644
--- a/net/minecraft/server/commands/GameModeCommand.java
+++ b/net/minecraft/server/commands/GameModeCommand.java
@@ -54,9 +54,14 @@ public class GameModeCommand {
int i = 0;
for (ServerPlayer serverPlayer : players) {
- if (serverPlayer.setGameMode(gameType)) {
+ // Paper start - Expand PlayerGameModeChangeEvent
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameType, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.COMMAND, net.kyori.adventure.text.Component.empty());
+ if (event != null && !event.isCancelled()) {
logGamemodeChange(source.getSource(), serverPlayer, gameType);
i++;
+ } else if (event != null && event.cancelMessage() != null) {
+ source.getSource().sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true);
+ // Paper end - Expand PlayerGameModeChangeEvent
}
}