3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-08 17:20:24 +01:00

fix server icon

Dieser Commit ist enthalten in:
dinnerwolph 2018-07-21 02:51:07 +02:00
Ursprung 7c0c4ee74d
Commit 3646fad197

Datei anzeigen

@ -1,5 +1,7 @@
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.chat.ComponentSerializer;
@ -17,7 +19,6 @@ import us.myles.ViaVersion.api.remapper.ValueCreator;
import us.myles.ViaVersion.api.remapper.ValueTransformer;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.EntityPackets;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
@ -28,6 +29,8 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.BlockStorage;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.EntityTracker;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.TabCompleteTracker;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Particle1_13Type;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import us.myles.ViaVersion.util.GsonUtil;
import java.util.Map;
@ -118,6 +121,28 @@ public class Protocol1_13To1_12_2 extends Protocol {
// Outgoing packets
registerOutgoing(State.STATUS, 0x00, 0x00, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING);
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
String response = wrapper.get(Type.STRING, 0);
try {
JsonObject json = GsonUtil.getGson().fromJson(response, JsonObject.class);
if (json.has("favicon")) {
json.addProperty("favicon", json.get("favicon").getAsString().replace("\n", ""));
}
wrapper.set(Type.STRING, 0, GsonUtil.getGson().toJson(json));
} catch (JsonParseException e) {
e.printStackTrace();
}
}
});
}
});
// New packet 0x04 - Login Plugin Message
// Statistics