Removing unecessary interfaces

This commit is contained in:
nossr50 2019-03-22 13:29:51 -07:00
parent 7aea4e1d92
commit bf8e3d5a08
4 changed files with 33 additions and 27 deletions

View File

@ -154,7 +154,7 @@
<repositories>
<repository>
<id>sponge</id>
<url>https://repo.spongepowered.org/maven</url>
<url>https://repo.spongepowered.org/maven/</url>
</repository>
<repository>
<id>flow</id>
@ -188,12 +188,12 @@
<groupId>org.spongepowered</groupId>
<!-- Modify this line to target the loader you wish to use. -->
<artifactId>configurate-yaml</artifactId>
<version>3.6</version>
<version>3.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.spongepowered</groupId>
<artifactId>configurate-hocon</artifactId>
<version>3.6</version>
<version>3.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.config;
import com.gmail.nossr50.config.collectionconfigs.RepairConfig;
import com.gmail.nossr50.config.collectionconfigs.SalvageConfig;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.hocon.CustomEnumValueSerializer;
@ -47,7 +46,6 @@ import com.gmail.nossr50.config.treasure.HerbalismTreasureConfig;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairable;
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairableManager;
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;

View File

@ -1,3 +1,4 @@
/*
package com.gmail.nossr50.skills.repair.repairables;
import com.gmail.nossr50.config.Unload;
@ -7,44 +8,55 @@ import org.bukkit.inventory.ItemStack;
import java.util.List;
public interface RepairableManager extends Unload {
/**
*/
/**
* Register a repairable with the RepairManager
*
* @param repairable Repairable to register
*/
*//*
public void registerRepairable(Repairable repairable);
/**
*/
/**
* Register a list of repairables with the RepairManager
*
* @param repairables List<Repairable> to register
*/
*//*
public void registerRepairables(List<Repairable> repairables);
/**
*/
/**
* Checks if an item is repairable
*
* @param type Material to check if repairable
*
* @return true if repairable, false if not
*/
*//*
public boolean isRepairable(Material type);
/**
*/
/**
* Checks if an item is repairable
*
* @param itemStack Item to check if repairable
*
* @return true if repairable, false if not
*/
*//*
public boolean isRepairable(ItemStack itemStack);
/**
*/
/**
* Gets the repairable with this type
*
* @param type Material of the repairable to look for
*
* @return the repairable, can be null
*/
*//*
public Repairable getRepairable(Material type);
}
*/

View File

@ -1,48 +1,44 @@
package com.gmail.nossr50.skills.repair.repairables;
import com.gmail.nossr50.config.Unload;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import java.util.HashMap;
import java.util.List;
public class SimpleRepairableManager implements RepairableManager {
private HashMap<Material, Repairable> repairables;
public class SimpleRepairableManager implements Unload {
private HashMap<Material, SimpleRepairable> repairables;
@Override
public void unload() {
repairables.clear();
}
public SimpleRepairableManager(List<Repairable> repairablesCollection) {
this.repairables = new HashMap<Material, Repairable>(repairablesCollection.size());
public SimpleRepairableManager(List<SimpleRepairable> repairablesCollection) {
this.repairables = new HashMap<Material, SimpleRepairable>(repairablesCollection.size());
registerRepairables(repairablesCollection);
}
@Override
public void registerRepairable(Repairable repairable) {
public void registerRepairable(SimpleRepairable repairable) {
Material item = repairable.getItemMaterial();
repairables.put(item, repairable);
}
@Override
public void registerRepairables(List<Repairable> repairables) {
for (Repairable repairable : repairables) {
public void registerRepairables(List<SimpleRepairable> repairables) {
for (SimpleRepairable repairable : repairables) {
registerRepairable(repairable);
}
}
@Override
public boolean isRepairable(Material type) {
return repairables.containsKey(type);
}
@Override
public boolean isRepairable(ItemStack itemStack) {
return isRepairable(itemStack.getType());
}
@Override
public Repairable getRepairable(Material type) {
return repairables.get(type);
}