RepairTransaction.java 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.gmail.nossr50.skills.repair;
  2. import org.bukkit.inventory.PlayerInventory;
  3. import java.util.HashSet;
  4. /**
  5. * Represents a complete "repair transaction"
  6. *
  7. * I will define a "repair transaction" as such
  8. * - The items used to pay the cost of repairing an item in mcMMO via the Repair Skill
  9. *
  10. * A single "RepairTransaction" is made up of a multiple RepairCost objects
  11. * No two RepairCosts contained within this type can be exact duplicates
  12. *
  13. * A RepairCost is used to find a matching ItemStack in a players inventory if one exists to pay its cost
  14. *
  15. * A RepairCost can be a single item or it can be multiple items representing a range of compatible items
  16. * to pay that part of the RepairTransaction
  17. */
  18. public class RepairTransaction {
  19. private HashSet<RepairCost> repairCosts;
  20. public RepairTransaction() {
  21. repairCosts = new HashSet<>();
  22. }
  23. public void addRepairCost(RepairCost repairCost) {
  24. repairCosts.add(repairCost);
  25. }
  26. public HashSet<RepairCost> getRepairCosts() {
  27. return repairCosts;
  28. }
  29. public void setRepairCosts(HashSet<RepairCost> repairItems) {
  30. this.repairCosts = repairItems;
  31. }
  32. public boolean canPayRepairCosts(PlayerInventory playerInventory) {
  33. return true;
  34. }
  35. }