From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001 From: File 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 } }