Compare commits
4 Commits
0.0.2-ALPH
...
snapshot
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a9a1e7626 | |||
| 66f327a581 | |||
| 275be9812e | |||
| 87e0f5b6bb |
@@ -1 +1,6 @@
|
||||
Bukkit Plugin
|
||||
Download the Plugin here:
|
||||
* [Latest](https://gitlab.com/basman93/CustomCrafting/uploads/1cb1378b7ac7ab88ebce876dfa648417/CustomCrafting-0.0.3-ALPHA.jar)
|
||||
* [Version 0.0.3-Alpha](https://gitlab.com/basman93/CustomCrafting/uploads/1cb1378b7ac7ab88ebce876dfa648417/CustomCrafting-0.0.3-ALPHA.jar)
|
||||
* [Version 0.0.2-Alpha](https://gitlab.com/basman93/CustomCrafting/uploads/b711ed3061aaaadaffe9f9dd954f1237/CustomCrafting-0.0.2-ALPHA.jar)
|
||||
|
||||
|
||||
108
pom.xml
108
pom.xml
@@ -1,55 +1,55 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.forkzone.mc</groupId>
|
||||
<artifactId>CustomCrafting</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.0.2-ALPHA</version>
|
||||
<name>CustomCrafting</name>
|
||||
<url></url>
|
||||
<build>
|
||||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
<includes>
|
||||
<include>plugin.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>false</filtering>
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
<excludes>
|
||||
<exclude>plugin.yml</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version><!--change this value depending on the version or use LATEST-->
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.forkzone.mc</groupId>
|
||||
<artifactId>CustomCrafting</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.1.0-ALPHA</version>
|
||||
<name>CustomCrafting</name>
|
||||
<url></url>
|
||||
<build>
|
||||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
<includes>
|
||||
<include>plugin.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>false</filtering>
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
<excludes>
|
||||
<exclude>plugin.yml</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version><!--change this value depending on the version or use LATEST-->
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
23
src/main/java/org/forkzone/mc/customcrafting/CommandManager.java
Executable file
23
src/main/java/org/forkzone/mc/customcrafting/CommandManager.java
Executable file
@@ -0,0 +1,23 @@
|
||||
package org.forkzone.mc.customcrafting;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class CommandManager
|
||||
{
|
||||
CustomCrafting plugin;
|
||||
CommandManager(CustomCrafting plugin, ConfigManager config, RecipeManager recipe)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public boolean command(CommandSender sender, Command cmd, String label, String[] args)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void destroy()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
204
src/main/java/org/forkzone/mc/customcrafting/ConfigManager.java
Executable file
204
src/main/java/org/forkzone/mc/customcrafting/ConfigManager.java
Executable file
@@ -0,0 +1,204 @@
|
||||
package org.forkzone.mc.customcrafting;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.forkzone.mc.customcrafting.recipe.CCFurnaceRecipe;
|
||||
import org.forkzone.mc.customcrafting.recipe.CCRecipe;
|
||||
import org.forkzone.mc.customcrafting.recipe.CCShapedRecipe;
|
||||
import org.forkzone.mc.customcrafting.recipe.CCShapelessRecipe;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
|
||||
public class ConfigManager
|
||||
{
|
||||
public static final int SHAPELESS = 0x00;
|
||||
public static final int SHAPED = 0x01;
|
||||
public static final int FURNACE = 0x02;
|
||||
|
||||
private CustomCrafting plugin;
|
||||
private List<Map<String, CCRecipe>> configurations;
|
||||
|
||||
private List<String> message = new ArrayList<String>();
|
||||
|
||||
ConfigManager(CustomCrafting plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
configurations = new ArrayList<Map<String, CCRecipe>>();
|
||||
configurations.add(SHAPELESS, new HashMap<String, CCRecipe>());
|
||||
configurations.add(SHAPED, new HashMap<String, CCRecipe>());
|
||||
configurations.add(FURNACE, new HashMap<String, CCRecipe>());
|
||||
}
|
||||
|
||||
private String getNameWithoutExtension(String name)
|
||||
{
|
||||
int pos = name.lastIndexOf(".");
|
||||
|
||||
if(pos != -1)
|
||||
return name.substring(0, pos);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean configFurnace(String name, JSONObject jObject)
|
||||
{
|
||||
try
|
||||
{
|
||||
configurations.get(FURNACE).put(name, CCFurnaceRecipe.interpret(jObject));
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
{
|
||||
"name":"XYZ",
|
||||
"input":{
|
||||
"item":"COAL",
|
||||
"data":null,
|
||||
"nbt":null
|
||||
},
|
||||
"output":"DIAMOND",
|
||||
"data":null,
|
||||
"nbt":null,
|
||||
"amount":1
|
||||
"xp":0.5
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private boolean configShaped(String name, JSONObject jObject)
|
||||
{
|
||||
try
|
||||
{
|
||||
configurations.get(SHAPED).put(name, CCShapedRecipe.interpret(jObject));
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
{
|
||||
"name":"No_Space_In_Name_Please",
|
||||
"shape":"D DDCDD D",
|
||||
"input":{
|
||||
"D":{
|
||||
"item":"DIRT",
|
||||
"data":null,
|
||||
"nbt":null
|
||||
},
|
||||
"C":{
|
||||
"item":"COAL",
|
||||
"data":null,
|
||||
"nbt":null
|
||||
}
|
||||
},
|
||||
"output":"DIAMOND",
|
||||
"data":null,
|
||||
"nbt":"{display:{Name:\"Dirty Diamond\"}}",
|
||||
"amount":1
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private boolean configShapeless(String name, JSONObject jObject)
|
||||
{
|
||||
try
|
||||
{
|
||||
configurations.get(SHAPELESS).put(name, CCShapelessRecipe.interpret(jObject));
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
{
|
||||
"name":"quartz_block_to_quartz_item",
|
||||
"input":[
|
||||
{
|
||||
"item":"quartz_block",
|
||||
"data":-1,
|
||||
"nbt":null,
|
||||
"amount":1
|
||||
}
|
||||
],
|
||||
"output":"quartz",
|
||||
"data":null,
|
||||
"nbt":null,
|
||||
"amount":1
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public boolean loadConfig(File filepath, int type)
|
||||
{
|
||||
JSONParser parser = new JSONParser();
|
||||
Object object = null;
|
||||
|
||||
try
|
||||
{
|
||||
object = parser.parse(new FileReader(filepath));
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
plugin.getLogger().warning(CustomCrafting.PREFIX + "Could not load: \"" + filepath.getName() + "\"");
|
||||
return false;
|
||||
}
|
||||
|
||||
JSONObject jObject = (JSONObject) object;
|
||||
String name = getNameWithoutExtension(filepath.getName());
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case SHAPELESS:
|
||||
return configShapeless(name, jObject);
|
||||
case SHAPED:
|
||||
return configShaped(name, jObject);
|
||||
case FURNACE:
|
||||
return configFurnace(name, jObject);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean loadAllConfigs(File folder, int type)
|
||||
{
|
||||
if(!folder.exists())
|
||||
folder.mkdirs();
|
||||
|
||||
boolean status = true;
|
||||
|
||||
for(File path : folder.listFiles())
|
||||
{
|
||||
if(!loadConfig(path, type))
|
||||
{
|
||||
status = false;
|
||||
message.add("ERROR: Could not load \"" + path + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
public List<String> getMessages()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
|
||||
public void clearMessages()
|
||||
{
|
||||
message.clear();
|
||||
}
|
||||
|
||||
public void destroy()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,223 +1,64 @@
|
||||
package org.forkzone.mc.customcrafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.inventory.ShapelessRecipe;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public final class CustomCrafting extends JavaPlugin
|
||||
{
|
||||
private static final String PREFIX = "[CustomCrafting] ";
|
||||
//ArrayList<NamespacedKey> recipeList = new ArrayList<NamespacedKey>();
|
||||
|
||||
private String[][][] getShapeArray(String shape)
|
||||
{
|
||||
String[][][] shape_array = new String[3][3][2];
|
||||
String[] buffer = shape.split(";");
|
||||
|
||||
for(int i = 0; i < buffer.length; ++i)
|
||||
{
|
||||
String[] buffer_ = buffer[i].split(",");
|
||||
for(int j = 0; j < buffer_.length; ++j)
|
||||
{
|
||||
String[] buffer__ = buffer_[j].split(":");
|
||||
|
||||
shape_array[i][j][0] = buffer__[0].toUpperCase();
|
||||
shape_array[i][j][1] = buffer__.length > 1 ? buffer__[1] : "0";
|
||||
}
|
||||
}
|
||||
|
||||
return shape_array;
|
||||
}
|
||||
|
||||
private String[][] getShapeArraySL(String shape)
|
||||
{
|
||||
ArrayList<String[]> shape_array = new ArrayList<String[]>();
|
||||
|
||||
String[] buffer = shape.split(",");
|
||||
for(String buffer_ : buffer)
|
||||
{
|
||||
shape_array.add(getItemArray(buffer_));
|
||||
}
|
||||
|
||||
return shape_array.toArray(new String[shape_array.size()][3]);
|
||||
}
|
||||
|
||||
private String[] getItemArray(String item)
|
||||
{
|
||||
String[] item_array = new String[3];
|
||||
String[] buffer_item = item.split("#");
|
||||
|
||||
String[] buffer_item_ = buffer_item[0].split(":");
|
||||
item_array[0] = buffer_item_[0].toUpperCase();
|
||||
item_array[1] = buffer_item_.length > 1 ? buffer_item_[1] : "0";
|
||||
item_array[2] = buffer_item.length > 1 ? buffer_item[1] : "1";
|
||||
|
||||
return item_array;
|
||||
}
|
||||
|
||||
private int toInt(String string)
|
||||
{
|
||||
return Integer.parseInt(string);
|
||||
}
|
||||
|
||||
private short toShort(String string)
|
||||
{
|
||||
return Short.parseShort(string);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void addNewRecipe(NamespacedKey name, String shape, String item, boolean shapeless)
|
||||
{
|
||||
String[] item_array = getItemArray(item);
|
||||
if(Material.getMaterial(item_array[0]) == null)
|
||||
{
|
||||
getLogger().warning("Could not add \"" + name.getKey() + "\"");
|
||||
getLogger().warning("Unknown: " + item_array[0]);
|
||||
return;
|
||||
}
|
||||
else if(shapeless)
|
||||
{
|
||||
String[][] shape_array = getShapeArraySL(shape);
|
||||
ShapelessRecipe recipe = new ShapelessRecipe(name, new ItemStack(Material.getMaterial(item_array[0]), toInt(item_array[2]), toShort(item_array[1])));
|
||||
|
||||
for(String[] ingredient_array : shape_array)
|
||||
{
|
||||
recipe.addIngredient(toInt(ingredient_array[2]), Material.getMaterial(ingredient_array[0]), toInt(ingredient_array[1]));
|
||||
}
|
||||
|
||||
if(!Bukkit.getServer().addRecipe(recipe))
|
||||
getLogger().warning("Something went wrong!");
|
||||
}
|
||||
else
|
||||
{
|
||||
String[][][] shape_array = getShapeArray(shape);
|
||||
|
||||
ShapedRecipe recipe = new ShapedRecipe(name, new ItemStack(Material.getMaterial(item_array[0]), toInt(item_array[2]), toShort(item_array[1])));
|
||||
|
||||
Map<String, Character> map = new HashMap<String, Character>();
|
||||
|
||||
int counter = 0;
|
||||
|
||||
String[] recipe_shape = new String[3];
|
||||
|
||||
for(int i = 0; i < shape_array.length; ++i)
|
||||
{
|
||||
recipe_shape[i] = "";
|
||||
for(int j = 0; j < shape_array[i].length; ++j)
|
||||
{
|
||||
if(!map.containsKey(shape_array[i][j][0] + ":" + shape_array[i][j][1]))
|
||||
{
|
||||
if(shape_array[i][j][0].equalsIgnoreCase(" ") || shape_array[i][j][0].equalsIgnoreCase("0") || shape_array[i][j][0].equalsIgnoreCase("air"))
|
||||
map.put(shape_array[i][j][0] + ":" + shape_array[i][j][1], ' ');
|
||||
else
|
||||
{
|
||||
map.put(shape_array[i][j][0] + ":" + shape_array[i][j][1], (char)('a' + counter));
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
recipe_shape[i] += map.get(shape_array[i][j][0] + ":" + shape_array[i][j][1]);
|
||||
}
|
||||
}
|
||||
|
||||
recipe.shape(recipe_shape);
|
||||
|
||||
for (Map.Entry<String, Character> entry : map.entrySet())
|
||||
{
|
||||
if(!entry.getValue().equals(' '))
|
||||
{
|
||||
String[] buffer = entry.getKey().split(":");
|
||||
recipe.setIngredient(entry.getValue(), Material.getMaterial(buffer[0]), toInt(buffer[1]));
|
||||
}
|
||||
}
|
||||
|
||||
if(!Bukkit.getServer().addRecipe(recipe))
|
||||
getLogger().warning("Something went wrong!");
|
||||
}
|
||||
getLogger().info("Add Recipe \"" + name.getKey() + "\"");
|
||||
}
|
||||
|
||||
private void readConfigAndAddRecipe()
|
||||
{
|
||||
for(String key : getConfig().getConfigurationSection("recipes").getKeys(false))
|
||||
{
|
||||
NamespacedKey nkey = new NamespacedKey(this, key);
|
||||
//recipeList.add(nkey);
|
||||
addNewRecipe(nkey, getConfig().getString("recipes." + key + ".shape"), getConfig().getString("recipes." + key + ".item"), getConfig().getBoolean("recipes." + key + ".shapeless"));
|
||||
}
|
||||
}
|
||||
|
||||
private void removeRecipe()
|
||||
{
|
||||
/*
|
||||
Iterator<Recipe> iter = Bukkit.getServer().recipeIterator();
|
||||
while(iter.hasNext())
|
||||
{
|
||||
Recipe r = iter.next();
|
||||
if(r != null && r instanceof ShapedRecipe)
|
||||
{
|
||||
if(recipeList.contains(((ShapedRecipe) r).getKey()))
|
||||
iter.remove();
|
||||
}
|
||||
else if(r != null && r instanceof ShapelessRecipe)
|
||||
{
|
||||
if(recipeList.contains(((ShapelessRecipe) r).getKey()))
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
recipeList.clear();
|
||||
*/
|
||||
Bukkit.getServer().resetRecipes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
saveDefaultConfig();
|
||||
reloadConfig();
|
||||
readConfigAndAddRecipe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
removeRecipe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
|
||||
{
|
||||
if(cmd.getName().equalsIgnoreCase("customcrafting"))
|
||||
{
|
||||
if(args.length == 1 && args[0].equalsIgnoreCase("reload") && sender.hasPermission("customcrafting.reload"))
|
||||
{
|
||||
reloadConfig();
|
||||
removeRecipe();
|
||||
readConfigAndAddRecipe();
|
||||
sender.sendMessage(PREFIX + "reloaded!");
|
||||
}
|
||||
else if(sender.hasPermission("customcrafting.infolite") || sender.hasPermission("customcrafting.info"))
|
||||
{
|
||||
sender.sendMessage(PREFIX + "Plugin Information");
|
||||
sender.sendMessage(PREFIX + "Name: " + getDescription().getName());
|
||||
sender.sendMessage(PREFIX + "Author: " + String.join(", ", getDescription().getAuthors()));
|
||||
if(sender.hasPermission("customcrafting.info"))
|
||||
{
|
||||
sender.sendMessage(PREFIX + "Version: " + getDescription().getVersion());
|
||||
sender.sendMessage(PREFIX + "Arguments: reload");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
package org.forkzone.mc.customcrafting;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public final class CustomCrafting extends JavaPlugin
|
||||
{
|
||||
private RecipeManager recipemanager;
|
||||
private CommandManager commandmanager;
|
||||
private ConfigManager configmanager;
|
||||
|
||||
protected static final String PREFIX = "[CC] ";
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
unload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
|
||||
{
|
||||
return commandmanager.command(sender, cmd, label, args);
|
||||
}
|
||||
|
||||
private void load()
|
||||
{
|
||||
configmanager = new ConfigManager(this);
|
||||
recipemanager = new RecipeManager(this, configmanager);
|
||||
commandmanager = new CommandManager(this, configmanager, recipemanager);
|
||||
|
||||
configmanager.loadAllConfigs(new File(getDataFolder() + "/recipe/shapeless"), ConfigManager.SHAPELESS);
|
||||
configmanager.loadAllConfigs(new File(getDataFolder() + "/recipe/shaped"), ConfigManager.SHAPED);
|
||||
configmanager.loadAllConfigs(new File(getDataFolder() + "/recipe/furnace"), ConfigManager.FURNACE);
|
||||
}
|
||||
|
||||
private void unload()
|
||||
{
|
||||
commandmanager.destroy();
|
||||
recipemanager.destroy();
|
||||
configmanager.destroy();
|
||||
|
||||
commandmanager = null;
|
||||
recipemanager = null;
|
||||
configmanager = null;
|
||||
}
|
||||
|
||||
private void reload()
|
||||
{
|
||||
unload();
|
||||
load();
|
||||
}
|
||||
}
|
||||
|
||||
16
src/main/java/org/forkzone/mc/customcrafting/RecipeManager.java
Executable file
16
src/main/java/org/forkzone/mc/customcrafting/RecipeManager.java
Executable file
@@ -0,0 +1,16 @@
|
||||
package org.forkzone.mc.customcrafting;
|
||||
|
||||
public class RecipeManager
|
||||
{
|
||||
CustomCrafting plugin;
|
||||
|
||||
RecipeManager(CustomCrafting plugin, ConfigManager config)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public void destroy()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
12
src/main/java/org/forkzone/mc/customcrafting/recipe/CCFurnaceRecipe.java
Executable file
12
src/main/java/org/forkzone/mc/customcrafting/recipe/CCFurnaceRecipe.java
Executable file
@@ -0,0 +1,12 @@
|
||||
package org.forkzone.mc.customcrafting.recipe;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class CCFurnaceRecipe extends CCRecipe {
|
||||
|
||||
public static CCRecipe interpret(JSONObject jObject) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
9
src/main/java/org/forkzone/mc/customcrafting/recipe/CCRecipe.java
Executable file
9
src/main/java/org/forkzone/mc/customcrafting/recipe/CCRecipe.java
Executable file
@@ -0,0 +1,9 @@
|
||||
package org.forkzone.mc.customcrafting.recipe;
|
||||
|
||||
public class CCRecipe
|
||||
{
|
||||
public CCShapelessRecipe asShapeless()
|
||||
{
|
||||
return (CCShapelessRecipe) this;
|
||||
}
|
||||
}
|
||||
12
src/main/java/org/forkzone/mc/customcrafting/recipe/CCShapedRecipe.java
Executable file
12
src/main/java/org/forkzone/mc/customcrafting/recipe/CCShapedRecipe.java
Executable file
@@ -0,0 +1,12 @@
|
||||
package org.forkzone.mc.customcrafting.recipe;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class CCShapedRecipe extends CCRecipe {
|
||||
|
||||
public static CCRecipe interpret(JSONObject jObject) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
12
src/main/java/org/forkzone/mc/customcrafting/recipe/CCShapelessRecipe.java
Executable file
12
src/main/java/org/forkzone/mc/customcrafting/recipe/CCShapelessRecipe.java
Executable file
@@ -0,0 +1,12 @@
|
||||
package org.forkzone.mc.customcrafting.recipe;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class CCShapelessRecipe extends CCRecipe {
|
||||
public String test="X";
|
||||
|
||||
public static CCRecipe interpret(JSONObject jObject) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1 @@
|
||||
recipes:
|
||||
dirtyDiamond:
|
||||
shapeless: false
|
||||
shape: "dirt,dirt,dirt;dirt,coal,dirt;dirt,dirt,dirt"
|
||||
item: "diamond:0#1"
|
||||
quarzblocktoitem:
|
||||
shapeless: true
|
||||
shape: "quartz_block:-1#1"
|
||||
item: "quartz:0#4"
|
||||
notchapple:
|
||||
shapeless: false
|
||||
shape: "gold_block,gold_block,gold_block;gold_block,apple,gold_block;gold_block,gold_block,gold_block"
|
||||
item: "golden_apple:1"
|
||||
version: 2
|
||||
@@ -1,27 +1,27 @@
|
||||
name: CustomCrafting
|
||||
main: org.forkzone.mc.customcrafting.CustomCrafting
|
||||
version: "${project.version}"
|
||||
description: Add possibility to add custom crafting receipts to the game.
|
||||
author: basman93
|
||||
commands:
|
||||
customcrafting:
|
||||
description: Shows the plugin version or reloads it
|
||||
usage: /<command> [arguments]
|
||||
permission: customcrafting.infolite
|
||||
aliases: cc
|
||||
permissions:
|
||||
customcrafting.*:
|
||||
description: Gives access to all CustomCrafting commands
|
||||
children:
|
||||
customcrafting.info: true
|
||||
customcrafting.infolite: true
|
||||
customcrafting.reload: true
|
||||
customcrafting.info:
|
||||
description: Allows to see the full information of this plugin
|
||||
children:
|
||||
customcrafting.infolite: true
|
||||
customcrafting.infolite:
|
||||
description: Allows to see the reduced information of this plugin
|
||||
default: true
|
||||
customcrafting.reload:
|
||||
name: CustomCrafting
|
||||
main: org.forkzone.mc.customcrafting.CustomCrafting
|
||||
version: "${project.version}"
|
||||
description: Add possibility to add custom crafting recipts to the game.
|
||||
author: basman93
|
||||
commands:
|
||||
customcrafting:
|
||||
description: Shows the plugin version or reloads it
|
||||
usage: /<command> [arguments]
|
||||
permission: customcrafting.infolite
|
||||
aliases: cc
|
||||
permissions:
|
||||
customcrafting.*:
|
||||
description: Gives access to all CustomCrafting commands
|
||||
children:
|
||||
customcrafting.info: true
|
||||
customcrafting.infolite: true
|
||||
customcrafting.reload: true
|
||||
customcrafting.info:
|
||||
description: Allows to see the full information of this plugin
|
||||
children:
|
||||
customcrafting.infolite: true
|
||||
customcrafting.infolite:
|
||||
description: Allows to see the reduced information of this plugin
|
||||
default: true
|
||||
customcrafting.reload:
|
||||
description: Allows to reload the plugin
|
||||
Reference in New Issue
Block a user