mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 00:07:56 +01:00
19 lines
1008 B
Diff
19 lines
1008 B
Diff
--- a/net/minecraft/server/commands/GameModeCommand.java
|
|
+++ b/net/minecraft/server/commands/GameModeCommand.java
|
|
@@ -60,9 +60,14 @@
|
|
int i = 0;
|
|
|
|
for (ServerPlayer serverPlayer : targets) {
|
|
- if (serverPlayer.setGameMode(gameMode)) {
|
|
+ // Paper start - Expand PlayerGameModeChangeEvent
|
|
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.COMMAND, net.kyori.adventure.text.Component.empty());
|
|
+ if (event != null && !event.isCancelled()) {
|
|
logGamemodeChange(context.getSource(), serverPlayer, gameMode);
|
|
i++;
|
|
+ } else if (event != null && event.cancelMessage() != null) {
|
|
+ context.getSource().sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true);
|
|
+ // Paper end - Expand PlayerGameModeChangeEvent
|
|
}
|
|
}
|
|
|