Add ProtocolManager#hasLoadedMappings

This commit is contained in:
Nassim Jahnke 2024-02-15 18:27:52 +01:00
parent ff25cbd6eb
commit a8fbb000eb
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 16 additions and 4 deletions

View File

@ -168,10 +168,10 @@ public interface ProtocolManager {
* @throws IllegalArgumentException if both packet classes are null * @throws IllegalArgumentException if both packet classes are null
*/ */
<C extends ClientboundPacketType, <C extends ClientboundPacketType,
S extends ServerboundPacketType S extends ServerboundPacketType
> VersionedPacketTransformer<C, S> createPacketTransformer(ProtocolVersion inputVersion, > VersionedPacketTransformer<C, S> createPacketTransformer(ProtocolVersion inputVersion,
@Nullable Class<C> clientboundPacketsClass, @Nullable Class<C> clientboundPacketsClass,
@Nullable Class<S> serverboundPacketsClass); @Nullable Class<S> serverboundPacketsClass);
/** /**
* Sets the max delta the path calculation allows the distance to the target protocol version to increase. * Sets the max delta the path calculation allows the distance to the target protocol version to increase.
@ -311,4 +311,11 @@ public interface ProtocolManager {
*/ */
@Deprecated @Deprecated
PacketWrapper createPacketWrapper(int packetId, @Nullable ByteBuf buf, UserConnection connection); PacketWrapper createPacketWrapper(int packetId, @Nullable ByteBuf buf, UserConnection connection);
/**
* Returns whether the mappings have been loaded and the mapping loader executor shutdown.
*
* @return whether the mappings have been loaded
*/
boolean hasLoadedMappings();
} }

View File

@ -503,6 +503,11 @@ public class ProtocolManagerImpl implements ProtocolManager {
return new PacketWrapperImpl(packetId, buf, connection); return new PacketWrapperImpl(packetId, buf, connection);
} }
@Override
public boolean hasLoadedMappings() {
return mappingsLoaded;
}
public void shutdownLoaderExecutor() { public void shutdownLoaderExecutor() {
Preconditions.checkArgument(!mappingsLoaded); Preconditions.checkArgument(!mappingsLoaded);