Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PlayerKickEvent.java
1 package org.bukkit.event.player;
2 
3 import org.bukkit.entity.Player;
6 
7 /**
8  * Called when a player gets kicked from the server
9  */
10 public class PlayerKickEvent extends PlayerEvent implements Cancellable {
11  private static final HandlerList handlers = new HandlerList();
12  private String leaveMessage;
13  private String kickReason;
14  private Boolean cancel;
15 
16  public PlayerKickEvent(final Player playerKicked, final String kickReason, final String leaveMessage) {
17  super(playerKicked);
18  this.kickReason = kickReason;
19  this.leaveMessage = leaveMessage;
20  this.cancel = false;
21  }
22 
23  /**
24  * Gets the reason why the player is getting kicked
25  *
26  * @return string kick reason
27  */
28  public String getReason() {
29  return kickReason;
30  }
31 
32  /**
33  * Gets the leave message send to all online players
34  *
35  * @return string kick reason
36  */
37  public String getLeaveMessage() {
38  return leaveMessage;
39  }
40 
41  public boolean isCancelled() {
42  return cancel;
43  }
44 
45  public void setCancelled(boolean cancel) {
46  this.cancel = cancel;
47  }
48 
49  /**
50  * Sets the reason why the player is getting kicked
51  *
52  * @param kickReason kick reason
53  */
54  public void setReason(String kickReason) {
55  this.kickReason = kickReason;
56  }
57 
58  /**
59  * Sets the leave message send to all online players
60  *
61  * @param leaveMessage leave message
62  */
63  public void setLeaveMessage(String leaveMessage) {
64  this.leaveMessage = leaveMessage;
65  }
66 
67  @Override
68  public HandlerList getHandlers() {
69  return handlers;
70  }
71 
72  public static HandlerList getHandlerList() {
73  return handlers;
74  }
75 }
void setLeaveMessage(String leaveMessage)