use of com.elmakers.mine.bukkit.api.requirements.RequirementsProcessor in project MagicPlugin by elBukkit.
the class MagicController method checkRequirements.
@Override
@Nullable
public String checkRequirements(@Nonnull CastContext context, @Nullable Collection<Requirement> requirements) {
if (requirements == null)
return null;
for (Requirement requirement : requirements) {
String type = requirement.getType();
RequirementsProcessor processor = requirementProcessors.get(type);
if (processor != null) {
if (!processor.checkRequirement(context, requirement)) {
String message = processor.getRequirementDescription(context, requirement);
if (message == null || message.isEmpty()) {
message = messages.get("requirements.unknown");
}
return message;
}
}
}
return null;
}
Aggregations