use of com.minecolonies.coremod.colony.interactionhandling.RequestBasedInteraction in project minecolonies by Minecolonies.
the class AbstractBuilding method createRequest.
/**
* Create a request for a citizen.
*
* @param citizenData the data of the citizen.
* @param requested the request to create.
* @param async if async or not.
* @param <R> the type of the request.
* @return the Token of the request.
*/
@Override
public <R extends IRequestable> IToken<?> createRequest(@NotNull final ICitizenData citizenData, @NotNull final R requested, final boolean async) {
final IToken<?> requestToken = colony.getRequestManager().createRequest(requester, requested);
final IRequest<?> request = colony.getRequestManager().getRequestForToken(requestToken);
if (async) {
citizenData.getJob().getAsyncRequests().add(requestToken);
citizenData.triggerInteraction(new RequestBasedInteraction(new TranslationTextComponent(ASYNC_REQUEST, request.getShortDisplayString()), ChatPriority.PENDING, new TranslationTextComponent(NORMAL_REQUEST), request.getId()));
} else {
citizenData.triggerInteraction(new RequestBasedInteraction(new TranslationTextComponent(NORMAL_REQUEST, request.getShortDisplayString()), ChatPriority.BLOCKING, new TranslationTextComponent(NORMAL_REQUEST), request.getId()));
}
addRequestToMaps(citizenData.getId(), requestToken, TypeToken.of(requested.getClass()));
colony.getRequestManager().assignRequest(requestToken);
markDirty();
return requestToken;
}
use of com.minecolonies.coremod.colony.interactionhandling.RequestBasedInteraction in project minecolonies by ldtteam.
the class AbstractBuilding method createRequest.
/**
* Create a request for a citizen.
*
* @param citizenData the data of the citizen.
* @param requested the request to create.
* @param async if async or not.
* @param <R> the type of the request.
* @return the Token of the request.
*/
@Override
public <R extends IRequestable> IToken<?> createRequest(@NotNull final ICitizenData citizenData, @NotNull final R requested, final boolean async) {
final IToken<?> requestToken = colony.getRequestManager().createRequest(requester, requested);
final IRequest<?> request = colony.getRequestManager().getRequestForToken(requestToken);
if (async) {
citizenData.getJob().getAsyncRequests().add(requestToken);
citizenData.triggerInteraction(new RequestBasedInteraction(new TranslationTextComponent(ASYNC_REQUEST, request.getShortDisplayString()), ChatPriority.PENDING, new TranslationTextComponent(NORMAL_REQUEST), request.getId()));
} else {
citizenData.triggerInteraction(new RequestBasedInteraction(new TranslationTextComponent(NORMAL_REQUEST, request.getShortDisplayString()), ChatPriority.BLOCKING, new TranslationTextComponent(NORMAL_REQUEST), request.getId()));
}
addRequestToMaps(citizenData.getId(), requestToken, TypeToken.of(requested.getClass()));
colony.getRequestManager().assignRequest(requestToken);
markDirty();
return requestToken;
}
Aggregations