Class PickupRequestResolver
java.lang.Object
com.minecolonies.core.colony.requestsystem.resolvers.core.AbstractRequestResolver<Pickup>
com.minecolonies.core.colony.requestsystem.resolvers.DeliverymenRequestResolver<Pickup>
com.minecolonies.core.colony.requestsystem.resolvers.PickupRequestResolver
- All Implemented Interfaces:
IRequester,IRequestResolver<Pickup>
Resolver that handles pickup requests. Pickups don't have much logic inherently, because the only important information are the requester and the priority. These resolvers are
supposed to be provided by deliverymen.
Currently, this resolver will iterate through all available deliverymen and find the one with the least amount of open requests, followed by the one that is nearest.
There is a tiny bit of (known) code-smell in here, since this resolver should either be global or specific to a hut. Currently, it is a hut-specific resolver that acts as if it were global. The performance impact is negligible though.
-
Constructor Summary
ConstructorsConstructorDescriptionPickupRequestResolver(@NotNull ILocation location, @NotNull IToken<?> token) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanResolveRequest(@NotNull IRequestManager manager, IRequest<? extends Pickup> requestToCheck) A PreCheck used to determine if this request resolver is able to resolve a given request.com.google.common.reflect.TypeToken<? extends Pickup> Used to determine which type of requests can be resolved by this Resolver.intgetSuitabilityMetric(@NotNull IRequestManager manager, @NotNull IRequest<? extends Pickup> request) Check how suitable this resolver is for the request.Methods inherited from class com.minecolonies.core.colony.requestsystem.resolvers.DeliverymenRequestResolver
attemptResolveRequest, getFollowupRequestForCompletion, getRequesterDisplayName, hasCouriers, isValid, onAssignedRequestBeingCancelled, onAssignedRequestCancelled, onRequestedRequestCancelled, onRequestedRequestComplete, resolveRequestMethods inherited from class com.minecolonies.core.colony.requestsystem.resolvers.core.AbstractRequestResolver
getId, getLocation, getPriorityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.requestsystem.resolver.IRequestResolver
onColonyUpdate, onRequestAssigned
-
Constructor Details
-
PickupRequestResolver
-
-
Method Details
-
getSuitabilityMetric
public int getSuitabilityMetric(@NotNull @NotNull IRequestManager manager, @NotNull @NotNull IRequest<? extends Pickup> request) Description copied from interface:IRequestResolverCheck how suitable this resolver is for the request.- Specified by:
getSuitabilityMetricin interfaceIRequestResolver<Pickup>- Overrides:
getSuitabilityMetricin classDeliverymenRequestResolver<Pickup>- Parameters:
manager- the req manager.request- the request to check.- Returns:
- the suitability metric (an int for easy comparison).
-
canResolveRequest
public boolean canResolveRequest(@NotNull @NotNull IRequestManager manager, IRequest<? extends Pickup> requestToCheck) Description copied from interface:IRequestResolverA PreCheck used to determine if this request resolver is able to resolve a given request. Should quickly and cheaply check if this resolver COULD resolve this request.- Specified by:
canResolveRequestin interfaceIRequestResolver<Pickup>- Overrides:
canResolveRequestin classDeliverymenRequestResolver<Pickup>- Parameters:
manager- The manager that is checking if this resolver could resolve that request.requestToCheck- The request to check.- Returns:
- True when this resolver COULD resolve the given request, false when not.
-
getRequestType
Description copied from interface:IRequestResolverUsed to determine which type of requests can be resolved by this Resolver.- Returns:
- The class that represents this Type of Request this resolver can resolve.
-