1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Validate progress arguments

This commit is contained in:
TheBusyBiscuit 2021-05-24 11:23:36 +02:00
parent 466990a03e
commit fd2d30a3ae
4 changed files with 31 additions and 1 deletions

View File

@ -27,9 +27,14 @@
## Release Candidate 24 (TBD)
#### Additions
* (API) Added AsyncMachineOperationFinishEvent
* The speed of the Ancient Altar can now be configured in the `Items.yml` file
#### Changes
* (API) Refactored "Machine Process" API
* (API) Deprecated AsyncGeneratorProcessCompleteEvent
* (API) Deprecated AsyncMachineProcessCompleteEvent
* (API) Deprecated AsyncReactorProcessCompleteEvent
#### Fixes
* Fixed #3064
@ -64,7 +69,6 @@ https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#23
* Tin Cans can no longer be placed
* Magical Glass can no longer be placed
* (API) Removed deprecated "SlimefunBlockHandler"
* (API) Refactored "Machine Process" API
* Removed Automated Crafting Chamber
* Memory and performance improvements for Cargo and Energy networks

View File

@ -8,6 +8,12 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.core.machines.MachineOperation;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
/**
* This {@link MachineOperation} represents a crafting process.
*
* @author TheBusyBiscuit
*
*/
public class CraftingOperation implements MachineOperation {
private final ItemStack[] ingredients;
@ -32,6 +38,7 @@ public class CraftingOperation implements MachineOperation {
@Override
public void addProgress(int num) {
Validate.isTrue(num > 0, "Progress must be positive.");
currentTicks += num;
}

View File

@ -9,6 +9,12 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.core.machines.MachineOperation;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
/**
* This {@link MachineOperation} represents the process of burning fuel.
*
* @author TheBusyBiscuit
*
*/
public class FuelOperation implements MachineOperation {
private final ItemStack ingredient;
@ -32,6 +38,7 @@ public class FuelOperation implements MachineOperation {
@Override
public void addProgress(int num) {
Validate.isTrue(num > 0, "Progress must be positive.");
currentTicks += num;
}

View File

@ -5,8 +5,19 @@ import javax.annotation.Nonnull;
import org.apache.commons.lang.Validate;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource;
import io.github.thebusybiscuit.slimefun4.core.machines.MachineOperation;
import io.github.thebusybiscuit.slimefun4.implementation.items.geo.GEOMiner;
/**
* This {@link MachineOperation} represents a {@link GEOMiner}
* mining a {@link GEOResource}.
*
* @author TheBusyBiscuit
*
* @see GEOMiner
*
*/
public class MiningOperation implements MachineOperation {
private final ItemStack result;
@ -24,6 +35,7 @@ public class MiningOperation implements MachineOperation {
@Override
public void addProgress(int num) {
Validate.isTrue(num > 0, "Progress must be positive.");
currentTicks += num;
}