use of com.minecolonies.api.colony.requestsystem.requestable.deliveryman.Pickup in project minecolonies by Minecolonies.
the class AbstractBuilding method createPickupRequest.
@Override
public boolean createPickupRequest(final int scaledPriority) {
if (scaledPriority < 0 || scaledPriority > getPlayerActionPriority(true)) {
return false;
}
final List<IToken<?>> reqs = new ArrayList<>(getOpenRequestsByRequestableType().getOrDefault(TypeConstants.PICKUP, Collections.emptyList()));
if (!reqs.isEmpty()) {
for (final IToken<?> req : reqs) {
final IRequest<?> request = colony.getRequestManager().getRequestForToken(req);
if (request != null && request.getState() == RequestState.IN_PROGRESS) {
final IRequestResolver<?> resolver = colony.getRequestManager().getResolverForRequest(req);
if (resolver instanceof IPlayerRequestResolver || resolver instanceof IRetryingRequestResolver) {
colony.getRequestManager().reassignRequest(req, Collections.emptyList());
}
}
}
return false;
}
createRequest(new Pickup(scaledPriority), true);
return true;
}
use of com.minecolonies.api.colony.requestsystem.requestable.deliveryman.Pickup in project minecolonies by ldtteam.
the class AbstractBuilding method createPickupRequest.
@Override
public boolean createPickupRequest(final int scaledPriority) {
if (scaledPriority < 0 || scaledPriority > getPlayerActionPriority(true)) {
return false;
}
final List<IToken<?>> reqs = new ArrayList<>(getOpenRequestsByRequestableType().getOrDefault(TypeConstants.PICKUP, Collections.emptyList()));
if (!reqs.isEmpty()) {
for (final IToken<?> req : reqs) {
final IRequest<?> request = colony.getRequestManager().getRequestForToken(req);
if (request != null && request.getState() == RequestState.IN_PROGRESS) {
final IRequestResolver<?> resolver = colony.getRequestManager().getResolverForRequest(req);
if (resolver instanceof IPlayerRequestResolver || resolver instanceof IRetryingRequestResolver) {
colony.getRequestManager().reassignRequest(req, Collections.emptyList());
}
}
}
return false;
}
createRequest(new Pickup(scaledPriority), true);
return true;
}
Aggregations