-
-
Notifications
You must be signed in to change notification settings - Fork 131
/
IslandChatEvent.java
66 lines (56 loc) · 1.78 KB
/
IslandChatEvent.java
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
package com.bgsoftware.superiorskyblock.api.events;
import com.bgsoftware.superiorskyblock.api.island.Island;
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer;
import com.google.common.base.Preconditions;
import org.bukkit.event.Cancellable;
/**
* IslandChatEvent is called when a player talks in islands chat.
*/
public class IslandChatEvent extends IslandEvent implements Cancellable {
private final SuperiorPlayer superiorPlayer;
private String message;
private String format;
private boolean cancelled = false;
/**
* The constructor of the event.
*
* @param island The island that the player talks in.
* @param superiorPlayer The player who sent the message.
* @param message The message that was sent.
*/
public IslandChatEvent(Island island, SuperiorPlayer superiorPlayer, String message) {
super(island);
this.superiorPlayer = superiorPlayer;
this.message = message;
}
/**
* Get the player who banned the other player.
*/
public SuperiorPlayer getPlayer() {
return superiorPlayer;
}
/**
* Get the message that the player sent.
*/
public String getMessage() {
return message;
}
/**
* Set a new message that will be sent.
*
* @param message The new message to send.
*/
public void setMessage(String message) {
Preconditions.checkNotNull(message, "message parameter cannot be null.");
Preconditions.checkArgument(!message.isEmpty(), "message cannot be empty.");
this.message = message;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}