use of com.minecolonies.coremod.colony.jobs.JobBuilder in project minecolonies by Minecolonies.
the class WorkOrderBuildDecoration method attemptToFulfill.
/**
* Attempt to fulfill the Work Order.
* Override this with an implementation for the Work Order to find a Citizen to perform the job
* <p>
* finds the first suitable builder for this job.
*
* @param colony The colony that owns the Work Order.
*/
@Override
public void attemptToFulfill(@NotNull final Colony colony) {
boolean sendMessage = true;
boolean hasBuilder = false;
for (@NotNull final CitizenData citizen : colony.getCitizens().values()) {
final JobBuilder job = citizen.getJob(JobBuilder.class);
if (job == null || citizen.getWorkBuilding() == null) {
continue;
}
hasBuilder = true;
// don't send a message if we have a valid worker that is busy.
if (canBuild(citizen)) {
sendMessage = false;
}
if (!job.hasWorkOrder() && canBuild(citizen)) {
job.setWorkOrder(this);
this.setClaimedBy(citizen);
return;
}
}
sendBuilderMessage(colony, hasBuilder, sendMessage);
}
Aggregations