Transfer Module
Overview
The transfer module allows you to transfer players from one server to another, without the need of additional proxy setups, using the transfer packet. We've also introduced a ping packet to get a players ping to other servers.
- Adds the ability to use the
Transfer Packet
andPing Packet
on players.- Ability to transfer players from one server to another
- Ability to ping other servers, to get a players ping time to those servers.
When you combine the usage of the ping packet and transfer packet, you can do connection-based optimizing for your players.
⚠️
Players are prompted with a confirmation screen, where they can accept or decline the transfer-packet.
Integration
Using the Transfer Packet
public void transferExample(Player viewer) {
Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
if (!apolloPlayerOpt.isPresent()) {
viewer.sendMessage("Join with Lunar Client to test this feature!");
return;
}
// Sending the transfer request to the player, to transfer them to "mc.hypixel.net"
this.transferModule.transfer(apolloPlayerOpt.get(), "mc.hypixel.net")
.onSuccess(response -> {
String message = "";
switch (response.getStatus()) {
case ACCEPTED: {
message = "Transfer accepted! Goodbye!";
break;
}
case REJECTED: {
message = "Transfer rejected by client!";
break;
}
}
viewer.sendMessage(message);
})
.onFailure(exception -> {
viewer.sendMessage("Internal error! Check console!");
exception.printStackTrace();
});
}
Using the Ping Packet
You can provide up to 10
different addresses per ping packet.
public void pingExample(Player viewer) {
Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
if (!apolloPlayerOpt.isPresent()) {
viewer.sendMessage("Join with Lunar Client to test this feature!");
return;
}
// Sending the ping request to the player, for the servers "mc.hypixel.net" & "minehut.com".
this.transferModule.ping(apolloPlayerOpt.get(), Lists.newArrayList("mc.hypixel.net", "minehut.com"))
.onSuccess(response -> {
for (PingResponse.PingData pingData : response.getData()) {
String message = "";
switch (pingData.getStatus()) {
// Displays successful ping request to display the server IP and the players ping to that server.
case SUCCESS: {
message = String.format("Ping to %s is %d ms.", pingData.getServerIp(), pingData.getPingMillis());
break;
}
// If the ping request times-out
case TIMED_OUT: {
message = String.format("Failed to ping %s", pingData.getServerIp());
break;
}
}
viewer.sendMessage(message);
}
})
.onFailure(exception -> {
viewer.sendMessage("Internal error! Check console!");
exception.printStackTrace();
});
}