Registration

This commit is contained in:
NuclearW 2012-05-17 20:01:37 -04:00
parent d139146e0b
commit bd3491d210
2 changed files with 20 additions and 3 deletions

View File

@ -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<Repairable> to register
*/
public void registerRepairables(List<Repairable> repairables);
/**
* Checks if an item is repairable
*

View File

@ -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<Repairable> 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