Module edu.ntnu.idatt2001.paths
Class InventoryRemoveAllAction
java.lang.Object
edu.ntnu.idatt2001.paths.models.actions.InventoryRemoveAllAction
InventoryRemoveAllAction class.
Removes items of a player's inventory when executed.
Which items to remove is defined when instantiated.
All instances of the item are removed.
If the item does not exist in the player's inventory, nothing happens.
- Version:
- 0.5 - 29.04.2023
- Author:
- Carl G. Callum G.
-
Constructor Summary
ConstructorDescriptionInstantiates a new Inventory remove all action and sets the item to remove from the player's inventory. -
Method Summary
-
Constructor Details
-
InventoryRemoveAllAction
Instantiates a new Inventory remove all action and sets the item to remove from the player's inventory.- Parameters:
item
- String - a non-null and non-empty string representing the item to remove- Throws:
NullPointerException
- thrown if the item is nullIllegalArgumentException
- thrown if the item is null or only whitespace
-
-
Method Details
-
execute
Executes an action on a player. Calls the removeFromInventory method on the player with a set item.- Specified by:
execute
in interfaceAction<String>
- Parameters:
player
- Player - the player to execute the action on- Throws:
NullPointerException
- if player is null- See Also:
-
getValue
Get method for the action's value.
-