blob: 44cc0518629cc4eb9ccdc747e17bb66222f3d30c (
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 java.util.Collection;
import org.apache.commons.lang.Validate;
import org.bukkit.Warning;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
/**
* Called when a player attempts to tab-complete a chat message.
*
* @deprecated This event is no longer fired due to client changes
*/
@Deprecated
@Warning(reason = "This event is no longer fired due to client changes")
public class PlayerChatTabCompleteEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private final String message;
private final String lastToken;
private final Collection<String> completions;
public PlayerChatTabCompleteEvent(final Player who, final String message, final Collection<String> completions) {
super(who);
Validate.notNull(message, "Message cannot be null");
Validate.notNull(completions, "Completions cannot be null");
this.message = message;
int i = message.lastIndexOf(' ');
if (i < 0) {
this.lastToken = message;
} else {
this.lastToken = message.substring(i + 1);
}
this.completions = completions;
}
/**
* Gets the chat message being tab-completed.
*
* @return the chat message
*/
public String getChatMessage() {
return message;
}
/**
* Gets the last 'token' of the message being tab-completed.
* <p>
* The token is the substring starting with the character after the last
* space in the message.
*
* @return The last token for the chat message
*/
public String getLastToken() {
return lastToken;
}
/**
* This is the collection of completions for this event.
*
* @return the current completions
*/
public Collection<String> getTabCompletions() {
return completions;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}
|