From 0183ab010955c29a5da598961eee7cbd68932ab5 Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Mon, 2 Aug 2021 12:32:50 -0400 Subject: [PATCH] Rename ItemRecipies to ItemRecipes and reformat it. --- dependency-reduced-pom.xml | 2 +- pom.xml | 2 +- .../energeticstorage/EnergeticStorage.java | 16 +--- .../energeticstorage/utils/ItemRecipes.java | 88 ++++++++++++++++++ .../energeticstorage/utils/ItemRecipies.java | 92 ------------------- 5 files changed, 92 insertions(+), 108 deletions(-) create mode 100644 src/main/java/net/seanomik/energeticstorage/utils/ItemRecipes.java delete mode 100644 src/main/java/net/seanomik/energeticstorage/utils/ItemRecipies.java diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index c31795f..5a02ce9 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -4,7 +4,7 @@ net.seanomik energeticstorage EnergeticStorage - 0.7.3-SNAPSHOT + 0.7.4-SNAPSHOT clean package diff --git a/pom.xml b/pom.xml index 9955fe2..35f0a6f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.seanomik energeticstorage - 0.7.3-SNAPSHOT + 0.7.4-SNAPSHOT jar EnergeticStorage diff --git a/src/main/java/net/seanomik/energeticstorage/EnergeticStorage.java b/src/main/java/net/seanomik/energeticstorage/EnergeticStorage.java index 343389c..9f3c127 100644 --- a/src/main/java/net/seanomik/energeticstorage/EnergeticStorage.java +++ b/src/main/java/net/seanomik/energeticstorage/EnergeticStorage.java @@ -9,24 +9,12 @@ import net.seanomik.energeticstorage.listeners.BlockPlaceListener; import net.seanomik.energeticstorage.listeners.PlayerInteractListener; import net.seanomik.energeticstorage.objects.ESSystem; import net.seanomik.energeticstorage.tasks.HopperTask; -import net.seanomik.energeticstorage.utils.ItemRecipies; +import net.seanomik.energeticstorage.utils.ItemRecipes; import net.seanomik.energeticstorage.utils.Reference; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.data.type.Chest; -import org.bukkit.block.data.type.Hopper; -import org.bukkit.craftbukkit.libs.jline.internal.Nullable; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.world.WorldSaveEvent; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scheduler.BukkitTask; import java.util.*; @@ -40,7 +28,7 @@ public final class EnergeticStorage extends JavaPlugin implements Listener { registerCommands(); registerListener(); - ItemRecipies.registerRecipes(); + ItemRecipes.registerRecipes(); ConfigFile.getConfig().saveDefaultConfig(); PlayersFile.getConfig().saveDefaultConfig(); diff --git a/src/main/java/net/seanomik/energeticstorage/utils/ItemRecipes.java b/src/main/java/net/seanomik/energeticstorage/utils/ItemRecipes.java new file mode 100644 index 0000000..9b5a02f --- /dev/null +++ b/src/main/java/net/seanomik/energeticstorage/utils/ItemRecipes.java @@ -0,0 +1,88 @@ +package net.seanomik.energeticstorage.utils; + +import net.seanomik.energeticstorage.EnergeticStorage; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.ShapedRecipe; + +public class ItemRecipes { + public static void registerRecipes() { + registerBlockRecipes(); + registerDriveRecipes(); + } + + private static void registerBlockRecipes() { + try { + // Register system block + ItemStack esSystem = ItemConstructor.createSystemBlock(); + ShapedRecipe systemRecipe = new ShapedRecipe(new NamespacedKey(EnergeticStorage.getPlugin(), "es_system"), esSystem) + .shape("III", + "RGR", + "DID") + .setIngredient('I', Material.IRON_INGOT) + .setIngredient('G', Material.GLOWSTONE_DUST) + .setIngredient('R', Material.REDSTONE) + .setIngredient('D', Material.DIAMOND); + + Bukkit.getServer().addRecipe(systemRecipe); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static void registerDriveRecipes() { + try { // If the plugin was reloaded, a exception will be thrown. + // Register Drive 1k + ItemStack drive1k = ItemConstructor.createDrive(1024, 0, 0); + + ShapedRecipe drv1k = new ShapedRecipe(new NamespacedKey(EnergeticStorage.getPlugin(), "es_drive_1k"), drive1k) + .shape("RCR", + "CRC", + "III") + .setIngredient('I', Material.IRON_INGOT) + .setIngredient('C', Material.CLAY) + .setIngredient('R', Material.REDSTONE); + Bukkit.getServer().addRecipe(drv1k); + + // Register Drive 4k + ItemStack drive4k = ItemConstructor.createDrive(4096, 0, 0); + + ShapedRecipe drv4k = new ShapedRecipe(new NamespacedKey(EnergeticStorage.getPlugin(), "es_drive_4k"), drive4k) + .shape("RBR", + "BRB", + "III") + .setIngredient('I', Material.IRON_INGOT) + .setIngredient('B', Material.BRICK) + .setIngredient('R', Material.REDSTONE); + Bukkit.getServer().addRecipe(drv4k); + + // Register Drive 16k + ItemStack drive16k = ItemConstructor.createDrive(16384, 0, 0); + + ShapedRecipe drv16k = new ShapedRecipe(new NamespacedKey(EnergeticStorage.getPlugin(), "es_drive_16k"), drive16k) + .shape("RGR", + "GRG", + "III") + .setIngredient('I', Material.IRON_INGOT) + .setIngredient('G', Material.GOLD_INGOT) + .setIngredient('R', Material.REDSTONE); + Bukkit.getServer().addRecipe(drv16k); + + // Register Drive 64k + ItemStack drive64k = ItemConstructor.createDrive(65536, 0, 0); + + ShapedRecipe drv64k = new ShapedRecipe(new NamespacedKey(EnergeticStorage.getPlugin(), "es_drive_64k"), drive64k) + .shape("RDR", + "DRD", + "III") + .setIngredient('I', Material.IRON_INGOT) + .setIngredient('D', Material.DIAMOND) + .setIngredient('R', Material.REDSTONE); + Bukkit.getServer().addRecipe(drv64k); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/net/seanomik/energeticstorage/utils/ItemRecipies.java b/src/main/java/net/seanomik/energeticstorage/utils/ItemRecipies.java deleted file mode 100644 index 34e551c..0000000 --- a/src/main/java/net/seanomik/energeticstorage/utils/ItemRecipies.java +++ /dev/null @@ -1,92 +0,0 @@ -package net.seanomik.energeticstorage.utils; - -import net.seanomik.energeticstorage.EnergeticStorage; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.NamespacedKey; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.ShapedRecipe; - -public class ItemRecipies { - public static void registerRecipes() { - registerBlockRecipes(); - registerDriveRecipes(); - } - - private static void registerBlockRecipes() { - try { - // Register system block - ItemStack esSystem = ItemConstructor.createSystemBlock(); - ShapedRecipe systemRecipe = new ShapedRecipe(new NamespacedKey(EnergeticStorage.getPlugin(), "es_system"), esSystem); - systemRecipe.shape( - "III", - "RGR", - "DID"); - systemRecipe.setIngredient('I', Material.IRON_INGOT); - systemRecipe.setIngredient('G', Material.GLOWSTONE_DUST); - systemRecipe.setIngredient('R', Material.REDSTONE); - systemRecipe.setIngredient('D', Material.DIAMOND); - Bukkit.getServer().addRecipe(systemRecipe); - } catch (Exception e) { - - } - } - - private static void registerDriveRecipes() { - try { // If the plugin was reloaded, a exception will be thrown. - // Register Drive 1k - ItemStack drive1k = ItemConstructor.createDrive(1024, 0, 0); - - ShapedRecipe drv1k = new ShapedRecipe(new NamespacedKey(EnergeticStorage.getPlugin(), "es_drive_1k"), drive1k); - drv1k.shape( - "RCR", - "CRC", - "III"); - drv1k.setIngredient('I', Material.IRON_INGOT); - drv1k.setIngredient('C', Material.CLAY); - drv1k.setIngredient('R', Material.REDSTONE); - Bukkit.getServer().addRecipe(drv1k); - - // Register Drive 4k - ItemStack drive4k = ItemConstructor.createDrive(4096, 0, 0); - - ShapedRecipe drv4k = new ShapedRecipe(new NamespacedKey(EnergeticStorage.getPlugin(), "es_drive_4k"), drive4k); - drv4k.shape( - "RBR", - "BRB", - "III"); - drv4k.setIngredient('I', Material.IRON_INGOT); - drv4k.setIngredient('B', Material.BRICK); - drv4k.setIngredient('R', Material.REDSTONE); - Bukkit.getServer().addRecipe(drv4k); - - // Register Drive 16k - ItemStack drive16k = ItemConstructor.createDrive(16384, 0, 0); - - ShapedRecipe drv16k = new ShapedRecipe(new NamespacedKey(EnergeticStorage.getPlugin(), "es_drive_16k"), drive16k); - drv16k.shape( - "RGR", - "GRG", - "III"); - drv16k.setIngredient('I', Material.IRON_INGOT); - drv16k.setIngredient('G', Material.GOLD_INGOT); - drv16k.setIngredient('R', Material.REDSTONE); - Bukkit.getServer().addRecipe(drv16k); - - // Register Drive 64k - ItemStack drive64k = ItemConstructor.createDrive(65536, 0, 0); - - ShapedRecipe drv64k = new ShapedRecipe(new NamespacedKey(EnergeticStorage.getPlugin(), "es_drive_64k"), drive64k); - drv64k.shape( - "RDR", - "DRD", - "III"); - drv64k.setIngredient('I', Material.IRON_INGOT); - drv64k.setIngredient('D', Material.DIAMOND); - drv64k.setIngredient('R', Material.REDSTONE); - Bukkit.getServer().addRecipe(drv64k); - } catch (Exception e) { - - } - } -}