Part 2 of removing bad design patterns

This commit is contained in:
nossr50
2019-06-27 03:04:34 -07:00
parent 5ee862effd
commit 87af2419a3
234 changed files with 2303 additions and 2746 deletions

View File

@ -11,16 +11,22 @@ import org.bukkit.inventory.ItemStack;
*/
public class BukkitFactory {
private mcMMO pluginRef;
public BukkitFactory(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
/**
* Creates a BukkitMMOItem which contains Bukkit implementations for the type MMOItem
* @return a new BukkitMMOItem
*/
public static MMOItem<?> createItem(String namespaceKey, int amount, RawNBT rawNBT) {
public MMOItem<?> createItem(String namespaceKey, int amount, RawNBT rawNBT) {
return new BukkitMMOItem(namespaceKey, amount, rawNBT);
}
public static MMOItem<?> createItem(ItemStack itemStack) {
return createItem(itemStack.getType().getKey().toString(), itemStack.getAmount(), new RawNBT(mcMMO.getNbtManager().getNBT(itemStack).toString()));
public MMOItem<?> createItem(ItemStack itemStack) {
return createItem(itemStack.getType().getKey().toString(), itemStack.getAmount(), new RawNBT(pluginRef.getNbtManager().getNBT(itemStack).toString()));
}
}