/* * Decompiled with CFR 0.152. */ package gearth.misc; import gearth.protocol.HPacket; import java.util.HashMap; public class HostInfo { private final String packetlogger; private final String version; private final HashMap attributes; public HostInfo(String packetlogger, String version, HashMap attributes) { this.packetlogger = packetlogger; this.version = version; this.attributes = attributes; } public static HostInfo fromPacket(HPacket packet) { String packetlogger = packet.readString(); String version = packet.readString(); int attributeCount = packet.readInteger(); HashMap attributes = new HashMap(); for (int i = 0; i < attributeCount; ++i) { String key = packet.readString(); String value = packet.readString(); attributes.put(key, value); } return new HostInfo(packetlogger, version, attributes); } public void appendToPacket(HPacket packet) { packet.appendString(this.packetlogger); packet.appendString(this.version); packet.appendInt(this.attributes.size()); this.attributes.keySet().forEach(k -> { packet.appendString((String)k); packet.appendString(this.attributes.get(k)); }); } public String getPacketlogger() { return this.packetlogger; } public String getVersion() { return this.version; } public HashMap getAttributes() { return this.attributes; } }