3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00

Reuse previously sent enforces-secure-chat value

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-04-22 16:05:40 +02:00
Ursprung 079671060c
Commit 5069b26c2f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
3 geänderte Dateien mit 14 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -197,8 +197,6 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
final String dimensionKey = wrapper.read(Type.STRING); final String dimensionKey = wrapper.read(Type.STRING);
final DimensionData data = tracker(wrapper.user()).dimensionData(dimensionKey); final DimensionData data = tracker(wrapper.user()).dimensionData(dimensionKey);
wrapper.write(Type.VAR_INT, data.id()); wrapper.write(Type.VAR_INT, data.id());
wrapper.user().get(AcknowledgedMessagesStorage.class).clear();
}); });
map(Type.STRING); // World map(Type.STRING); // World
map(Type.LONG); // Seed map(Type.LONG); // Seed
@ -208,10 +206,17 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
map(Type.BOOLEAN); // Flat map(Type.BOOLEAN); // Flat
map(Type.OPTIONAL_GLOBAL_POSITION); // Last death location map(Type.OPTIONAL_GLOBAL_POSITION); // Last death location
map(Type.VAR_INT); // Portal cooldown map(Type.VAR_INT); // Portal cooldown
create(Type.BOOLEAN, false); // Enforces secure chat - moved from server data (which is unfortunately sent a while after this)
handler(worldDataTrackerHandlerByKey1_20_5(3)); // Tracks world height and name for chunk data and entity (un)tracking handler(worldDataTrackerHandlerByKey1_20_5(3)); // Tracks world height and name for chunk data and entity (un)tracking
handler(playerTrackerHandler()); handler(playerTrackerHandler());
handler(wrapper -> { handler(wrapper -> {
// Enforces secure chat - moved from server data (which is unfortunately sent a while after this)
// Just put in what we know if this is sent multiple times
final AcknowledgedMessagesStorage storage = wrapper.user().get(AcknowledgedMessagesStorage.class);
wrapper.write(Type.BOOLEAN, storage.isSecureChatEnforced());
storage.clear();
// Handle creative interaction range
final byte gamemode = wrapper.get(Type.BYTE, 0); final byte gamemode = wrapper.get(Type.BYTE, 0);
if (gamemode == CREATIVE_MODE_ID) { if (gamemode == CREATIVE_MODE_ID) {
sendRangeAttributes(wrapper.user(), true); sendRangeAttributes(wrapper.user(), true);

Datei anzeigen

@ -118,4 +118,9 @@ public final class AcknowledgedMessagesStorage implements StorableObject {
this.lastMessage = null; this.lastMessage = null;
Arrays.fill(this.trackedMessages, false); Arrays.fill(this.trackedMessages, false);
} }
@Override
public boolean clearOnServerSwitch() {
return false;
}
} }

Datei anzeigen

@ -4,7 +4,7 @@ metadata.format.version = "1.1"
gson = "2.10.1" gson = "2.10.1"
fastutil = "8.5.12" fastutil = "8.5.12"
vianbt = "4.4.3" vianbt = "4.4.4"
mcstructs = "2.5.0-SNAPSHOT" mcstructs = "2.5.0-SNAPSHOT"
# Common provided # Common provided