mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 10:44:39 +01:00
18 lines
1,005 B
Diff
18 lines
1,005 B
Diff
--- a/net/minecraft/server/commands/GameModeCommand.java
|
|
+++ b/net/minecraft/server/commands/GameModeCommand.java
|
|
@@ -54,9 +_,14 @@
|
|
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
|
|
}
|
|
}
|
|
|