Major update, started coding the managers, added properties.

Big thanks to mrtwiggy for the basecode.
This commit is contained in:
igotyou
2013-02-24 16:31:23 +01:00
parent 0e651a3a09
commit 8cfc120cf8
13 changed files with 948 additions and 1 deletions

View File

@@ -5,4 +5,47 @@ disabled_recipes:
recipe_1: DIAMOND_HELMET
recipe_2: DIAMOND_CHESTPLATE
recipe_3: DIAMOND_LEGGINGS
recipe_4: DIAMOND_BOOTS
recipe_4: DIAMOND_BOOTS
production_recipes:
amount:4
recipe_1:
name: Diamond Helmet
batch_amount: 10
production_time: 120
output_material: DIAMOND_HELMET
amount_of_material_inputs: 1
input_material_1: DIAMOND
input_amount_1: 5
recipe_2:
name: Diamond Chestplate
batch_amount: 10
production_time: 120
output_material: DIAMOND_CHESTPLATE
amount_of_material_inputs: 1
input_material_1: DIAMOND
input_amount_1: 8
recipe_3:
name: Diamond Leggings
batch_amount: 10
production_time: 120
output_material: DIAMOND_LEGGINGS
amount_of_material_inputs: 1
input_material_1: DIAMOND
input_amount_1: 7
recipe_4:
name: Diamond Boots
batch_amount: 10
production_time: 120
output_material: DIAMOND_BOOTS
amount_of_material_inputs: 1
input_material_1: DIAMOND
input_amount_1: 4
production_general:
update_cycle: 20
amount_of_factory_types: 1
factory_1:
name: workshop

View File

@@ -0,0 +1,27 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
(1) Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
(3)The name of the author may not be used to
endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,6 +1,7 @@
package com.github.igotyou.FactoryMod;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -9,12 +10,21 @@ import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import com.github.igotyou.FactoryMod.FactoryObject.FactoryType;
import com.github.igotyou.FactoryMod.FactoryObject.SubFactoryType;
import com.github.igotyou.FactoryMod.managers.FactoryModManager;
import com.github.igotyou.FactoryMod.properties.ProductionProperties;
import com.github.igotyou.interfaces.Properties;
public class FactoryModPlugin extends JavaPlugin
{
FactoryModManager manager;
public static HashMap<SubFactoryType, ProductionProperties> Production_Properties;
public static int AMOUNT_OF_RECIPES_TO_REMOVE;
public static int PRODUCTION_MAX_TIERS;
public static int PRODUCER_UPDATE_CYCLE;
public void onEnable()
{
@@ -28,7 +38,9 @@ public class FactoryModPlugin extends JavaPlugin
public void initConfig()
{
Production_Properties = new HashMap<SubFactoryType, ProductionProperties>();
AMOUNT_OF_RECIPES_TO_REMOVE = getConfig().getInt("disabled_recipes.amount");
PRODUCTION_MAX_TIERS = getConfig().getInt("production_general.max_tiers");
for (int i = 1; i <= FactoryModPlugin.AMOUNT_OF_RECIPES_TO_REMOVE; i++)
{
@@ -42,6 +54,10 @@ public class FactoryModPlugin extends JavaPlugin
}
getLogger().info(g + " recipes removed");
}
for (int i = 1; i <= FactoryModPlugin.PRODUCTION_MAX_TIERS; i++)
{
int amount_of_materials = getConfig().getInt("production_general.amount_of_materials");
}
}
private String getPathToRecipe(int i)
@@ -61,4 +77,21 @@ public class FactoryModPlugin extends JavaPlugin
}
}
}
public static Properties getProperties(FactoryType factoryType, SubFactoryType subFactoryType)
{
switch(factoryType)
{
case PRODUCTION:
return FactoryModPlugin.Production_Properties.get(subFactoryType);
default:
return null;
}
}
public static int getMaxTiers(FactoryType factoryType)
{
// TODO Auto-generated method stub
return 0;
}
}

View File

@@ -0,0 +1,273 @@
package com.github.igotyou.FactoryMod;
import java.util.HashMap;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Chest;
import org.bukkit.block.Dispenser;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import com.github.igotyou.FactoryMod.utility.InteractionResponse;
import com.github.igotyou.FactoryMod.utility.InteractionResponse.InteractionResult;
import com.github.igotyou.interfaces.Properties;
//original file:
/**
* MachineObject.java
* Purpose: Basic object base for machines to extend
*
* @author MrTwiggy
* @version 0.1 1/14/13
*/
//edited version:
/**
* FactoryObject.java
* Purpose basic object base for factorys to extend
* @author igotyou
*
*/
public class FactoryObject
{
public enum FactoryType
{
PRODUCTION
}
public enum SubFactoryType
{
WORKSHOP,
MOSSYCOBBLE
}
protected Location factoryLocation; // Current location of factory center
protected Location factoryInventoryLocation;
protected Location factoryPowerSource;
protected boolean active; // Whether factory is currently active
protected Inventory factoryInventory; // The inventory of the factory
protected FactoryType factoryType; // The type this factory is
protected SubFactoryType subFactoryType;
protected Properties factoryProperties; // The properties of this factory type and tier
protected boolean upgraded; // Whether the tier has recently upgraded
/**
* Constructor
*/
public FactoryObject(Location factoryLocation, Location factoryInventoryLocation, Location factoryPowerSource,
FactoryType factoryType, SubFactoryType subFactoryType)
{
this.factoryLocation = factoryLocation;
this.factoryInventoryLocation = factoryInventoryLocation;
this.factoryPowerSource = factoryPowerSource;
this.active = false;
this.factoryType = factoryType;
this.subFactoryType = subFactoryType;
this.upgraded = false;
initializeInventory();
updateProperties();
}
/**
* Constructor
*/
public FactoryObject(Location factoryLocation, Location factoryInventoryLocation, Location factoryPowerSource,
boolean active, FactoryType factoryType, SubFactoryType subFactoryType)
{
this.factoryLocation = factoryLocation;
this.factoryInventoryLocation = factoryInventoryLocation;
this.factoryPowerSource = factoryPowerSource;
this.active = active;
this.factoryType = factoryType;
this.subFactoryType = subFactoryType;
this.upgraded = false;
initializeInventory();
updateProperties();
}
/**
* Constructor
*/
public FactoryObject(Location factoryLocation, Location factoryInventoryLocation, Location factoryPowerSource,
boolean active, int tierLevel, FactoryType factoryType, Inventory factoryInventory,
SubFactoryType subFactoryType)
{
this.factoryLocation = factoryLocation;
this.factoryInventoryLocation = factoryInventoryLocation;
this.factoryPowerSource = factoryPowerSource;
this.active = active;
this.factoryType = factoryType;
this.subFactoryType = subFactoryType;
this.factoryInventory = factoryInventory;
updateProperties();
}
/**
* Initializes the inventory for this factory
*/
public void initializeInventory()
{
switch(factoryType)
{
case PRODUCTION:
Chest chestBlock = (Chest)factoryLocation.getBlock();
factoryInventory = chestBlock.getInventory();
break;
}
}
/**
* Updates the current properties for the current tier level
*/
public void updateProperties()
{
factoryProperties = FactoryModPlugin.getProperties(factoryType, subFactoryType);
}
/**
* Returns the user-friendly name for this factory type
*/
public String factoryName()
{
switch (factoryType)
{
case PRODUCTION:
return "Production";
default:
return null;
}
}
/**
* Returns whether there is enough material available for an upgrade in cloaker inventory
*/
public boolean upgradeMaterialAvailable(int desiredTier)
{
Properties desiredProperties = FactoryModPlugin.getProperties(factoryType, subFactoryType);
boolean returnValue = true;
for (int i = 1; i <= desiredProperties.getBuildMaterial().size(); i++)
{
if (!isMaterialAvailable(desiredProperties.getBuildAmount().get(i), desiredProperties.getBuildMaterial().get(i)))
{
returnValue = false;
}
}
return returnValue;
}
public boolean buildMaterialAvailable(Properties desiredProperties)
{
boolean returnValue = true;
for (int i = 1; i <= desiredProperties.getBuildMaterial().size(); i++)
{
if (!isMaterialAvailable(desiredProperties.getBuildAmount().get(i), desiredProperties.getBuildMaterial().get(i)))
{
returnValue = false;
}
}
return returnValue;
}
/**
* Attempts to remove materials for upgrading from cloaker inventory
*/
public boolean removeBuildMaterial(Properties desiredProperties)
{
boolean returnValue = true;
for (int i = 1; i <= desiredProperties.getBuildMaterial().size(); i++)
{
if (!removeMaterial(desiredProperties.getBuildAmount().get(i), desiredProperties.getBuildMaterial().get(i)))
{
returnValue = false;
}
}
return returnValue;
}
/**
* Attempts to remove a specific material of given amount from dispenser
*/
public boolean removeMaterial(int amount, Material material)
{
HashMap<Integer,? extends ItemStack> inventoryMaterials = getInventory().all(material);
int materialsToRemove = amount;
for(Entry<Integer,? extends ItemStack> entry : inventoryMaterials.entrySet())
{
if (materialsToRemove <= 0)
break;
if(entry.getValue().getAmount() == materialsToRemove)
{
getInventory().setItem(entry.getKey(), new ItemStack(Material.AIR, 0));
materialsToRemove = 0;
}
else if(entry.getValue().getAmount() > materialsToRemove)
{
getInventory().setItem(entry.getKey(), new ItemStack(material, (entry.getValue().getAmount() - materialsToRemove)));
materialsToRemove = 0;
}
else
{
int inStack = entry.getValue().getAmount();
getInventory().setItem(entry.getKey(), new ItemStack(Material.AIR, 0));
materialsToRemove -= inStack;
}
}
return materialsToRemove == 0;
}
/**
* Checks if a specific material of given amount is available in dispenser
*/
public boolean isMaterialAvailable(int amount, Material material)
{
HashMap<Integer,? extends ItemStack> inventoryMaterials = getInventory().all(material);
int totalMaterial = 0;
for(Entry<Integer,? extends ItemStack> entry : inventoryMaterials.entrySet())
{
totalMaterial += entry.getValue().getAmount();
}
return (totalMaterial >= amount);
}
/**
* Returns how much of a specified material is available in dispenser
*/
public int getMaterialAvailableAmount(Material material)
{
HashMap<Integer,? extends ItemStack> inventoryMaterials = getInventory().all(material);
int totalMaterial = 0;
for(Entry<Integer,? extends ItemStack> entry : inventoryMaterials.entrySet())
{
totalMaterial += entry.getValue().getAmount();
}
return totalMaterial;
}
/**
* 'cloakerInventory' public accessor
*/
public Inventory getInventory()
{
switch (factoryType)
{
case PRODUCTION:
Chest chestBlock = (Chest)factoryLocation.getBlock();
factoryInventory = chestBlock.getInventory();
return factoryInventory;
default:
return factoryInventory;
}
}
}

View File

@@ -0,0 +1,71 @@
package com.github.igotyou.FactoryMod.Factorys;
import java.util.HashMap;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import com.github.igotyou.FactoryMod.FactoryObject;
import com.github.igotyou.FactoryMod.managers.ProductionManager;
import com.github.igotyou.FactoryMod.utility.InteractionResponse;
import com.github.igotyou.interfaces.Factory;
public class Production extends FactoryObject implements Factory
{
private Material currentProductionItem;
public static final FactoryType FACTORY_TYPE = FactoryType.PRODUCTION;
public static SubFactoryType SUB_FACTORY_TYPE;
public Production (Location factoryLocation, Location factoryInventoryLocation, Location factoryPowerSource
, SubFactoryType subFactoryType)
{
super(factoryLocation, factoryInventoryLocation, factoryPowerSource, Production.FACTORY_TYPE, subFactoryType);
this.SUB_FACTORY_TYPE = subFactoryType;
}
public Production (Location factoryLocation, Location factoryInventoryLocation, Location factoryPowerSource,
Material currentProductionItem, SubFactoryType subFactoryType)
{
super(factoryLocation, factoryInventoryLocation, factoryPowerSource, Production.FACTORY_TYPE, subFactoryType);
this.SUB_FACTORY_TYPE = subFactoryType;
this.currentProductionItem = currentProductionItem;
}
public void update()
{
// TODO add
}
public void destroy(ItemStack item)
{
// TODO Auto-generated method stub
}
public void powerOn()
{
// TODO Auto-generated method stub
}
public void powerOff()
{
// TODO Auto-generated method stub
}
public InteractionResponse togglePower()
{
// TODO Auto-generated method stub
return null;
}
public Location getLocation()
{
// TODO Auto-generated method stub
return null;
}
}

View File

@@ -0,0 +1,133 @@
package com.github.igotyou.FactoryMod.managers;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Chest;
import org.bukkit.inventory.Inventory;
import com.github.igotyou.FactoryMod.FactoryModPlugin;
import com.github.igotyou.FactoryMod.FactoryObject.SubFactoryType;
import com.github.igotyou.FactoryMod.Factorys.Production;
import com.github.igotyou.FactoryMod.properties.ProductionProperties;
import com.github.igotyou.FactoryMod.utility.InteractionResponse;
import com.github.igotyou.FactoryMod.utility.InteractionResponse.InteractionResult;
import com.github.igotyou.interfaces.Factory;
import com.github.igotyou.interfaces.Manager;
public class ProductionManager implements Manager
{
private FactoryModPlugin plugin;
private List<Production> producers;
public ProductionManager(FactoryModPlugin plugin)
{
this.plugin = plugin;
producers = new ArrayList<Production>();
}
public void save(File file) throws IOException
{
// TODO Auto-generated method stub
}
public void load(File file) throws IOException
{
// TODO Auto-generated method stub
}
public void updateFactorys()
{
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable()
{
@Override
public void run()
{
for (Production production: producers)
{
production.update();
}
}
}, 0L, FactoryModPlugin.PRODUCER_UPDATE_CYCLE);
}
public InteractionResponse createFactory(Location factoryLocation, Location inventoryLocation, Location powerLocation)
{
if (!factoryExistsAt(factoryLocation))
{
HashMap<SubFactoryType, ProductionProperties> properties = plugin.Production_Properties;
Chest chest = (Chest)inventoryLocation.getBlock();
Inventory inventory = chest.getInventory();
SubFactoryType subFactoryType = null;
boolean hasMaterials = true;
for (Map.Entry<SubFactoryType, ProductionProperties> entry : properties.entrySet())
{
HashMap<Integer, Material> buildMaterial = entry.getValue().getBuildMaterial();
HashMap<Integer, Integer> buildAmount = entry.getValue().getBuildAmount();
for (int i = 0; i < buildMaterial.size(); i ++)
{
if(!inventory.contains(buildMaterial.get(i), buildAmount.get(i)))
{
hasMaterials = false;
}
}
if (hasMaterials = true)
{
subFactoryType = entry.getKey();
}
}
if (hasMaterials == true && subFactoryType != null)
{
Production production = new Production(factoryLocation, inventoryLocation, powerLocation,subFactoryType);
if (production.buildMaterialAvailable(properties.get(subFactoryType)))
{
addFactory(production);
production.removeBuildMaterial(properties.get(subFactoryType));
return new InteractionResponse(InteractionResult.SUCCESS, "Successfully created " + subFactoryType + " production factory");
}
}
return new InteractionResponse(InteractionResult.FAILURE, "not enough materials in chest!");
}
return new InteractionResponse(InteractionResult.FAILURE, "there is already a factory there!");
}
public InteractionResponse addFactory(Factory factory)
{
// TODO Auto-generated method stub
return null;
}
public Factory getFactory(Location factoryLocation)
{
// TODO Auto-generated method stub
return null;
}
public boolean factoryExistsAt(Location factoryLocation)
{
// TODO Auto-generated method stub
return false;
}
public void removeFactory(Factory factory)
{
// TODO Auto-generated method stub
}
public String getSavesFileName()
{
// TODO Auto-generated method stub
return null;
}
}

View File

@@ -0,0 +1,47 @@
package com.github.igotyou.FactoryMod.properties;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Material;
import com.github.igotyou.FactoryMod.recipes.ProductionRecipe;
import com.github.igotyou.interfaces.Properties;
public class ProductionProperties implements Properties
{
private HashMap<Integer, Material> buildMaterial;
private HashMap<Integer, Integer> buildAmount;
private List<ProductionRecipe> recipes;
int energyConsumption;
public ProductionProperties(HashMap<Integer, Material> buildMaterial, HashMap<Integer, Integer> buildAmount,
ArrayList<ProductionRecipe> recipes, int energyConsumption)
{
this.buildMaterial = buildMaterial;
this.buildAmount = buildAmount;
this.recipes = recipes;
this.energyConsumption = energyConsumption;
}
public HashMap<Integer, Integer> getBuildAmount()
{
return buildAmount;
}
public HashMap<Integer, Material> getBuildMaterial()
{
return buildMaterial;
}
public List<ProductionRecipe> getRecipes()
{
return recipes;
}
public int getEnergyConsumption()
{
return energyConsumption;
}
}

View File

@@ -0,0 +1,58 @@
package com.github.igotyou.FactoryMod.recipes;
import java.util.HashMap;
import org.bukkit.Material;
import com.github.igotyou.interfaces.Recipe;
public class ProductionRecipe implements Recipe
{
private HashMap <Integer, Material> inputMaterial;
private HashMap <Integer, Integer> inputAmount;
private Material output;
private int batchAmount;
private int productionTime;
private String recipeName;
public ProductionRecipe(HashMap<Integer, Material> inputMaterial, HashMap<Integer,Integer> inputAmount, Material output,
int batchAmount, String recipeName)
{
this.inputMaterial = inputMaterial;
this.inputAmount = inputAmount;
this.output = output;
this.batchAmount = batchAmount;
this.recipeName = recipeName;
}
public int getBatchAmount()
{
return batchAmount;
}
public Material getOutput()
{
return output;
}
public HashMap<Integer, Material> getInputMaterial()
{
return inputMaterial;
}
public HashMap<Integer, Integer> getInputAmount()
{
return inputAmount;
}
public String getRecipeName()
{
return recipeName;
}
public int getProductionTime()
{
return productionTime;
}
}

View File

@@ -0,0 +1,75 @@
package com.github.igotyou.FactoryMod.utility;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
/**
* InteractionResponse.java
* Purpose: Object used for sending back interaction results with error/success messages
*
* @author MrTwiggy
* @version 0.1 1/14/13
*/
public class InteractionResponse
{
public static enum InteractionResult
{
SUCCESS,
FAILURE
}
private final InteractionResult interactionResult; //The result of this interaction attempt
private final String interactionMessage; //The message to send to player(s) after interaction attempt
/**
* Constructor
*/
public InteractionResponse(InteractionResult interactionResult,
String interactionMessage)
{
this.interactionResult = interactionResult;
this.interactionMessage = interactionMessage;
}
/**
* Returns the interaction result message to be sent to player(s)
*/
public String getInteractionMessage()
{
return getMessageColor() + interactionMessage;
}
/**
* Messages the given Player this object's interaction message
*/
public static void messagePlayerResult(Player player, InteractionResponse interactionResponse)
{
player.sendMessage(interactionResponse.getInteractionMessage());
}
/**
* Returns the appropriate color for interaction messages based on success/failure
*/
private ChatColor getMessageColor()
{
switch (interactionResult)
{
case SUCCESS:
return ChatColor.GREEN;
case FAILURE:
return ChatColor.RED;
default:
return ChatColor.YELLOW;
}
}
/**
* 'interactionResult' public accessor
*/
public InteractionResult getInteractionResult()
{
return interactionResult;
}
}

View File

@@ -0,0 +1,53 @@
package com.github.igotyou.interfaces;
import org.bukkit.Location;
import org.bukkit.inventory.ItemStack;
import com.github.igotyou.FactoryMod.utility.InteractionResponse;
//original file:
/**
* Machine.java
* Purpose: An interface for machines to implement with basic functionality
*
* @author MrTwiggy
* @version 0.1 1/14/13
*/
//edited version:
/**
* Factory.java
* Purpose: An interface for machines to implement with basic functionality
* @author igotyou
*
*/
public interface Factory
{
/**
* Updates the machine
*/
public void update();
/**
* Destroys the machine and drops the given item
*/
public void destroy(ItemStack item);
/**
* Powers on the machine
*/
public void powerOn();
/**
* Powers off the machine
*/
public void powerOff();
/**
* Toggles the current power state and returns interaction response
*/
public InteractionResponse togglePower();
/**
* Returns the location of the machine
*/
public Location getLocation();
}

View File

@@ -0,0 +1,74 @@
package com.github.igotyou.interfaces;
import java.io.File;
import java.io.IOException;
import org.bukkit.Location;
import com.github.igotyou.FactoryMod.utility.InteractionResponse;
//original file:
/**
* Manager.java
* Purpose: Interface for Manager objects for basic manager functionality
*
* @author MrTwiggy
* @version 0.1 1/08/13
*/
//edited version:
/**
* Manager.java
* Purpose: Interface for Manager objects for basic manager functionality
* @author igotyou
*
*/
public interface Manager
{
/**
* Saves the machine objects list of this manager to file
*/
public void save(File file) throws IOException;
/**
* Loads machine objects list of this manager from file
*/
public void load(File file) throws IOException;
/**
* Updates all the machines from this manager's machine object list
*/
public void updateFactorys();
/**
* Attempts to create a new machine for this manager
*/
public InteractionResponse createFactory(Location factoryLocation, Location inventoryLocation, Location powerLocation);
/**
* Creates a machine from an existing machine data object
*/
public InteractionResponse addFactory(Factory factory);
/**
* Returns the machine (if any exists) at the given location from this manager
*/
public Factory getFactory(Location factoryLocation);
/**
* Returns whether a machine exists at the given location
*/
public boolean factoryExistsAt(Location factoryLocation);
/**
* Removes the given machine from the object list
*/
public void removeFactory(Factory factory);
/**
* Returns the saves file name for this manager
*/
public String getSavesFileName();
}

View File

@@ -0,0 +1,33 @@
package com.github.igotyou.interfaces;
import java.util.HashMap;
import org.bukkit.Material;
//original file:
/**
* Properties.java
* Purpose: Interface for Properties objects for basic properties functionality
*
* @author MrTwiggy
* @version 0.1 1/17/13
*/
//edited version:
/**
* Properties.java
* Purpose: Interface for Properties objects for basic properties functionality
* @author igotyou
*
*/
public interface Properties
{
/**
* Returns the amount of upgrade materials required to reach this tier
*/
public HashMap<Integer,Integer> getBuildAmount();
/**
* Returns the material used to upgrade to this tier
*/
public HashMap<Integer,Material> getBuildMaterial();
}

View File

@@ -0,0 +1,27 @@
package com.github.igotyou.interfaces;
import java.util.HashMap;
import org.bukkit.Material;
public interface Recipe
{
//how many output do we produce at once?
public int getBatchAmount();
//the output of this recipe
public Material getOutput();
//get the materials needed for one output
public HashMap<Integer,Material> getInputMaterial();
//get the amount of above material nedded
public HashMap<Integer,Integer> getInputAmount();
//get the recipes name, example: Iron Pickaxe
public String getRecipeName();
//get production time in update cycles
public int getProductionTime();
}