Rename ItemRecipies to ItemRecipes and reformat it.

This commit is contained in:
SeanOMik 2021-08-02 12:32:50 -04:00
parent f66f9749dd
commit 0183ab0109
No known key found for this signature in database
GPG Key ID: CA09E5BE1F32728A
5 changed files with 92 additions and 108 deletions

View File

@ -4,7 +4,7 @@
<groupId>net.seanomik</groupId> <groupId>net.seanomik</groupId>
<artifactId>energeticstorage</artifactId> <artifactId>energeticstorage</artifactId>
<name>EnergeticStorage</name> <name>EnergeticStorage</name>
<version>0.7.3-SNAPSHOT</version> <version>0.7.4-SNAPSHOT</version>
<build> <build>
<defaultGoal>clean package</defaultGoal> <defaultGoal>clean package</defaultGoal>
<resources> <resources>

View File

@ -6,7 +6,7 @@
<groupId>net.seanomik</groupId> <groupId>net.seanomik</groupId>
<artifactId>energeticstorage</artifactId> <artifactId>energeticstorage</artifactId>
<version>0.7.3-SNAPSHOT</version> <version>0.7.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>EnergeticStorage</name> <name>EnergeticStorage</name>

View File

@ -9,24 +9,12 @@ import net.seanomik.energeticstorage.listeners.BlockPlaceListener;
import net.seanomik.energeticstorage.listeners.PlayerInteractListener; import net.seanomik.energeticstorage.listeners.PlayerInteractListener;
import net.seanomik.energeticstorage.objects.ESSystem; import net.seanomik.energeticstorage.objects.ESSystem;
import net.seanomik.energeticstorage.tasks.HopperTask; 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 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.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.world.WorldSaveEvent; 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.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import java.util.*; import java.util.*;
@ -40,7 +28,7 @@ public final class EnergeticStorage extends JavaPlugin implements Listener {
registerCommands(); registerCommands();
registerListener(); registerListener();
ItemRecipies.registerRecipes(); ItemRecipes.registerRecipes();
ConfigFile.getConfig().saveDefaultConfig(); ConfigFile.getConfig().saveDefaultConfig();
PlayersFile.getConfig().saveDefaultConfig(); PlayersFile.getConfig().saveDefaultConfig();

View File

@ -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();
}
}
}

View File

@ -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) {
}
}
}