Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.killerek.xfosahc.cobblex;
- import java.util.List;
- import org.bukkit.Material;
- import org.bukkit.Server;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.inventory.InventoryType;
- import org.bukkit.event.inventory.PrepareItemCraftEvent;
- import org.bukkit.inventory.CraftingInventory;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.plugin.PluginManager;
- public class PrepareItemCraftListener
- implements Listener
- {
- public Main plugin;
- public PrepareItemCraftListener(Main plugin)
- {
- this.plugin = plugin;
- this.plugin.getServer().getPluginManager().registerEvents(this, this.plugin);
- }
- @EventHandler
- public void onCraft(PrepareItemCraftEvent e)
- {
- if ((e.getInventory().getType().equals(InventoryType.WORKBENCH)) &&
- (e.getInventory().getResult().getType().equals(Material.getMaterial(this.plugin.getConfig().getInt("config.output")))) &&
- (e.getInventory().getResult().getItemMeta().getDisplayName().equalsIgnoreCase(Util.fixColor(this.plugin.getConfig().getString("config.name")))) &&
- (e.getInventory().getResult().getItemMeta().getLore().equals(Util.fixColor(this.plugin.getConfig().getStringList("config.lore")))))
- {
- if (e.getInventory().getItem(1).getAmount() == this.plugin
- .getConfig().getInt("config.numbers.s1")) {
- if (e.getInventory().getItem(2).getAmount() == this.plugin
- .getConfig()
- .getInt("config.numbers.s2")) {
- if (e.getInventory().getItem(3).getAmount() == this.plugin
- .getConfig()
- .getInt("config.numbers.s3")) {
- if (e.getInventory().getItem(4).getAmount() == this.plugin
- .getConfig()
- .getInt("config.numbers.s4")) {
- if (e.getInventory().getItem(5).getAmount() == this.plugin
- .getConfig()
- .getInt("config.numbers.s5")) {
- if (e.getInventory().getItem(6).getAmount() == this.plugin
- .getConfig()
- .getInt("config.numbers.s6")) {
- if (e.getInventory().getItem(7).getAmount() == this.plugin
- .getConfig()
- .getInt("config.numbers.s7")) {
- if (e.getInventory().getItem(8).getAmount() == this.plugin
- .getConfig()
- .getInt("config.numbers.s8")) {
- if (e.getInventory().getItem(9).getAmount() == this.plugin
- .getConfig()
- .getInt("config.numbers.s9")) {
- return;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- e.getInventory().setResult(
- new ItemStack(Material.AIR, 0));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment