Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-26 00:00:55 +01:00
Redirect player without message (#581)
Dieser Commit ist enthalten in:
Ursprung
567582b2e2
Commit
08f1b87267
@ -130,8 +130,7 @@ public final class KickedFromServerEvent implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells the proxy to redirect the player to another server. No messages will be sent from the
|
* Tells the proxy to redirect the player to another server.
|
||||||
* proxy when this result is used.
|
|
||||||
*/
|
*/
|
||||||
public static final class RedirectPlayer implements ServerKickResult {
|
public static final class RedirectPlayer implements ServerKickResult {
|
||||||
|
|
||||||
@ -159,8 +158,11 @@ public final class KickedFromServerEvent implements
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new redirect result to forward the player to the specified {@code server}.
|
* Creates a new redirect result to forward the player to the specified {@code server}.
|
||||||
|
* The specified {@code message} will be sent to the player after the redirection.
|
||||||
|
* Use {@code Component.empty()} to skip sending any messages to the player.
|
||||||
*
|
*
|
||||||
* @param server the server to send the player to
|
* @param server the server to send the player to
|
||||||
|
* @param message the message will be sent to the player after redirecting
|
||||||
* @return the redirect result
|
* @return the redirect result
|
||||||
*/
|
*/
|
||||||
public static RedirectPlayer create(RegisteredServer server,
|
public static RedirectPlayer create(RegisteredServer server,
|
||||||
@ -168,6 +170,13 @@ public final class KickedFromServerEvent implements
|
|||||||
return new RedirectPlayer(server, message);
|
return new RedirectPlayer(server, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new redirect result to forward the player to the specified {@code server}.
|
||||||
|
* The kick reason will be displayed to the player
|
||||||
|
*
|
||||||
|
* @param server the server to send the player to
|
||||||
|
* @return the redirect result
|
||||||
|
*/
|
||||||
public static ServerKickResult create(RegisteredServer server) {
|
public static ServerKickResult create(RegisteredServer server) {
|
||||||
return new RedirectPlayer(server, null);
|
return new RedirectPlayer(server, null);
|
||||||
}
|
}
|
||||||
|
@ -641,7 +641,9 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
if (requestedMessage == null) {
|
if (requestedMessage == null) {
|
||||||
requestedMessage = friendlyReason;
|
requestedMessage = friendlyReason;
|
||||||
}
|
}
|
||||||
|
if (requestedMessage != Component.empty()) {
|
||||||
sendMessage(requestedMessage);
|
sendMessage(requestedMessage);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// The only remaining value is successful (no need to do anything!)
|
// The only remaining value is successful (no need to do anything!)
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren