mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-02-24 03:02:08 +01:00
Added old version to ChangeProtocolVersionCallback
This commit is contained in:
parent
8c6babbabf
commit
ae86d923ab
@ -29,11 +29,11 @@ import net.raphimc.vialoader.util.VersionEnum;
|
||||
*/
|
||||
public interface ChangeProtocolVersionCallback {
|
||||
|
||||
Event<ChangeProtocolVersionCallback> EVENT = EventFactory.createArrayBacked(ChangeProtocolVersionCallback.class, listeners -> version -> {
|
||||
Event<ChangeProtocolVersionCallback> EVENT = EventFactory.createArrayBacked(ChangeProtocolVersionCallback.class, listeners -> (oldVersion, newVersion) -> {
|
||||
for (ChangeProtocolVersionCallback listener : listeners) {
|
||||
listener.onChangeProtocolVersion(version);
|
||||
listener.onChangeProtocolVersion(oldVersion, newVersion);
|
||||
}
|
||||
});
|
||||
|
||||
void onChangeProtocolVersion(final VersionEnum protocolVersion);
|
||||
void onChangeProtocolVersion(final VersionEnum oldVersion, final VersionEnum newVersion);
|
||||
}
|
||||
|
@ -140,7 +140,9 @@ public class ProtocolHack {
|
||||
|
||||
final VersionEnum oldVersion = targetVersion;
|
||||
targetVersion = newVersion;
|
||||
if (oldVersion != newVersion) ChangeProtocolVersionCallback.EVENT.invoker().onChangeProtocolVersion(targetVersion);
|
||||
if (oldVersion != newVersion) {
|
||||
ChangeProtocolVersionCallback.EVENT.invoker().onChangeProtocolVersion(oldVersion, targetVersion);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user