mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-18 00:20:44 +00:00
inital commit, recipe remover implemented
This commit is contained in:
8
plugins/factorymod-paper/config.yml
Normal file
8
plugins/factorymod-paper/config.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
general:
|
||||
|
||||
disabled_recipes:
|
||||
amount: 4
|
||||
recipe_1: DIAMOND_HELMET
|
||||
recipe_2: DIAMOND_CHESTPLATE
|
||||
recipe_3: DIAMOND_LEGGINGS
|
||||
recipe_4: DIAMOND_BOOTS
|
||||
4
plugins/factorymod-paper/plugin.yml
Normal file
4
plugins/factorymod-paper/plugin.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
name: FactoryMod
|
||||
main: com.github.igotyou.FactoryMod.FactoryModPlugin
|
||||
author: igotyou
|
||||
version: 0.01
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.github.igotyou.FactoryMod;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.github.igotyou.FactoryMod.managers.FactoryModManager;
|
||||
|
||||
public class FactoryModPlugin extends JavaPlugin
|
||||
{
|
||||
FactoryModManager manager;
|
||||
public static int AMOUNT_OF_RECIPES_TO_REMOVE;
|
||||
|
||||
public void onEnable()
|
||||
{
|
||||
initConfig();
|
||||
}
|
||||
|
||||
public void onDisable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void initConfig()
|
||||
{
|
||||
AMOUNT_OF_RECIPES_TO_REMOVE = getConfig().getInt("disabled_recipes.amount");
|
||||
|
||||
for (int i = 1; i <= FactoryModPlugin.AMOUNT_OF_RECIPES_TO_REMOVE; i++)
|
||||
{
|
||||
int g = 0;
|
||||
ItemStack recipeItemStack = new ItemStack(Material.getMaterial(getConfig().getString(getPathToRecipe(i))));
|
||||
List<Recipe> tempList = getServer().getRecipesFor(recipeItemStack);
|
||||
for (int itterator = 0; itterator < tempList.size(); itterator ++)
|
||||
{
|
||||
removeRecipe(tempList.get(itterator));
|
||||
g++;
|
||||
}
|
||||
getLogger().info(g + " recipes removed");
|
||||
}
|
||||
}
|
||||
|
||||
private String getPathToRecipe(int i)
|
||||
{
|
||||
return "disabled_recipes.recipe_" + String.valueOf(i);
|
||||
}
|
||||
|
||||
private void removeRecipe(Recipe removalRecipe)
|
||||
{
|
||||
Iterator<Recipe> itterator = getServer().recipeIterator();
|
||||
while (itterator.hasNext())
|
||||
{
|
||||
Recipe recipe = itterator.next();
|
||||
if (recipe.getResult().getType() == removalRecipe.getResult().getType())
|
||||
{
|
||||
itterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.github.igotyou.FactoryMod.managers;
|
||||
|
||||
public class FactoryModManager
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user