Skip to content

Commit 9913377

Browse files
committed
Add more nullable notations and add precondition check
1 parent 99b7f5f commit 9913377

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/io/github/thebusybiscuit/slimefun4/implementation/handlers/MachineBlockBreakHandler.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.github.thebusybiscuit.slimefun4.implementation.handlers;
22

3+
import com.google.common.base.Preconditions;
34
import io.github.thebusybiscuit.slimefun4.core.machines.MachineOperation;
45
import io.github.thebusybiscuit.slimefun4.core.machines.MachineProcessor;
56
import io.github.thebusybiscuit.slimefun4.implementation.operations.CraftingOperation;
@@ -11,6 +12,7 @@
1112
import org.bukkit.inventory.ItemStack;
1213

1314
import javax.annotation.Nonnull;
15+
import javax.annotation.Nullable;
1416

1517
/**
1618
* A {@link SimpleBlockBreakHandler} given the processor and the slots to drop of a machine.
@@ -24,12 +26,13 @@ public class MachineBlockBreakHandler extends SimpleBlockBreakHandler {
2426
private final MachineProcessor<? extends MachineOperation> processor;
2527
private final int[][] slots;
2628

27-
public MachineBlockBreakHandler(MachineProcessor<? extends MachineOperation> processor, int[]... slots) {
29+
public MachineBlockBreakHandler(@Nullable MachineProcessor<? extends MachineOperation> processor, @Nonnull int[]... slots) {
30+
Preconditions.checkNotNull(slots, "MachineBlockBreakHandler doesn't allow null slots, you should probably use another type of SimpleBlockBreakHandler or create your own implementation.");
2831
this.processor = processor;
2932
this.slots = slots;
3033
}
3134

32-
public MachineBlockBreakHandler(int[]... slots) {
35+
public MachineBlockBreakHandler(@Nonnull int[]... slots) {
3336
this(null, slots);
3437
}
3538

0 commit comments

Comments
 (0)