From bd3491d2108f5584da74aa73e688828c756db1c0 Mon Sep 17 00:00:00 2001 From: NuclearW Date: Thu, 17 May 2012 20:01:37 -0400 Subject: [PATCH] Registration --- .../gmail/nossr50/skills/repair/RepairManager.java | 9 +++++++++ .../nossr50/skills/repair/SimpleRepairManager.java | 14 +++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java index e5d916400..e76b7e488 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java @@ -1,5 +1,7 @@ package com.gmail.nossr50.skills.repair; +import java.util.List; + import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -11,6 +13,13 @@ public interface RepairManager { */ public void registerRepairable(Repairable repairable); + /** + * Register a list of repairables with the RepairManager + * + * @param repairable List to register + */ + public void registerRepairables(List repairables); + /** * Checks if an item is repairable * diff --git a/src/main/java/com/gmail/nossr50/skills/repair/SimpleRepairManager.java b/src/main/java/com/gmail/nossr50/skills/repair/SimpleRepairManager.java index 0ce262529..a92682f99 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/SimpleRepairManager.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/SimpleRepairManager.java @@ -1,6 +1,7 @@ package com.gmail.nossr50.skills.repair; import java.util.HashMap; +import java.util.List; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -18,13 +19,20 @@ public class SimpleRepairManager implements RepairManager { @Override public void registerRepairable(Repairable repairable) { - // TODO Auto-generated method stub + Integer itemId = repairable.getItemId(); + repairables.put(itemId, repairable); + } + + @Override + public void registerRepairables(List repairables) { + for(Repairable repairable : repairables) { + registerRepairable(repairable); + } } @Override public boolean isRepairable(int itemId) { - // TODO Auto-generated method stub - return false; + return repairables.containsKey(itemId); } @Override