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
This commit is contained in:
Nassim Jahnke 2021-12-03 11:00:52 +01:00
parent 87aed8f3f2
commit a5a789c440
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 1 additions and 7 deletions

View File

@ -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
}

View File

@ -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