3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-20 06:50:10 +01:00

Fix handling of untracked entities

Some simple meta handlers do not go through entity rewriters, suddenly having to deal with invalid metadata because of plugins' bad concurrency handling
Closes #412
Dieser Commit ist enthalten in:
Nassim Jahnke 2021-12-03 11:00:52 +01:00
Ursprung 87aed8f3f2
Commit a5a789c440
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
2 geänderte Dateien mit 1 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -52,7 +52,6 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends En
private final MetaType displayVisibilityMetaType;
private final int displayNameIndex;
private final int displayVisibilityIndex;
protected boolean allowNullEntityType;
EntityRewriterBase(T protocol, MetaType displayNameMetaType, int displayNameIndex,
MetaType displayVisibilityMetaType, int displayVisibilityIndex) {
@ -65,13 +64,9 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends En
@Override
public void handleMetadata(int entityId, List<Metadata> metadataList, UserConnection connection) {
EntityType type = tracker(connection).entityType(entityId);
if (type == null && !allowNullEntityType) {
return;
}
super.handleMetadata(entityId, metadataList, connection);
EntityType type = tracker(connection).entityType(entityId);
if (type == null) {
return; // Don't handle untracked entities - basically always the fault of a plugin sending virtual entities through concurrency-unsafe handling
}

Datei anzeigen

@ -38,7 +38,6 @@ public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18
public EntityPackets1_18(final Protocol1_17_1To1_18 protocol) {
super(protocol);
allowNullEntityType = true;
}
@Override