Make use of enum

This commit is contained in:
NuclearW 2012-05-17 09:18:20 -04:00
parent a8eb9dfedf
commit efc9a10fdf
3 changed files with 31 additions and 3 deletions

View File

@ -22,6 +22,20 @@ public interface Repairable {
*/ */
public byte getRepairMaterialMetadata(); 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 * Gets the minimum quantity of repair materials ignoring all other repair bonuses
* *

View File

@ -1,8 +1,8 @@
package com.gmail.nossr50.skills.repair; package com.gmail.nossr50.skills.repair;
public class RepairableFactory { 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. // 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);
} }
} }

View File

@ -4,11 +4,15 @@ public class SimpleRepairable implements Repairable {
private final int itemId, repairMaterialId, minimumQuantity, minimumLevel; private final int itemId, repairMaterialId, minimumQuantity, minimumLevel;
private final short maximumDurability, baseRepairDurability; private final short maximumDurability, baseRepairDurability;
private final byte repairMetadata; 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.itemId = itemId;
this.repairMaterialId = repairMaterialId; this.repairMaterialId = repairMaterialId;
this.repairMetadata = repairMetadata; this.repairMetadata = repairMetadata;
this.repairItemType = repairItemType;
this.repairMaterialType = repairMaterialType;
this.minimumLevel = minimumLevel; this.minimumLevel = minimumLevel;
this.minimumQuantity = minimumQuantity; this.minimumQuantity = minimumQuantity;
this.maximumDurability = maximumDurability; this.maximumDurability = maximumDurability;
@ -30,6 +34,16 @@ public class SimpleRepairable implements Repairable {
return repairMetadata; return repairMetadata;
} }
@Override
public RepairItemType getRepairItemType() {
return repairItemType;
}
@Override
public RepairMaterialType getRepairMaterialType() {
return repairMaterialType;
}
@Override @Override
public int getMinimumQuantity() { public int getMinimumQuantity() {
return minimumQuantity; return minimumQuantity;