Class MachineProcessor<T extends MachineOperation>
java.lang.Object
io.github.thebusybiscuit.slimefun4.core.machines.MachineProcessor<T>
- Type Parameters:
T- The type ofMachineOperationthis processor can hold.
A
MachineProcessor manages different MachineOperations and handles
their progress.- Author:
- TheBusyBiscuit
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMachineProcessor(MachineProcessHolder<T> owner) This creates a newMachineProcessor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanendOperation(io.github.bakedlibs.dough.blocks.BlockPosition pos) This will end theMachineOperationat the givenBlockPosition.booleanendOperation(org.bukkit.block.Block b) This will end theMachineOperationat the givenBlock.booleanendOperation(org.bukkit.Location loc) This will end theMachineOperationat the givenLocation.getOperation(io.github.bakedlibs.dough.blocks.BlockPosition pos) This returns the currentMachineOperationat that givenBlockPosition.getOperation(org.bukkit.block.Block b) This returns the currentMachineOperationat that givenBlock.getOperation(org.bukkit.Location loc) This returns the currentMachineOperationat that givenLocation.getOwner()This returns the owner of thisMachineProcessor.org.bukkit.inventory.ItemStackThis returns the progress bar icon for thisMachineProcessoror null if no progress bar was set.voidsetProgressBar(org.bukkit.inventory.ItemStack progressBar) This sets the progress bar icon for thisMachineProcessor.booleanstartOperation(io.github.bakedlibs.dough.blocks.BlockPosition pos, T operation) This method will actually start theMachineOperation.booleanstartOperation(org.bukkit.block.Block b, T operation) This method will start aMachineOperationat the givenBlock.booleanstartOperation(org.bukkit.Location loc, T operation) This method will start aMachineOperationat the givenLocation.voidupdateProgressBar(BlockMenu inv, int slot, T operation)
-
Constructor Details
-
MachineProcessor
This creates a newMachineProcessor.- Parameters:
owner- The owner of thisMachineProcessor.
-
-
Method Details
-
getOwner
This returns the owner of thisMachineProcessor.- Returns:
- The owner / holder
-
getProgressBar
@Nullable public org.bukkit.inventory.ItemStack getProgressBar()This returns the progress bar icon for thisMachineProcessoror null if no progress bar was set.- Returns:
- The progress bar icon or null
-
setProgressBar
public void setProgressBar(@Nullable org.bukkit.inventory.ItemStack progressBar) This sets the progress bar icon for thisMachineProcessor. You can also set it to null to clear the progress bar.- Parameters:
progressBar- AnItemStackor null
-
startOperation
This method will start aMachineOperationat the givenLocation.- Parameters:
loc- TheLocationat which our machine is located.operation- TheMachineOperationto start- Returns:
- Whether the
MachineOperationwas successfully started. This will return false if anotherMachineOperationhas already been started at thatLocation.
-
startOperation
This method will start aMachineOperationat the givenBlock.- Parameters:
b- TheBlockat which our machine is located.operation- TheMachineOperationto start- Returns:
- Whether the
MachineOperationwas successfully started. This will return false if anotherMachineOperationhas already been started at thatBlock.
-
startOperation
public boolean startOperation(@Nonnull io.github.bakedlibs.dough.blocks.BlockPosition pos, @Nonnull T operation) This method will actually start theMachineOperation.- Parameters:
pos- TheBlockPositionof our machineoperation- TheMachineOperationto start- Returns:
- Whether the
MachineOperationwas successfully started. This will return false if anotherMachineOperationhas already been started at thatBlockPosition.
-
getOperation
This returns the currentMachineOperationat that givenLocation.- Parameters:
loc- TheLocationat which our machine is located.- Returns:
- The current
MachineOperationor null.
-
getOperation
This returns the currentMachineOperationat that givenBlock.- Parameters:
b- TheBlockat which our machine is located.- Returns:
- The current
MachineOperationor null.
-
getOperation
This returns the currentMachineOperationat that givenBlockPosition.- Parameters:
pos- TheBlockPositionat which our machine is located.- Returns:
- The current
MachineOperationor null.
-
endOperation
public boolean endOperation(@Nonnull org.bukkit.Location loc) This will end theMachineOperationat the givenLocation.- Parameters:
loc- TheLocationat which our machine is located.- Returns:
- Whether the
MachineOperationwas successfully ended. This will return false if there was noMachineOperationto begin with.
-
endOperation
public boolean endOperation(@Nonnull org.bukkit.block.Block b) This will end theMachineOperationat the givenBlock.- Parameters:
b- TheBlockat which our machine is located.- Returns:
- Whether the
MachineOperationwas successfully ended. This will return false if there was noMachineOperationto begin with.
-
endOperation
public boolean endOperation(@Nonnull io.github.bakedlibs.dough.blocks.BlockPosition pos) This will end theMachineOperationat the givenBlockPosition.- Parameters:
pos- TheBlockPositionat which our machine is located.- Returns:
- Whether the
MachineOperationwas successfully ended. This will return false if there was noMachineOperationto begin with.
-
updateProgressBar
-