Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 70 lines 2.0 kB view raw
1package org.bukkit.event.block; 2 3import org.bukkit.block.Block; 4import org.bukkit.entity.Player; 5import org.bukkit.event.Cancellable; 6 7/** 8 * Called when a sign is changed by a player. 9 * <p/> 10 * If a Sign Change event is cancelled, the sign will not be changed. 11 */ 12public class SignChangeEvent extends BlockEvent implements Cancellable { 13 private boolean cancel = false; 14 private Player player; 15 private String[] lines; 16 17 public SignChangeEvent(final Block theBlock, final Player thePlayer, String[] theLines) { 18 super(Type.SIGN_CHANGE, theBlock); 19 this.player = thePlayer; 20 this.lines = theLines; 21 } 22 23 /** 24 * Gets the player changing the sign involved in this event. 25 * 26 * @return The Player involved in this event. 27 */ 28 public Player getPlayer() { 29 return player; 30 } 31 32 /** 33 * Gets all of the lines of text from the sign involved in this event. 34 * 35 * @return A String[] of the sign's lines of text 36 */ 37 public String[] getLines() { 38 return lines; 39 } 40 41 /** 42 * Gets a single line of text from the sign involved in this event. 43 * 44 * @param index index of the line to get 45 * @return The String containing the line of text associated with the provided index 46 * @throws IndexOutOfBoundsException thrown when the provided index is > 4 and < 0 47 */ 48 public String getLine(int index) throws IndexOutOfBoundsException { 49 return lines[index]; 50 } 51 52 /** 53 * Sets a single line for the sign involved in this event 54 * 55 * @param index index of the line to set 56 * @param line text to set 57 * @throws IndexOutOfBoundsException thrown when the provided index is > 4 and < 0 58 */ 59 public void setLine(int index, String line) throws IndexOutOfBoundsException { 60 lines[index] = line; 61 } 62 63 public boolean isCancelled() { 64 return cancel; 65 } 66 67 public void setCancelled(boolean cancel) { 68 this.cancel = cancel; 69 } 70}