blob: b6d1747e1ec55c1e36c1f726026d959f7869b916 (
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
|
package org.bukkit.craftbukkit.command;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.conversations.ManuallyAbandonedConversationCanceller;
import org.bukkit.craftbukkit.conversations.ConversationTracker;
/**
* Represents CLI input from a console
*/
public class CraftConsoleCommandSender extends ServerCommandSender implements ConsoleCommandSender {
protected ConversationTracker conversationTracker = new ConversationTracker();
protected CraftConsoleCommandSender() {
super();
}
public void sendMessage(String message) {
sendRawMessage(message);
}
public void sendRawMessage(String message) {
System.out.println(ChatColor.stripColor(message));
}
public void sendMessage(String[] messages) {
for (String message : messages) {
sendMessage(message);
}
}
public String getName() {
return "CONSOLE";
}
public boolean isOp() {
return true;
}
public void setOp(boolean value) {
throw new UnsupportedOperationException("Cannot change operator status of server console");
}
public boolean beginConversation(Conversation conversation) {
return conversationTracker.beginConversation(conversation);
}
public void abandonConversation(Conversation conversation) {
conversationTracker.abandonConversation(conversation, new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
}
public void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
conversationTracker.abandonConversation(conversation, details);
}
public void acceptConversationInput(String input) {
conversationTracker.acceptConversationInput(input);
}
public boolean isConversing() {
return conversationTracker.isConversing();
}
}
|