geforkt von Mirrors/Velocity
Add method to determine if player is in OnlineMode
Dieser Commit ist enthalten in:
Ursprung
e8d4db517d
Commit
fd367c6efd
@ -65,6 +65,13 @@ public interface Player extends CommandSource, InboundConnection, ChannelMessage
|
|||||||
*/
|
*/
|
||||||
long getPing();
|
long getPing();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the player's connection status.
|
||||||
|
*
|
||||||
|
* @return true if the player is authenticated with Mojang servers
|
||||||
|
*/
|
||||||
|
boolean isOnlineMode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a chat message to the player's client.
|
* Sends a chat message to the player's client.
|
||||||
*
|
*
|
||||||
|
@ -90,6 +90,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
private PermissionFunction permissionFunction;
|
private PermissionFunction permissionFunction;
|
||||||
private int tryIndex = 0;
|
private int tryIndex = 0;
|
||||||
private long ping = -1;
|
private long ping = -1;
|
||||||
|
private final boolean onlineMode;
|
||||||
private @Nullable VelocityServerConnection connectedServer;
|
private @Nullable VelocityServerConnection connectedServer;
|
||||||
private @Nullable VelocityServerConnection connectionInFlight;
|
private @Nullable VelocityServerConnection connectionInFlight;
|
||||||
private @Nullable PlayerSettings settings;
|
private @Nullable PlayerSettings settings;
|
||||||
@ -102,8 +103,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
|
|
||||||
private @MonotonicNonNull List<String> serversToTry = null;
|
private @MonotonicNonNull List<String> serversToTry = null;
|
||||||
|
|
||||||
ConnectedPlayer(VelocityServer server, GameProfile profile,
|
ConnectedPlayer(VelocityServer server, GameProfile profile, MinecraftConnection connection,
|
||||||
MinecraftConnection connection, @Nullable InetSocketAddress virtualHost) {
|
@Nullable InetSocketAddress virtualHost, boolean onlineMode) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) {
|
if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) {
|
||||||
this.tabList = new VelocityTabList(connection);
|
this.tabList = new VelocityTabList(connection);
|
||||||
@ -116,6 +117,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
this.permissionFunction = PermissionFunction.ALWAYS_UNDEFINED;
|
this.permissionFunction = PermissionFunction.ALWAYS_UNDEFINED;
|
||||||
this.connectionPhase = connection.getType().getInitialClientPhase();
|
this.connectionPhase = connection.getType().getInitialClientPhase();
|
||||||
this.knownChannels = CappedSet.create(MAX_PLUGIN_CHANNELS);
|
this.knownChannels = CappedSet.create(MAX_PLUGIN_CHANNELS);
|
||||||
|
this.onlineMode = onlineMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -151,6 +153,11 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
this.ping = ping;
|
this.ping = ping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOnlineMode() {
|
||||||
|
return onlineMode;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlayerSettings getPlayerSettings() {
|
public PlayerSettings getPlayerSettings() {
|
||||||
return settings == null ? ClientSettingsWrapper.DEFAULT : this.settings;
|
return settings == null ? ClientSettingsWrapper.DEFAULT : this.settings;
|
||||||
|
@ -232,7 +232,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
|||||||
// Initiate a regular connection and move over to it.
|
// Initiate a regular connection and move over to it.
|
||||||
ConnectedPlayer player = new ConnectedPlayer(server, profileEvent.getGameProfile(),
|
ConnectedPlayer player = new ConnectedPlayer(server, profileEvent.getGameProfile(),
|
||||||
mcConnection,
|
mcConnection,
|
||||||
inbound.getVirtualHost().orElse(null));
|
inbound.getVirtualHost().orElse(null), onlineMode);
|
||||||
this.connectedPlayer = player;
|
this.connectedPlayer = player;
|
||||||
if (!server.canRegisterConnection(player)) {
|
if (!server.canRegisterConnection(player)) {
|
||||||
player.disconnect(VelocityMessages.ALREADY_CONNECTED);
|
player.disconnect(VelocityMessages.ALREADY_CONNECTED);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren