3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-06 00:00:47 +01:00

Fix Checkstyle issues

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-11-26 16:32:50 -05:00
Ursprung 87ad188f92
Commit 0c14eabe6b
4 geänderte Dateien mit 28 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -53,7 +53,7 @@ class BungeeCordMessageResponder {
out.writeUTF("IP");
out.writeUTF(player.getRemoteAddress().getHostString());
out.writeInt(player.getRemoteAddress().getPort());
sendResponse(buf);
sendResponseOnConnection(buf);
}
private void processPlayerCount(ByteBufDataInput in) {
@ -75,7 +75,7 @@ class BungeeCordMessageResponder {
}
if (buf.isReadable()) {
sendResponse(buf);
sendResponseOnConnection(buf);
} else {
buf.release();
}
@ -109,7 +109,7 @@ class BungeeCordMessageResponder {
}
if (buf.isReadable()) {
sendResponse(buf);
sendResponseOnConnection(buf);
} else {
buf.release();
}
@ -126,7 +126,7 @@ class BungeeCordMessageResponder {
out.writeUTF("GetServers");
out.writeUTF(joiner.toString());
sendResponse(buf);
sendResponseOnConnection(buf);
}
private void processMessage(ByteBufDataInput in) {
@ -150,7 +150,7 @@ class BungeeCordMessageResponder {
out.writeUTF("GetServer");
out.writeUTF(player.ensureAndGetCurrentServer().getServerInfo().getName());
sendResponse(buf);
sendResponseOnConnection(buf);
}
private void processUuid() {
@ -160,7 +160,7 @@ class BungeeCordMessageResponder {
out.writeUTF("UUID");
out.writeUTF(UuidUtils.toUndashed(player.getUniqueId()));
sendResponse(buf);
sendResponseOnConnection(buf);
}
private void processUuidOther(ByteBufDataInput in) {
@ -172,7 +172,7 @@ class BungeeCordMessageResponder {
out.writeUTF(player.getUsername());
out.writeUTF(UuidUtils.toUndashed(player.getUniqueId()));
sendResponse(buf);
sendResponseOnConnection(buf);
});
}
@ -186,7 +186,7 @@ class BungeeCordMessageResponder {
out.writeUTF(info.getServerInfo().getAddress().getHostString());
out.writeShort(info.getServerInfo().getAddress().getPort());
sendResponse(buf);
sendResponseOnConnection(buf);
});
}
@ -212,7 +212,7 @@ class BungeeCordMessageResponder {
private void processForwardToPlayer(ByteBufDataInput in) {
proxy.getPlayer(in.readUTF())
.flatMap(Player::getCurrentServer)
.ifPresent(server -> sendResponse(player, prepareForwardMessage(in)));
.ifPresent(server -> sendServerResponse(player, prepareForwardMessage(in)));
}
private void processForwardToServer(ByteBufDataInput in) {
@ -234,8 +234,8 @@ class BungeeCordMessageResponder {
}
// Note: this method will always release the buffer!
private void sendResponse(ByteBuf buf) {
sendResponse(this.player, buf);
private void sendResponseOnConnection(ByteBuf buf) {
sendServerResponse(this.player, buf);
}
static String getBungeeCordChannel(ProtocolVersion version) {
@ -244,7 +244,7 @@ class BungeeCordMessageResponder {
}
// Note: this method will always release the buffer!
private static void sendResponse(ConnectedPlayer player, ByteBuf buf) {
private static void sendServerResponse(ConnectedPlayer player, ByteBuf buf) {
MinecraftConnection serverConnection = player.ensureAndGetCurrentServer().ensureConnected();
String chan = getBungeeCordChannel(serverConnection.getProtocolVersion());

Datei anzeigen

@ -214,6 +214,12 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
return sendPluginMessage(identifier, Unpooled.wrappedBuffer(data));
}
/**
* Sends a plugin message to the server through this connection.
* @param identifier the channel ID to use
* @param data the data
* @return whether or not the message was sent
*/
public boolean sendPluginMessage(ChannelIdentifier identifier, ByteBuf data) {
Preconditions.checkNotNull(identifier, "identifier");
Preconditions.checkNotNull(data, "data");

Datei anzeigen

@ -135,6 +135,10 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
return Optional.ofNullable(connectedServer);
}
/**
* Makes sure the player is connected to a server and returns the server they are connected to.
* @return the server the player is connected to
*/
public VelocityServerConnection ensureAndGetCurrentServer() {
VelocityServerConnection con = this.connectedServer;
if (con == null) {

Datei anzeigen

@ -126,6 +126,12 @@ public class VelocityRegisteredServer implements RegisteredServer {
return sendPluginMessage(identifier, Unpooled.wrappedBuffer(data));
}
/**
* Sends a plugin message to the server through this connection.
* @param identifier the channel ID to use
* @param data the data
* @return whether or not the message was sent
*/
public boolean sendPluginMessage(ChannelIdentifier identifier, ByteBuf data) {
for (ConnectedPlayer player : players) {
VelocityServerConnection connection = player.getConnectedServer();