Cancel the packet that caused non x character crash for now & check for empty custom names

This commit is contained in:
Matsv 2018-01-04 16:00:55 +01:00
parent 9dfbe3b263
commit c43e702ed9
2 changed files with 20 additions and 4 deletions

View File

@ -20,10 +20,14 @@ public class MetadataRewriter {
if (metadata.getMetaType().getTypeID() > 4)
metadata.setMetaType(MetaType1_13.byId(metadata.getMetaType().getTypeID() + 1));
// TODO Fix displayname
// Handle String -> Chat DisplayName
if (metadata.getId() == 2) {
metadata.setMetaType(MetaType1_13.OptChat);
metadata.setValue(metadata.getValue() != null ? Protocol1_9TO1_8.fixJson((String) metadata.getValue()) : null);
if (metadata.getValue() != null && !((String) metadata.getValue()).isEmpty()) {
metadata.setValue(Protocol1_9TO1_8.fixJson((String) metadata.getValue()));
} else {
metadata.setValue(null);
}
}
// 1.13 changed item to flat item (no data)

View File

@ -33,7 +33,7 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
// Outgoing packets
// Statistics
registerOutgoing(State.PLAY, 0x7, 0x7, new PacketRemapper() {
registerOutgoing(State.PLAY, 0x07, 0x07, new PacketRemapper() {
@Override
public void registerMap() {
// TODO: This packet has changed
@ -253,7 +253,19 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
registerOutgoing(State.PLAY, 0x4A, 0x4D);
registerOutgoing(State.PLAY, 0x4B, 0x4E);
registerOutgoing(State.PLAY, 0x4C, 0x4F);
registerOutgoing(State.PLAY, 0x4D, 0x50);
// Advancements
registerOutgoing(State.PLAY, 0x4D, 0x50, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
// TODO Temporary cancel advancements because of 'Non [a-z0-9/._-] character in path of location: minecraft:? https://fs.matsv.nl/media?id=auwje4z4lxw.png
wrapper.cancel();
}
});
}
});
registerOutgoing(State.PLAY, 0x4E, 0x51);
registerOutgoing(State.PLAY, 0x4F, 0x52);
// New packet 0x52 - Declare Recipes