Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 17:10:13 +01:00
Delay ack by a tick, update warning for bad dimension registry
Dieser Commit ist enthalten in:
Ursprung
12d538fe0d
Commit
189b244a3a
@ -36,7 +36,7 @@ public final class BukkitAckSequenceProvider extends AckSequenceProvider {
|
|||||||
final SequenceStorage sequenceStorage = connection.get(SequenceStorage.class);
|
final SequenceStorage sequenceStorage = connection.get(SequenceStorage.class);
|
||||||
final int previousSequence = sequenceStorage.setSequenceId(sequence);
|
final int previousSequence = sequenceStorage.setSequenceId(sequence);
|
||||||
if (previousSequence == -1) {
|
if (previousSequence == -1) {
|
||||||
plugin.getServer().getScheduler().runTask(plugin, new AckSequenceTask(connection, sequenceStorage));
|
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new AckSequenceTask(connection, sequenceStorage), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -309,17 +309,19 @@ public final class EntityPackets extends EntityRewriter<Protocol1_19To1_18_2> {
|
|||||||
final CompoundTag currentDimension = wrapper.read(Type.NBT);
|
final CompoundTag currentDimension = wrapper.read(Type.NBT);
|
||||||
String dimensionKey = registryStorage.dimensionKey(currentDimension);
|
String dimensionKey = registryStorage.dimensionKey(currentDimension);
|
||||||
if (dimensionKey == null) {
|
if (dimensionKey == null) {
|
||||||
Via.getPlatform().getLogger().severe("The server tried to send dimension data from a dimension the client wasn't told about on join. " +
|
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||||
"Plugins and mods have to make sure they are not creating new dimension types while players are online, and proxies need to make sure they don't scramble dimension data." +
|
Via.getPlatform().getLogger().warning("The server tried to send dimension data from a dimension the client wasn't told about on join. " +
|
||||||
" Received dimension: " + currentDimension + ". Known dimensions: " + registryStorage.dimensions());
|
"Plugins and mods have to make sure they are not creating new dimension types while players are online, and proxies need to make sure they don't scramble dimension data." +
|
||||||
|
" Received dimension: " + currentDimension + ". Known dimensions: " + registryStorage.dimensions());
|
||||||
|
}
|
||||||
|
|
||||||
// Try to find the most similar dimension
|
// Try to find the most similar dimension
|
||||||
dimensionKey = registryStorage.dimensions().entrySet().stream()
|
dimensionKey = registryStorage.dimensions().entrySet().stream()
|
||||||
.map(it -> new Pair<>(it, Maps.difference(currentDimension.getValue(), it.getKey().getValue()).entriesInCommon()))
|
.map(it -> new Pair<>(it, Maps.difference(currentDimension.getValue(), it.getKey().getValue()).entriesInCommon()))
|
||||||
.filter(it -> it.value().containsKey("min_y"))
|
.filter(it -> it.value().containsKey("min_y") && it.value().containsKey("height"))
|
||||||
.filter(it -> it.value().containsKey("height"))
|
.max(Comparator.comparingInt(it -> it.value().size()))
|
||||||
.map(it -> new Pair<>(it.key(), it.value().size()))
|
.orElseThrow(() -> new IllegalArgumentException("Dimension not found in registry data from join packet: " + currentDimension))
|
||||||
.max(Comparator.comparingInt(Pair::value))
|
.key().getValue();
|
||||||
.get().key().getValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapper.write(Type.STRING, dimensionKey);
|
wrapper.write(Type.STRING, dimensionKey);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren