Commits

md_5 authored 1b5ad2af5de
SPIGOT-6316: PlayerBedLeaveEvent implements Cancellable
No tags

src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java

Modified
1 1 package org.bukkit.event.player;
2 2
3 3 import org.bukkit.Location;
4 4 import org.bukkit.block.Block;
5 5 import org.bukkit.entity.Player;
6 +import org.bukkit.event.Cancellable;
6 7 import org.bukkit.event.HandlerList;
7 8 import org.jetbrains.annotations.NotNull;
8 9
9 10 /**
10 11 * This event is fired when the player is leaving a bed.
11 12 */
12 -public class PlayerBedLeaveEvent extends PlayerEvent {
13 +public class PlayerBedLeaveEvent extends PlayerEvent implements Cancellable {
13 14 private static final HandlerList handlers = new HandlerList();
14 15 private final Block bed;
15 16 private boolean setBedSpawn;
17 + private boolean cancelled;
16 18
17 19 public PlayerBedLeaveEvent(@NotNull final Player who, @NotNull final Block bed, boolean setBedSpawn) {
18 20 super(who);
19 21 this.bed = bed;
20 22 this.setBedSpawn = setBedSpawn;
21 23 }
22 24
23 25 /**
24 26 * Returns the bed block involved in this event.
25 27 *
55 57 * <br>
56 58 * To change a {@link Player}'s spawn location, use
57 59 * {@link Player#setBedSpawnLocation(Location)}.
58 60 *
59 61 * @param setBedSpawn true to change the new spawn location
60 62 */
61 63 public void setSpawnLocation(boolean setBedSpawn) {
62 64 this.setBedSpawn = setBedSpawn;
63 65 }
64 66
67 + @Override
68 + public boolean isCancelled() {
69 + return this.cancelled;
70 + }
71 +
72 + @Override
73 + public void setCancelled(boolean cancelled) {
74 + this.cancelled = cancelled;
75 + }
76 +
65 77 @NotNull
66 78 @Override
67 79 public HandlerList getHandlers() {
68 80 return handlers;
69 81 }
70 82
71 83 @NotNull
72 84 public static HandlerList getHandlerList() {
73 85 return handlers;
74 86 }
75 87 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut