From efc9a10fdfa256a67c58c6c516e3ca99aa5c4fa8 Mon Sep 17 00:00:00 2001 From: NuclearW Date: Thu, 17 May 2012 09:18:20 -0400 Subject: [PATCH] Make use of enum --- .../gmail/nossr50/skills/repair/Repairable.java | 14 ++++++++++++++ .../nossr50/skills/repair/RepairableFactory.java | 4 ++-- .../nossr50/skills/repair/SimpleRepairable.java | 16 +++++++++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Repairable.java b/src/main/java/com/gmail/nossr50/skills/repair/Repairable.java index 45926b5d5..ddd225dea 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Repairable.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Repairable.java @@ -22,6 +22,20 @@ public interface Repairable { */ public byte getRepairMaterialMetadata(); + /** + * Gets the RepairItemType value for this repairable item + * + * @return the RepairItemType for this repairable + */ + public RepairItemType getRepairItemType(); + + /** + * Gets the RepairMaterialType value for this repairable item + * + * @return the RepairMaterialType for this repairable + */ + public RepairMaterialType getRepairMaterialType(); + /** * Gets the minimum quantity of repair materials ignoring all other repair bonuses * diff --git a/src/main/java/com/gmail/nossr50/skills/repair/RepairableFactory.java b/src/main/java/com/gmail/nossr50/skills/repair/RepairableFactory.java index 4ecab3a31..dfe0caef0 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairableFactory.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairableFactory.java @@ -1,8 +1,8 @@ package com.gmail.nossr50.skills.repair; public class RepairableFactory { - public static Repairable getRepairable(int itemId, int repairMaterialId, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability) { + public static Repairable getRepairable(int itemId, int repairMaterialId, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType) { // TODO: Add in loading from config what type of manager we want. - return new SimpleRepairable(itemId, repairMaterialId, repairMetadata, minimumLevel, minimumQuantity, maximumDurability); + return new SimpleRepairable(itemId, repairMaterialId, repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType); } } diff --git a/src/main/java/com/gmail/nossr50/skills/repair/SimpleRepairable.java b/src/main/java/com/gmail/nossr50/skills/repair/SimpleRepairable.java index fd9721387..94567b402 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/SimpleRepairable.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/SimpleRepairable.java @@ -4,11 +4,15 @@ public class SimpleRepairable implements Repairable { private final int itemId, repairMaterialId, minimumQuantity, minimumLevel; private final short maximumDurability, baseRepairDurability; private final byte repairMetadata; + private final RepairItemType repairItemType; + private final RepairMaterialType repairMaterialType; - protected SimpleRepairable(int itemId, int repairMaterialId, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability) { + protected SimpleRepairable(int itemId, int repairMaterialId, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType) { this.itemId = itemId; this.repairMaterialId = repairMaterialId; this.repairMetadata = repairMetadata; + this.repairItemType = repairItemType; + this.repairMaterialType = repairMaterialType; this.minimumLevel = minimumLevel; this.minimumQuantity = minimumQuantity; this.maximumDurability = maximumDurability; @@ -30,6 +34,16 @@ public class SimpleRepairable implements Repairable { return repairMetadata; } + @Override + public RepairItemType getRepairItemType() { + return repairItemType; + } + + @Override + public RepairMaterialType getRepairMaterialType() { + return repairMaterialType; + } + @Override public int getMinimumQuantity() { return minimumQuantity;