13
0
geforkt von Mirrors/Paper

19 Zeilen
1005 B
Diff

2021-05-15 10:04:43 -07:00
--- a/net/minecraft/server/commands/GameModeCommand.java
+++ b/net/minecraft/server/commands/GameModeCommand.java
2024-12-14 13:42:43 -08:00
@@ -54,9 +_,14 @@
2021-05-15 10:04:43 -07:00
int i = 0;
2024-12-14 13:42:43 -08:00
for (ServerPlayer serverPlayer : players) {
- if (serverPlayer.setGameMode(gameType)) {
2021-05-15 10:04:43 -07:00
+ // Paper start - Expand PlayerGameModeChangeEvent
2024-12-14 13:42:43 -08:00
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameType, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.COMMAND, net.kyori.adventure.text.Component.empty());
2021-05-15 10:04:43 -07:00
+ if (event != null && !event.isCancelled()) {
2024-12-14 13:42:43 -08:00
logGamemodeChange(source.getSource(), serverPlayer, gameType);
2021-05-15 10:04:43 -07:00
i++;
+ } else if (event != null && event.cancelMessage() != null) {
2024-12-14 13:42:43 -08:00
+ source.getSource().sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true);
2021-05-15 10:04:43 -07:00
+ // Paper end - Expand PlayerGameModeChangeEvent
}
}