From 7d88f008394153cd5c2d19c4aeb759a750536898 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot <noreply+git-bukkit@papermc.io> Date: Fri, 31 Dec 2010 20:40:44 -0500 Subject: [PATCH] Added Cancellable interface By: durron597 <martin.jared@gmail.com> --- .../src/org/bukkit/event/Cancellable.java | 6 ++++++ .../bukkit/event/block/BlockPlacedEvent.java | 19 ++++++++++++++++--- .../bukkit/event/player/PlayerChatEvent.java | 3 ++- .../bukkit/event/player/PlayerMoveEvent.java | 3 ++- 4 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 paper-api/src/org/bukkit/event/Cancellable.java diff --git a/paper-api/src/org/bukkit/event/Cancellable.java b/paper-api/src/org/bukkit/event/Cancellable.java new file mode 100644 index 0000000000..05789dea84 --- /dev/null +++ b/paper-api/src/org/bukkit/event/Cancellable.java @@ -0,0 +1,6 @@ +package org.bukkit.event; + +public interface Cancellable { + public boolean isCancelled(); + public void setCancelled(boolean cancel); +} diff --git a/paper-api/src/org/bukkit/event/block/BlockPlacedEvent.java b/paper-api/src/org/bukkit/event/block/BlockPlacedEvent.java index e8e15e21cd..7b7710f452 100644 --- a/paper-api/src/org/bukkit/event/block/BlockPlacedEvent.java +++ b/paper-api/src/org/bukkit/event/block/BlockPlacedEvent.java @@ -1,19 +1,32 @@ package org.bukkit.event.block; import org.bukkit.Block; +import org.bukkit.event.Cancellable; /** * Not implemented yet */ -public class BlockPlacedEvent extends BlockEvent { - +public class BlockPlacedEvent extends BlockEvent implements Cancellable { + private boolean cancel; + /** * @param type * @param theBlock */ public BlockPlacedEvent(Type type, Block theBlock) { super(type, theBlock); - // TODO Auto-generated constructor stub + cancel = false; + } + + @Override + public boolean isCancelled() { + // TODO Auto-generated method stub + return cancel; + } + + @Override + public void setCancelled(boolean cancel) { + this.cancel = cancel; } } diff --git a/paper-api/src/org/bukkit/event/player/PlayerChatEvent.java b/paper-api/src/org/bukkit/event/player/PlayerChatEvent.java index d924b5e335..f67ebd8627 100644 --- a/paper-api/src/org/bukkit/event/player/PlayerChatEvent.java +++ b/paper-api/src/org/bukkit/event/player/PlayerChatEvent.java @@ -2,11 +2,12 @@ package org.bukkit.event.player; import org.bukkit.Player; +import org.bukkit.event.Cancellable; /** * Holds information for player chat and commands */ -public class PlayerChatEvent extends PlayerEvent { +public class PlayerChatEvent extends PlayerEvent implements Cancellable { private boolean cancel = false; private String message; diff --git a/paper-api/src/org/bukkit/event/player/PlayerMoveEvent.java b/paper-api/src/org/bukkit/event/player/PlayerMoveEvent.java index bb08255d34..24b31b5941 100644 --- a/paper-api/src/org/bukkit/event/player/PlayerMoveEvent.java +++ b/paper-api/src/org/bukkit/event/player/PlayerMoveEvent.java @@ -3,12 +3,13 @@ package org.bukkit.event.player; import org.bukkit.Location; import org.bukkit.Player; +import org.bukkit.event.Cancellable; import org.bukkit.event.Event; /** * Holds information for player movement and teleportation events */ -public class PlayerMoveEvent extends PlayerEvent { +public class PlayerMoveEvent extends PlayerEvent implements Cancellable { private boolean cancel = false; private Location from; private Location to;