/
RemotePlayer.java
189 lines (164 loc) · 4.35 KB
/
RemotePlayer.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
package net.ME1312.SubServers.Bungee.Library.Compatibility;
import net.ME1312.Galaxi.Library.Callback.Callback;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.net.InetSocketAddress;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.UUID;
/**
* RemotePlayer Layout Class
*/
public interface RemotePlayer {
/**
* Get Local Player
*
* @return Local Player (or null when not local)
*/
ProxiedPlayer get();
/**
* Get the UUID of this player.
*
* @return the UUID
*/
UUID getUniqueId();
/**
* Get the unique name of this player.
*
* @return the player's username
*/
String getName();
/**
* Gets the remote address of this connection.
*
* @return the remote address
*/
InetSocketAddress getAddress();
/**
* Gets the name of the proxy this player is connected to.
*
* @return the name of the proxy this player is connected to
*/
String getProxyName();
/**
* Gets the name of the server this player is connected to.
*
* @return the name of the server this player is connected to
*/
String getServerName();
/**
* Gets the server this player is connected to.
*
* @return the server this player is connected to
*/
ServerInfo getServer();
/**
* Sends messages to this player
*
* @param messages Messages to send
*/
default void sendMessage(String... messages) {
sendMessage(messages, i -> {});
}
/**
* Sends messages to this player
*
* @param message Message to send
* @param response Success Status
*/
default void sendMessage(String message, Callback<Integer> response) {
sendMessage(new String[]{ message }, response);
}
/**
* Sends messages to this player
*
* @param messages Messages to send
* @param response Success Status
*/
void sendMessage(String[] messages, Callback<Integer> response);
/**
* Sends messages to this player
*
* @param messages Messages to send
*/
default void sendMessage(BaseComponent... messages) {
sendMessage(messages, i -> {});
}
/**
* Sends messages to this player
*
* @param message Message to send
* @param response Success Status
*/
default void sendMessage(BaseComponent message, Callback<Integer> response) {
sendMessage(new BaseComponent[]{ message }, response);
}
/**
* Sends messages to this player
*
* @param messages Messages to send
* @param response Success Status
*/
void sendMessage(BaseComponent[] messages, Callback<Integer> response);
/**
* Transfers this player to another server
*
* @param server Target server
*/
default void transfer(String server) {
transfer(server, i -> {});
}
/**
* Transfers this player to another server
*
* @param server Target server
* @param response Success status
*/
void transfer(String server, Callback<Integer> response);
/**
* Transfers this player to another server
*
* @param server Target server
*/
default void transfer(ServerInfo server) {
transfer(server, i -> {});
}
/**
* Transfers this player to another server
*
* @param server Target server
* @param response Success status
*/
void transfer(ServerInfo server, Callback<Integer> response);
/**
* Disconnects this player from the network
*/
default void disconnect() {
disconnect(i -> {});
}
/**
* Disconnects this player from the network
*
* @param response Success status
*/
default void disconnect(Callback<Integer> response) {
disconnect(null, response);
}
/**
* Disconnects this player from the network
*
* @param reason Disconnect Reason
*/
default void disconnect(String reason) {
disconnect(reason, i -> {});
}
/**
* Disconnects this player from the network
*
* @param reason Disconnect Reason
* @param response Success status
*/
void disconnect(String reason, Callback<Integer> response);
}