private static boolean extract(String message, Pattern[] patterns, BiConsumer<GameProfile, String> callback) { for(Pattern pattern : patterns) { Matcher matcher = pattern.matcher(message); if (matcher.find()) { final String messageSender = matcher.group(1); final String messageOnly = matcher.group(2); if (!Strings.isNullOrEmpty(messageSender)) { for (NetworkPlayerInfo data : getLocalPlayer().connection.getPlayerInfoMap()) { if (String.CASE_INSENSITIVE_ORDER.compare(messageSender, data.getGameProfile().getName()) == 0) { callback.accept(data.getGameProfile(), messageOnly); return true; } } } } } return false; }
public TeamSelectionObject(ScorePlayerTeam p_i45492_2_) { this.field_178676_b = p_i45492_2_; this.field_178675_d = Lists.<NetworkPlayerInfo>newArrayList(); for (String s : p_i45492_2_.getMembershipCollection()) { NetworkPlayerInfo networkplayerinfo = Minecraft.getMinecraft().getNetHandler().getPlayerInfo(s); if (networkplayerinfo != null) { this.field_178675_d.add(networkplayerinfo); } } if (!this.field_178675_d.isEmpty()) { String s1 = ((NetworkPlayerInfo)this.field_178675_d.get((new Random()).nextInt(this.field_178675_d.size()))).getGameProfile().getName(); this.field_178677_c = AbstractClientPlayer.getLocationSkin(s1); AbstractClientPlayer.getDownloadImageSkin(this.field_178677_c, s1); } else { this.field_178677_c = DefaultPlayerSkin.getDefaultSkinLegacy(); } }
public ResourceLocation getLocationCape() { if (!Config.isShowCapes()) { return null; } else if (this.locationOfCape != null) { return this.locationOfCape; } else { NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo(); return networkplayerinfo == null ? null : networkplayerinfo.getLocationCape(); } }
public ResourceLocation getLocationCape() { if (!Config.isShowCapes()) { return null; } else if (this.ofLocationCape != null) { return this.ofLocationCape; } else { NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo(); return networkplayerinfo == null ? null : networkplayerinfo.getLocationCape(); } }
@SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Post event) { EntityPlayer player = event.getEntityPlayer(); String uuid = player.getUUID(player.getGameProfile()).toString(); if(player instanceof AbstractClientPlayer && UUIDS.contains(uuid) && !done.contains(player)) { AbstractClientPlayer clplayer = (AbstractClientPlayer) player; if(clplayer.hasPlayerInfo()) { NetworkPlayerInfo info = ReflectionHelper.getPrivateValue(AbstractClientPlayer.class, clplayer, ObfuscatedNames.PLAYER_INFO); Map<MinecraftProfileTexture.Type, ResourceLocation> textures = ReflectionHelper.getPrivateValue(NetworkPlayerInfo.class, info, ObfuscatedNames.PLAYER_TEXTURES); ResourceLocation loc = new ResourceLocation("proxyslib", "textures/whoknows/special_cape.png"); textures.put(MinecraftProfileTexture.Type.CAPE, loc); textures.put(MinecraftProfileTexture.Type.ELYTRA, loc); done.add(player); } } }
@SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Post event) { EntityPlayer player = event.getEntityPlayer(); String uuid = player.getUUID(player.getGameProfile()).toString(); if(player instanceof AbstractClientPlayer && UUIDS.contains(uuid) && !done.contains(player)) { AbstractClientPlayer clplayer = (AbstractClientPlayer) player; if(clplayer.hasPlayerInfo()) { NetworkPlayerInfo info = ReflectionHelper.getPrivateValue(AbstractClientPlayer.class, clplayer, ObfuscatedNames.PLAYER_INFO); Map<MinecraftProfileTexture.Type, ResourceLocation> textures = ReflectionHelper.getPrivateValue(NetworkPlayerInfo.class, info, ObfuscatedNames.PLAYER_TEXTURES); ResourceLocation loc = new ResourceLocation("proxyslib", "textures/whoknows/dev_cape.png"); textures.put(MinecraftProfileTexture.Type.CAPE, loc); textures.put(MinecraftProfileTexture.Type.ELYTRA, loc); done.add(player); } } }
public static int getPing() { if (isNull()) { return 0; } new Thread() { @Override public void run() { NetHandlerPlayClient nethandlerplayclient = Minecraft.getMinecraft().player.connection; List<NetworkPlayerInfo> list = GuiPlayerTabOverlay.ENTRY_ORDERING .<NetworkPlayerInfo>sortedCopy(nethandlerplayclient.getPlayerInfoMap()); for (NetworkPlayerInfo networkplayerinfo : list) { String uuid = networkplayerinfo.getGameProfile().getId().toString(); if (uuid.equals(Minecraft.getMinecraft().player.getUniqueID().toString())) { ping = networkplayerinfo.getResponseTime(); } } } }.start(); return ping; }
@Nullable public ResourceLocation getLocationCape() { if (!Config.isShowCapes()) { return null; } else if (this.locationOfCape != null) { return this.locationOfCape; } else { NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo(); return networkplayerinfo == null ? null : networkplayerinfo.getLocationCape(); } }
public TeamSelectionObject(ScorePlayerTeam p_i45492_2_) { this.team = p_i45492_2_; this.players = Lists.<NetworkPlayerInfo>newArrayList(); for (String s : p_i45492_2_.getMembershipCollection()) { NetworkPlayerInfo networkplayerinfo = Minecraft.getMinecraft().getConnection().getPlayerInfo(s); if (networkplayerinfo != null) { this.players.add(networkplayerinfo); } } if (this.players.isEmpty()) { this.location = DefaultPlayerSkin.getDefaultSkinLegacy(); } else { String s1 = ((NetworkPlayerInfo)this.players.get((new Random()).nextInt(this.players.size()))).getGameProfile().getName(); this.location = AbstractClientPlayer.getLocationSkin(s1); AbstractClientPlayer.getDownloadImageSkin(this.location, s1); } }
@SubscribeEvent public void onPacketRecieved(PacketEvent.Incoming.Pre event) { if (event.getPacket() instanceof SPacketSpawnPlayer) { if (disconnectOnNewPlayer.getAsBoolean()) { AutoReconnectMod.hasAutoLogged = true; // dont automatically reconnect UUID id = ((SPacketSpawnPlayer) event.getPacket()).getUniqueId(); NetworkPlayerInfo info = MC.getConnection().getPlayerInfo(id); String name = info != null ? info.getGameProfile().getName() : "(Failed) " + id.toString(); getNetworkManager().closeChannel(new TextComponentString(name + " entered render distance")); disable(); } } }
protected NetworkPlayerInfo getPlayerInfo() { if (this.playerInfo == null) { this.playerInfo = Minecraft.getMinecraft().getNetHandler().getPlayerInfo(this.getUniqueID()); } return this.playerInfo; }
public TeleportToPlayer(Collection<NetworkPlayerInfo> p_i45493_1_) { this.field_178673_b = Lists.<ISpectatorMenuObject>newArrayList(); for (NetworkPlayerInfo networkplayerinfo : field_178674_a.sortedCopy(p_i45493_1_)) { if (networkplayerinfo.getGameType() != WorldSettings.GameType.SPECTATOR) { this.field_178673_b.add(new PlayerMenuObject(networkplayerinfo.getGameProfile())); } } }
protected void drawPing(int p_175245_1_, int p_175245_2_, int p_175245_3_, NetworkPlayerInfo networkPlayerInfoIn) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(icons); int i = 0; int j = 0; if (networkPlayerInfoIn.getResponseTime() < 0) { j = 5; } else if (networkPlayerInfoIn.getResponseTime() < 150) { j = 0; } else if (networkPlayerInfoIn.getResponseTime() < 300) { j = 1; } else if (networkPlayerInfoIn.getResponseTime() < 600) { j = 2; } else if (networkPlayerInfoIn.getResponseTime() < 1000) { j = 3; } else { j = 4; } this.zLevel += 100.0F; this.drawTexturedModalRect(p_175245_2_ + p_175245_1_ - 11, p_175245_3_, 0 + i * 10, 176 + j * 8, 10, 8); this.zLevel -= 100.0F; }
@Override public void onEnable() { index = 0; timer = -1; players.clear(); for(NetworkPlayerInfo info : WMinecraft.getConnection() .getPlayerInfoMap()) { String name = info.getPlayerNameForReal(); name = StringUtils.stripControlCodes(name); if(name.equals(WMinecraft.getPlayer().getName())) continue; players.add(name); } Collections.shuffle(players, random); wurst.events.add(ChatInputListener.class, this); wurst.events.add(UpdateListener.class, this); if(players.isEmpty()) { ChatUtils.error("Couldn't find any players."); setEnabled(false); } }
@Nullable protected NetworkPlayerInfo getPlayerInfo() { if (this.playerInfo == null) { this.playerInfo = Minecraft.getMinecraft().getConnection().getPlayerInfo(this.getUniqueID()); } return this.playerInfo; }
@Nullable public ResourceLocation getLocationCape() { if (!Config.isShowCapes()) { return null; } else if (CapesAPI.hasCape(getGameProfile().getId())) { return CapesAPI.getCape(getGameProfile().getId()); } else if (this.locationOfCape != null) { return this.locationOfCape; } else { NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo(); return networkplayerinfo == null ? null : networkplayerinfo.getLocationCape(); } }
@Nullable /** * Gets the special Elytra texture for the player. */ public ResourceLocation getLocationElytra() { NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo(); return networkplayerinfo == null ? null : networkplayerinfo.getLocationElytra(); }
public DashNames() { super("Dash Names", 0x85FF8F, ModuleCategory.TWEAKS); listeners.add(new Listener<SendChat>() { @Override public void call(SendChat event) { String changed = event.getMessage(); for (Object o : mc.getNetHandler().getPlayerInfoMap()) { NetworkPlayerInfo info = (NetworkPlayerInfo) o; String name = info.getGameProfile().getName(); for (Map.Entry<String, String> entry : Serenity.getInstance().getFriendManager().getFriends().entrySet()) { if (entry.getKey().equals(entry.getValue())) continue; if (name.equalsIgnoreCase(entry.getKey())) { changed = changed.replaceAll("(?i)-" + entry.getValue(), name); } } } event.setMessage(changed); } }); setHidden(true); setState(true); }
public TeleportToPlayer(Collection<NetworkPlayerInfo> p_i45493_1_) { this.items = Lists.<ISpectatorMenuObject>newArrayList(); for (NetworkPlayerInfo networkplayerinfo : PROFILE_ORDER.sortedCopy(p_i45493_1_)) { if (networkplayerinfo.getGameType() != GameType.SPECTATOR) { this.items.add(new PlayerMenuObject(networkplayerinfo.getGameProfile())); } } }
protected void drawPing(int p_175245_1_, int p_175245_2_, int p_175245_3_, NetworkPlayerInfo networkPlayerInfoIn) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(ICONS); int i = 0; int j; if (networkPlayerInfoIn.getResponseTime() < 0) { j = 5; } else if (networkPlayerInfoIn.getResponseTime() < 150) { j = 0; } else if (networkPlayerInfoIn.getResponseTime() < 300) { j = 1; } else if (networkPlayerInfoIn.getResponseTime() < 600) { j = 2; } else if (networkPlayerInfoIn.getResponseTime() < 1000) { j = 3; } else { j = 4; } this.zLevel += 100.0F; this.drawTexturedModalRect(p_175245_2_ + p_175245_1_ - 11, p_175245_3_, 0, 176 + j * 8, 10, 8); this.zLevel -= 100.0F; }
/** * Gets the special Elytra texture for the player. */ @Nullable public ResourceLocation getLocationElytra() { NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo(); return networkplayerinfo == null ? null : networkplayerinfo.getLocationElytra(); }
public AbstractClientPlayerVisitorMethodGetLocationCape(MethodVisitor mv) { super(Opcodes.ASM5, mv); try { method = Method.getMethod(AbstractClientPlayerVisitor.class.getMethod("injectMethod", NetworkPlayerInfo.class)); } catch (Exception e) { throw Throwables.propagate(e); } ASMUtil.asmLogger(ASMLogType.INJECTING, AbstractClientPlayerVisitor.class + "." + method.toString()); }
private String getPingInformation() { NetHandlerPlayClient handler = mc.thePlayer.sendQueue; if (handler == null) return "?"; NetworkPlayerInfo info = handler.getPlayerInfo(handler.getGameProfile().getId()); if (info == null) return "?"; int ping = info.getResponseTime(); if (ping == 0) return "?"; return "" + ping; }
@SideOnly(Side.CLIENT) @Hook("net.minecraft.client.network.NetworkPlayerInfo#func_178837_g") public static Hook.Result getLocationSkin(NetworkPlayerInfo playerInfo) { if (playerInfo.getGameProfile() == null) return Hook.Result.VOID; EntityPlayer player = Minecraft.getMinecraft().theWorld.getPlayerEntityByUUID(playerInfo.getGameProfile().getId()); if (player == null) return Hook.Result.VOID; ResourceLocation skin = player.getCapability(SkinCore.skin_info, null).skin_mapping.get(Type.SKIN); return skin == null ? Hook.Result.VOID : new Hook.Result(skin); }
@SideOnly(Side.CLIENT) @Hook("net.minecraft.client.network.NetworkPlayerInfo#func_178851_f") public static Hook.Result getSkinType(NetworkPlayerInfo playerInfo) { if (playerInfo.getGameProfile() == null) return Hook.Result.VOID; EntityPlayer player = Minecraft.getMinecraft().theWorld.getPlayerEntityByUUID(playerInfo.getGameProfile().getId()); if (player == null) return Hook.Result.VOID; String type = player.getCapability(SkinCore.skin_info, null).skin_type; return type == null || type.isEmpty() ? Hook.Result.VOID : new Hook.Result(type); }