13
0
geforkt von Mirrors/Paper

Use cause and cancel component in PlayerGameModeChanteEvent (#6192)

Dieser Commit ist enthalten in:
Jake Potrebic 2021-07-15 14:44:59 -07:00
Ursprung 6ac1befa7b
Commit 83db66562f

Datei anzeigen

@ -102,14 +102,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ PlayerGameModeChangeEvent event = this.changeGameModeForPlayer(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null); + PlayerGameModeChangeEvent event = this.changeGameModeForPlayer(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null);
+ return event == null ? false : event.isCancelled(); + return event == null ? false : event.isCancelled();
+ } + }
+ public PlayerGameModeChangeEvent changeGameModeForPlayer(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, net.kyori.adventure.text.Component component) { + public PlayerGameModeChangeEvent changeGameModeForPlayer(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, net.kyori.adventure.text.Component cancelMessage) {
+ // Paper end + // Paper end
if (gameMode == this.gameModeForPlayer) { if (gameMode == this.gameModeForPlayer) {
- return false; - return false;
+ return null; // Paper + return null; // Paper
} else { } else {
// CraftBukkit start // CraftBukkit start
PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this.player.getBukkitEntity(), GameMode.getByValue(gameMode.getId())); - PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this.player.getBukkitEntity(), GameMode.getByValue(gameMode.getId()));
+ PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this.player.getBukkitEntity(), GameMode.getByValue(gameMode.getId()), cause, cancelMessage); // Paper
this.level.getCraftServer().getPluginManager().callEvent(event); this.level.getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
- return false; - return false;