public static PacketPlayOutPlayerInfo.PlayerInfoData playerListPacketData(PacketPlayOutPlayerInfo packet, UUID uuid, String name, @Nullable BaseComponent displayName, GameMode gamemode, int ping, @Nullable Skin skin) { GameProfile profile = new GameProfile(uuid, name); if(skin != null) { for(Map.Entry<String, Collection<Property>> entry : Skins.toProperties(skin).asMap().entrySet()) { profile.getProperties().putAll(entry.getKey(), entry.getValue()); } } PacketPlayOutPlayerInfo.PlayerInfoData data = packet.new PlayerInfoData(profile, ping, gamemode == null ? null : EnumGamemode.getById(gamemode.getValue()), null); data.displayName = displayName == null ? null : new BaseComponent[]{ displayName }; return data; }
@Override public void setDefaultGameMode(GameMode mode) { Validate.notNull(mode, "Mode cannot be null"); for (World world : getWorlds()) { ((CraftWorld) world).getHandle().worldData.setGameType(EnumGamemode.getById(mode.getValue())); } }
public void setDefaultGameMode(GameMode mode) { Validate.notNull(mode, "Mode cannot be null"); for (World world : getWorlds()) { ((CraftWorld) world).getHandle().worldData.setGameType(EnumGamemode.a(mode.getValue())); } }
public PacketPlayOutPlayerInfo.PlayerInfoData getPlayerInfo(Player viewer, PacketPlayOutPlayerInfo listPacket) { int ping = getPing(); return listPacket.new PlayerInfoData(getProfile(), ping < 0 ? 1000 : ping, EnumGamemode.SURVIVAL, new ChatComponentText(getDisplayName(viewer))); }