13
0
geforkt von Mirrors/Velocity

Add Player#getGameProfile() to make tab list plugins easier to make.

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-03-29 15:01:52 -04:00
Ursprung 118574e535
Commit 564cb99861
5 geänderte Dateien mit 13 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -106,6 +106,11 @@ public interface Player extends CommandSource, InboundConnection, ChannelMessage
*/ */
void setGameProfileProperties(List<GameProfile.Property> properties); void setGameProfileProperties(List<GameProfile.Property> properties);
/**
* Returns the player's game profile.
*/
GameProfile getGameProfile();
/** /**
* Sets the tab list header and footer for the player. * Sets the tab list header and footer for the player.
* *

Datei anzeigen

@ -72,7 +72,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
response.setId(packet.getId()); response.setId(packet.getId());
response.setData(createForwardingData(configuration.getForwardingSecret(), response.setData(createForwardingData(configuration.getForwardingSecret(),
serverConn.getPlayer().getRemoteAddress().getHostString(), serverConn.getPlayer().getRemoteAddress().getHostString(),
serverConn.getPlayer().getProfile())); serverConn.getPlayer().getGameProfile()));
mc.write(response); mc.write(response);
informationForwarded = true; informationForwarded = true;
} else { } else {

Datei anzeigen

@ -126,9 +126,9 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
.append('\0') .append('\0')
.append(proxyPlayer.getRemoteAddress().getHostString()) .append(proxyPlayer.getRemoteAddress().getHostString())
.append('\0') .append('\0')
.append(proxyPlayer.getProfile().getUndashedId()) .append(proxyPlayer.getGameProfile().getUndashedId())
.append('\0'); .append('\0');
GSON.toJson(proxyPlayer.getProfile().getProperties(), data); GSON.toJson(proxyPlayer.getGameProfile().getProperties(), data);
return data.toString(); return data.toString();
} }
@ -192,8 +192,8 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
@Override @Override
public String toString() { public String toString() {
return "[server connection] " + proxyPlayer.getProfile().getName() + " -> " + registeredServer return "[server connection] " + proxyPlayer.getGameProfile().getName() + " -> "
.getServerInfo().getName(); + registeredServer.getServerInfo().getName();
} }
@Override @Override

Datei anzeigen

@ -109,8 +109,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
return false; return false;
} }
} catch (Exception e) { } catch (Exception e) {
logger logger.info("Exception occurred while running command for {}", player.getUsername(),
.info("Exception occurred while running command for {}", player.getProfile().getName(),
e); e);
player.sendMessage( player.sendMessage(
TextComponent.of("An error occurred while running this command.", TextColor.RED)); TextComponent.of("An error occurred while running this command.", TextColor.RED));

Datei anzeigen

@ -114,7 +114,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
return Optional.ofNullable(connectedServer); return Optional.ofNullable(connectedServer);
} }
public GameProfile getProfile() { @Override
public GameProfile getGameProfile() {
return profile; return profile;
} }