commit 3b6479cfc65109b868f3f67903cf97ea4de0a46c Author: Paul Reilly Date: Sat Jul 11 14:28:42 2020 -0500 Initial commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..7b97560 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b2960c1 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..4b661a5 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..7192b7b --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1594490912181 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Uncraftables.iml b/Uncraftables.iml new file mode 100644 index 0000000..78b2cc5 --- /dev/null +++ b/Uncraftables.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..9332a03 --- /dev/null +++ b/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + dev.coomware + Uncraftables + 1.0.0 + + + + papermc + https://papermc.io/repo/repository/maven-public/ + + + + + + com.destroystokyo.paper + paper-api + 1.16.1-R0.1-SNAPSHOT + provided + + + org.jetbrains + annotations + RELEASE + compile + + + \ No newline at end of file diff --git a/src/main/java/dev/coomware/Craftable.java b/src/main/java/dev/coomware/Craftable.java new file mode 100644 index 0000000..93528c6 --- /dev/null +++ b/src/main/java/dev/coomware/Craftable.java @@ -0,0 +1,83 @@ +package dev.coomware; + +import org.bukkit.Material; +import org.bukkit.inventory.ShapedRecipe; + +public class Craftable { + private Uncraftables plugin; + private CraftingUtils util = Uncraftables.plugin.util; + + public Craftable(Uncraftables instance) { + plugin = instance; + } + + public void craftables() { + saddle(); + leatherHorseArmor(); + ironHorseArmor(); + goldHorseArmor(); + diamondHorseArmor(); + nametag(); + } + + private void saddle() { + ShapedRecipe saddle = util.shaped(Material.SADDLE, "saddle_recipe"); + saddle.shape("wlw","sls","wlw"); + saddle.setIngredient('w', Material.STICK); + saddle.setIngredient('s', Material.STRING); + saddle.setIngredient('l', Material.LEATHER); + plugin.server.addRecipe(saddle); + } + + private void leatherHorseArmor() { + ShapedRecipe armor = util.shaped(Material.LEATHER_HORSE_ARMOR, "leather_horse_armor_recipe"); + armor.shape("aal","l*l","lsi"); + armor.setIngredient('a', Material.AIR); + armor.setIngredient('s', Material.STRING); + armor.setIngredient('l', Material.LEATHER); + armor.setIngredient('*', Material.SADDLE); + armor.setIngredient('i', Material.IRON_INGOT); + plugin.server.addRecipe(armor); + } + + private void ironHorseArmor() { + ShapedRecipe armor = util.shaped(Material.IRON_HORSE_ARMOR, "iron_horse_armor_recipe"); + armor.shape("aai","i*i","isi"); + armor.setIngredient('a', Material.AIR); + armor.setIngredient('s', Material.STRING); + armor.setIngredient('*', Material.SADDLE); + armor.setIngredient('i', Material.IRON_INGOT); + plugin.server.addRecipe(armor); + } + + private void goldHorseArmor() { + ShapedRecipe armor = util.shaped(Material.GOLDEN_HORSE_ARMOR, "golden_horse_armor_recipe"); + armor.shape("aag","g*g","gsi"); + armor.setIngredient('a', Material.AIR); + armor.setIngredient('s', Material.STRING); + armor.setIngredient('g', Material.GOLD_INGOT); + armor.setIngredient('*', Material.SADDLE); + armor.setIngredient('i', Material.IRON_INGOT); + plugin.server.addRecipe(armor); + } + + private void diamondHorseArmor() { + ShapedRecipe armor = util.shaped(Material.DIAMOND_HORSE_ARMOR, "diamond_horse_armor_recipe"); + armor.shape("aad","d*d","dsi"); + armor.setIngredient('a', Material.AIR); + armor.setIngredient('s', Material.STRING); + armor.setIngredient('d', Material.DIAMOND); + armor.setIngredient('*', Material.SADDLE); + armor.setIngredient('i', Material.IRON_INGOT); + plugin.server.addRecipe(armor); + } + + private void nametag() { + ShapedRecipe nametag = util.shaped(Material.NAME_TAG, "nametag_recipe"); + nametag.shape("aas","apa","paa"); + nametag.setIngredient('a', Material.AIR); + nametag.setIngredient('s', Material.STRING); + nametag.setIngredient('p', Material.PAPER); + plugin.server.addRecipe(nametag); + } +} diff --git a/src/main/java/dev/coomware/CraftingUtils.java b/src/main/java/dev/coomware/CraftingUtils.java new file mode 100644 index 0000000..d8aab35 --- /dev/null +++ b/src/main/java/dev/coomware/CraftingUtils.java @@ -0,0 +1,29 @@ +package dev.coomware; + +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.ShapedRecipe; +import org.bukkit.inventory.ShapelessRecipe; + +public class CraftingUtils { + private Uncraftables plugin; + + public CraftingUtils(Uncraftables instance) { + plugin = instance; + } + + private NamespacedKey newKey(String string) { + return new NamespacedKey(plugin, string); + } + + public ShapedRecipe shaped(Material result, String key) { + ItemStack is = new ItemStack(result); + return new ShapedRecipe(newKey(key), is); + } + + public ShapelessRecipe shapeless(Material result, String key) { + ItemStack is = new ItemStack(result); + return new ShapelessRecipe(newKey(key), is); + } +} diff --git a/src/main/java/dev/coomware/Uncraftables.java b/src/main/java/dev/coomware/Uncraftables.java new file mode 100644 index 0000000..4b67952 --- /dev/null +++ b/src/main/java/dev/coomware/Uncraftables.java @@ -0,0 +1,27 @@ +package dev.coomware; + +import org.bukkit.Server; +import org.bukkit.plugin.java.JavaPlugin; + +public class Uncraftables extends JavaPlugin { + public static Uncraftables plugin; + public Server server; + public CraftingUtils util; + + @Override + public void onLoad() { + plugin = this; + server = getServer(); + util = new CraftingUtils(this); + } + + @Override + public void onEnable() { + new Craftable(this).craftables(); + } + + @Override + public void onDisable() { + + } +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..625d94d --- /dev/null +++ b/src/main/resources/plugin.yml @@ -0,0 +1,6 @@ +name: Uncraftables +main: dev.coomware.Uncraftables +version: 1.0.0 +author: CoomWare +description: Adds in crafting recipes for all uncraftable items. +api-version: 1.16 \ No newline at end of file