Files
src
build.gradle
manifest.kod
Code
6 266
src/main/java/com/frenzy/coackroach/FrenzyCoackroach.java
package com.frenzy.coackroach;
import com.frenzy.coackroach.commands.CoackroachCommand;
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.plugin.java.JavaPlugin;
public class FrenzyCoackroach extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("FrenzyCoackroach plugin is loading...");
registerCommands();
registerCraftingRecipes();
getLogger().info("FrenzyCoackroach plugin has been enabled!");
}
@Override
public void onDisable() {
getLogger().info("FrenzyCoackroach plugin has been disabled!");
}
private void registerCommands() {
getCommand("coackroach").setExecutor(new CoackroachCommand());
}
private void registerCraftingRecipes() {
registerHelmetRecipe();
registerChestplateRecipe();
registerLeggingsRecipe();
registerBootsRecipe();
}
private void registerHelmetRecipe() {
ItemStack helmet = ArmorItems.createCoackroachHelmet();
NamespacedKey key = new NamespacedKey(this, "coackroach_helmet");
ShapedRecipe recipe = new ShapedRecipe(key, helmet);
recipe.shape("BBB", "BNB", " ");
recipe.setIngredient('B', XMaterial.matchXMaterial("BROWN_DYE").map(XMaterial::parseMaterial).get());
recipe.setIngredient('N', XMaterial.matchXMaterial("NETHERITE_HELMET").map(XMaterial::parseMaterial).get());
Bukkit.addRecipe(recipe);
}
private void registerChestplateRecipe() {
ItemStack chestplate = ArmorItems.createCoackroachChestplate();
NamespacedKey key = new NamespacedKey(this, "coackroach_chestplate");
ShapedRecipe recipe = new ShapedRecipe(key, chestplate);
recipe.shape("B B", "BNB", "BBB");
recipe.setIngredient('B', XMaterial.matchXMaterial("BROWN_DYE").map(XMaterial::parseMaterial).get());
recipe.setIngredient('N', XMaterial.matchXMaterial("NETHERITE_CHESTPLATE").map(XMaterial::parseMaterial).get());
Bukkit.addRecipe(recipe);
}
private void registerLeggingsRecipe() {
ItemStack leggings = ArmorItems.createCoackroachLeggings();
NamespacedKey key = new NamespacedKey(this, "coackroach_leggings");
ShapedRecipe recipe = new ShapedRecipe(key, leggings);
recipe.shape("BBB", "BNB", "B B");
recipe.setIngredient('B', XMaterial.matchXMaterial("BROWN_DYE").map(XMaterial::parseMaterial).get());
recipe.setIngredient('N', XMaterial.matchXMaterial("NETHERITE_LEGGINGS").map(XMaterial::parseMaterial).get());
Bukkit.addRecipe(recipe);
}
private void registerBootsRecipe() {
ItemStack boots = ArmorItems.createCoackroachBoots();
NamespacedKey key = new NamespacedKey(this, "coackroach_boots");
ShapedRecipe recipe = new ShapedRecipe(key, boots);
recipe.shape(" ", "BNB", "B B");
recipe.setIngredient('B', XMaterial.matchXMaterial("BROWN_DYE").map(XMaterial::parseMaterial).get());
recipe.setIngredient('N', XMaterial.matchXMaterial("NETHERITE_BOOTS").map(XMaterial::parseMaterial).get());
Bukkit.addRecipe(recipe);
}
}