Browse Source

getRepairable by id

NuclearW 13 năm trước cách đây
mục cha
commit
8feaf4410f

+ 8 - 0
src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java

@@ -36,6 +36,14 @@ public interface RepairManager {
      */
     public boolean isRepairable(ItemStack itemStack);
 
+    /**
+     * Gets the repairable with this id
+     *
+     * @param id Id of the repairable to look for
+     * @return the repairable, can be null
+     */
+    public Repairable getRepairable(int id);
+
     /**
      * Handle the repairing of this object
      *

+ 5 - 0
src/main/java/com/gmail/nossr50/skills/repair/SimpleRepairManager.java

@@ -52,6 +52,11 @@ public class SimpleRepairManager implements RepairManager {
         return isRepairable(itemStack.getTypeId());
     }
 
+    @Override
+    public Repairable getRepairable(int id) {
+        return repairables.get(id);
+    }
+
     @Override
     public void handleRepair(Player player, ItemStack item) {
         // Load some variables for use