Minor tweaks

This commit is contained in:
nossr50 2019-09-25 17:47:51 -07:00
parent 20b9b0d0fe
commit f1de5484ec
2 changed files with 15 additions and 4 deletions

View File

@ -60,6 +60,7 @@ import com.gmail.nossr50.datatypes.skills.subskills.taming.TamingSummon;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.RepairCost; import com.gmail.nossr50.skills.repair.RepairCost;
import com.gmail.nossr50.skills.repair.RepairTransaction; import com.gmail.nossr50.skills.repair.RepairTransaction;
import com.gmail.nossr50.skills.repair.SimpleRepairCost;
import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable; import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
import com.gmail.nossr50.util.nbt.RawNBT; import com.gmail.nossr50.util.nbt.RawNBT;
@ -276,7 +277,7 @@ public final class ConfigManager {
customSerializers.registerType(TypeToken.of(ItemMatch.class), new CustomItemTargetSerializer()); customSerializers.registerType(TypeToken.of(ItemMatch.class), new CustomItemTargetSerializer());
customSerializers.registerType(TypeToken.of(RepairTransaction.class), new RepairTransactionSerializer()); customSerializers.registerType(TypeToken.of(RepairTransaction.class), new RepairTransactionSerializer());
customSerializers.registerType(TypeToken.of(RawNBT.class), new RawNBTSerializer()); customSerializers.registerType(TypeToken.of(RawNBT.class), new RawNBTSerializer());
customSerializers.registerType(TypeToken.of(RepairCost.class), new SimpleRepairCostSerializer()); customSerializers.registerType(TypeToken.of(SimpleRepairCost.class), new SimpleRepairCostSerializer());
} }
/** /**

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.skills.repair.repairables; package com.gmail.nossr50.skills.repair.repairables;
import com.gmail.nossr50.datatypes.items.ItemMatch;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -7,7 +8,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
public class RepairableManager { public class RepairableManager {
private HashMap<Material, Repairable> repairables; private HashMap<ItemMatch<?>, Repairable> repairables;
public RepairableManager(List<Repairable> repairablesCollection) { public RepairableManager(List<Repairable> repairablesCollection) {
this.repairables = new HashMap<>(repairablesCollection.size()); this.repairables = new HashMap<>(repairablesCollection.size());
@ -15,8 +16,7 @@ public class RepairableManager {
} }
public void registerRepairable(Repairable repairable) { public void registerRepairable(Repairable repairable) {
Material item = repairable.getItem().getType(); repairables.put(repairable.getItemMatch(), repairable);
repairables.put(item, repairable);
} }
public void registerRepairables(List<Repairable> repairables) { public void registerRepairables(List<Repairable> repairables) {
@ -25,6 +25,16 @@ public class RepairableManager {
} }
} }
//TODO: Make these use item matching
//TODO: Make these use item matching
//TODO: Make these use item matching
//TODO: Make these use item matching
//TODO: Make these use item matching
//TODO: Make these use item matching
//TODO: Make these use item matching
//TODO: Make these use item matching
//TODO: Make these use item matching
//TODO: Make these use item matching
public boolean isRepairable(Material type) { public boolean isRepairable(Material type) {
return repairables.containsKey(type); return repairables.containsKey(type);
} }