blob: 50492c7cfdbb1f0b5511cdfd8efdbe1121a92b60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
package org.bukkit.event.player;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
public class PlayerKickEvent extends PlayerEvent implements Cancellable {
private String leaveMessage;
private String kickReason;
private Boolean cancel;
public PlayerKickEvent(Player playerKicked, String kickReason, String leaveMessage) {
super(Type.PLAYER_KICK, playerKicked);
this.kickReason = kickReason;
this.leaveMessage = leaveMessage;
this.cancel = false;
}
/**
* Gets the cancellation state of this event. Set to true if you
* want to prevent the player from getting kicked.
*
* @return boolean cancellation state
*/
public boolean isCancelled() {
return cancel;
}
/**
* Gets the reason why the player is getting kicked
*
* @return string kick reason
*/
public String getReason() {
return kickReason;
}
/**
* Gets the leave message send to all online players
*
* @return string kick reason
*/
public String getLeaveMessage() {
return leaveMessage;
}
/**
* Sets the cancellation state of this event. A cancelled event will not
* be executed in the server, but will still pass to other plugins
*
* Cancelling this event will prevent the kick of the targetted player
*
* @param cancel true if you wish to cancel this event
*/
public void setCancelled(boolean cancel) {
this.cancel = cancel;
}
/**
* Sets the reason why the player is getting kicked
*
* @param kickReason kick reason
*/
public void setReason(String kickReason) {
this.kickReason = kickReason;
}
/**
* Sets the leave message send to all online players
*
* @param leaveMessage leave message
*/
public void setLeaveMessage(String leaveMessage) {
this.leaveMessage = leaveMessage;
}
}
|