Added Cancellable interface

This commit is contained in:
durron597 2010-12-31 20:40:44 -05:00
parent 6dc4698062
commit 2e3f21bcf2
4 changed files with 26 additions and 5 deletions

View File

@ -0,0 +1,6 @@
package org.bukkit.event;
public interface Cancellable {
public boolean isCancelled();
public void setCancelled(boolean cancel);
}

View File

@ -1,19 +1,32 @@
package org.bukkit.event.block; package org.bukkit.event.block;
import org.bukkit.Block; import org.bukkit.Block;
import org.bukkit.event.Cancellable;
/** /**
* Not implemented yet * Not implemented yet
*/ */
public class BlockPlacedEvent extends BlockEvent { public class BlockPlacedEvent extends BlockEvent implements Cancellable {
private boolean cancel;
/** /**
* @param type * @param type
* @param theBlock * @param theBlock
*/ */
public BlockPlacedEvent(Type type, Block theBlock) { public BlockPlacedEvent(Type type, Block theBlock) {
super(type, 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;
} }
} }

View File

@ -2,11 +2,12 @@
package org.bukkit.event.player; package org.bukkit.event.player;
import org.bukkit.Player; import org.bukkit.Player;
import org.bukkit.event.Cancellable;
/** /**
* Holds information for player chat and commands * Holds information for player chat and commands
*/ */
public class PlayerChatEvent extends PlayerEvent { public class PlayerChatEvent extends PlayerEvent implements Cancellable {
private boolean cancel = false; private boolean cancel = false;
private String message; private String message;

View File

@ -3,12 +3,13 @@ package org.bukkit.event.player;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Player; import org.bukkit.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
/** /**
* Holds information for player movement and teleportation events * 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 boolean cancel = false;
private Location from; private Location from;
private Location to; private Location to;