Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2025-01-11 23:51:04 +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:
Ursprung
87aed8f3f2
Commit
a5a789c440
@ -52,7 +52,6 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends En
|
|||||||
private final MetaType displayVisibilityMetaType;
|
private final MetaType displayVisibilityMetaType;
|
||||||
private final int displayNameIndex;
|
private final int displayNameIndex;
|
||||||
private final int displayVisibilityIndex;
|
private final int displayVisibilityIndex;
|
||||||
protected boolean allowNullEntityType;
|
|
||||||
|
|
||||||
EntityRewriterBase(T protocol, MetaType displayNameMetaType, int displayNameIndex,
|
EntityRewriterBase(T protocol, MetaType displayNameMetaType, int displayNameIndex,
|
||||||
MetaType displayVisibilityMetaType, int displayVisibilityIndex) {
|
MetaType displayVisibilityMetaType, int displayVisibilityIndex) {
|
||||||
@ -65,13 +64,9 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends En
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMetadata(int entityId, List<Metadata> metadataList, UserConnection connection) {
|
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);
|
super.handleMetadata(entityId, metadataList, connection);
|
||||||
|
|
||||||
|
EntityType type = tracker(connection).entityType(entityId);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
return; // Don't handle untracked entities - basically always the fault of a plugin sending virtual entities through concurrency-unsafe handling
|
return; // Don't handle untracked entities - basically always the fault of a plugin sending virtual entities through concurrency-unsafe handling
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@ public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18
|
|||||||
|
|
||||||
public EntityPackets1_18(final Protocol1_17_1To1_18 protocol) {
|
public EntityPackets1_18(final Protocol1_17_1To1_18 protocol) {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
allowNullEntityType = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren