mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 03:52:45 +01:00
18 lines
1 KiB
Diff
18 lines
1 KiB
Diff
--- a/net/minecraft/server/commands/DefaultGameModeCommands.java
|
|
+++ b/net/minecraft/server/commands/DefaultGameModeCommands.java
|
|
@@ -28,9 +_,13 @@
|
|
GameType forcedGameType = server.getForcedGameType();
|
|
if (forcedGameType != null) {
|
|
for (ServerPlayer serverPlayer : server.getPlayerList().getPlayers()) {
|
|
- if (serverPlayer.setGameMode(forcedGameType)) {
|
|
- i++;
|
|
+ // Paper start - Expand PlayerGameModeChangeEvent
|
|
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gamemode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, net.kyori.adventure.text.Component.empty());
|
|
+ if (event != null && event.isCancelled()) {
|
|
+ commandSource.sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false);
|
|
}
|
|
+ // Paper end - Expand PlayerGameModeChangeEvent
|
|
+ i++;
|
|
}
|
|
}
|
|
|