mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 21:31:25 +01:00
Use cause and cancel component in PlayerGameModeChanteEvent (#6192)
This commit is contained in:
parent
6ac1befa7b
commit
83db66562f
@ -102,14 +102,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ PlayerGameModeChangeEvent event = this.changeGameModeForPlayer(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null);
|
||||
+ 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
|
||||
if (gameMode == this.gameModeForPlayer) {
|
||||
- return false;
|
||||
+ return null; // Paper
|
||||
} else {
|
||||
// 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);
|
||||
if (event.isCancelled()) {
|
||||
- return false;
|
||||
|
Loading…
Reference in New Issue
Block a user