Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Player item-klasse
- *
- * @author Terje Nesthus (tne037)
- * @version 1.0
- */
- public class Item
- {
- private String name;
- private String description;
- private String action;
- private int value;
- /**
- * Konstruktør for objekter av klassen Item
- *
- * @param Item name
- * @param Item description
- * @param Item action
- * @param Item value
- */
- public Item(String name, String description, String action, int value)
- {
- this.setName(name);
- this.setDescription(description);
- this.setValue(value);
- this.setAction(action);
- }
- /**
- * Sett item name
- */
- public void setName(String name)
- {
- this.name = Player.checkString(name);
- }
- /**
- * Hent ut item name
- *
- * @return Item name
- */
- public String getName()
- {
- return this.name;
- }
- /**
- * Sett item description
- */
- public void setDescription(String description)
- {
- this.description = Player.checkString(description);
- }
- /**
- * Hent ut item description
- *
- * @return Item description
- */
- public String getDescription()
- {
- return this.description;
- }
- /**
- * Sett item value
- */
- public void setValue(int value)
- {
- this.value = value;
- }
- /**
- * Hent ut item value
- *
- * @return Item value
- */
- public int getValue()
- {
- return this.value;
- }
- /**
- * Sett item action
- */
- public void setAction(String action)
- {
- this.action = Player.checkString(action);
- }
- /**
- * Hent ut item action
- *
- * @return Item action
- */
- public String getAction()
- {
- return this.action;
- }
- /**
- * Method print
- *
- * Prints the Item's name, description and value
- */
- public void print()
- {
- System.out.print(this.getName() + " - ");
- System.out.print(this.getDescription() + " (");
- System.out.println(this.getValue() + ")");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement