properly throw

This commit is contained in:
xGinko 2023-09-30 12:21:19 +02:00
parent 56bec235c9
commit 3109adb472

View File

@ -26,10 +26,10 @@ public class VillagerOptimizeEvent extends Event implements Cancellable {
public VillagerOptimizeEvent(@NotNull WrappedVillager wrappedVillager, @NotNull OptimizationType type) throws IllegalArgumentException {
this.wrappedVillager = wrappedVillager;
this.type = type;
if (type.equals(OptimizationType.NONE)) {
throw new IllegalArgumentException("Type can't be NONE.");
} else {
this.type = type;
}
}
@ -41,8 +41,12 @@ public class VillagerOptimizeEvent extends Event implements Cancellable {
return type;
}
public void setOptimizationType(@NotNull OptimizationType type) {
this.type = type;
public void setOptimizationType(@NotNull OptimizationType type) throws IllegalArgumentException {
if (type.equals(OptimizationType.NONE)) {
throw new IllegalArgumentException("Type can't be NONE.");
} else {
this.type = type;
}
}
@Override