Guest User

Untitled

a guest
Feb 8th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. package pl.killerek.xfosahc.cobblex;
  2.  
  3. import java.util.List;
  4. import org.bukkit.Material;
  5. import org.bukkit.Server;
  6. import org.bukkit.configuration.file.FileConfiguration;
  7. import org.bukkit.event.EventHandler;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.event.inventory.InventoryType;
  10. import org.bukkit.event.inventory.PrepareItemCraftEvent;
  11. import org.bukkit.inventory.CraftingInventory;
  12. import org.bukkit.inventory.ItemStack;
  13. import org.bukkit.inventory.meta.ItemMeta;
  14. import org.bukkit.plugin.PluginManager;
  15.  
  16. public class PrepareItemCraftListener
  17. implements Listener
  18. {
  19. public Main plugin;
  20.  
  21. public PrepareItemCraftListener(Main plugin)
  22. {
  23. this.plugin = plugin;
  24. this.plugin.getServer().getPluginManager().registerEvents(this, this.plugin);
  25. }
  26.  
  27. @EventHandler
  28. public void onCraft(PrepareItemCraftEvent e)
  29. {
  30. if ((e.getInventory().getType().equals(InventoryType.WORKBENCH)) &&
  31. (e.getInventory().getResult().getType().equals(Material.getMaterial(this.plugin.getConfig().getInt("config.output")))) &&
  32. (e.getInventory().getResult().getItemMeta().getDisplayName().equalsIgnoreCase(Util.fixColor(this.plugin.getConfig().getString("config.name")))) &&
  33. (e.getInventory().getResult().getItemMeta().getLore().equals(Util.fixColor(this.plugin.getConfig().getStringList("config.lore")))))
  34. {
  35. if (e.getInventory().getItem(1).getAmount() == this.plugin
  36. .getConfig().getInt("config.numbers.s1")) {
  37. if (e.getInventory().getItem(2).getAmount() == this.plugin
  38. .getConfig()
  39. .getInt("config.numbers.s2")) {
  40. if (e.getInventory().getItem(3).getAmount() == this.plugin
  41. .getConfig()
  42. .getInt("config.numbers.s3")) {
  43. if (e.getInventory().getItem(4).getAmount() == this.plugin
  44. .getConfig()
  45. .getInt("config.numbers.s4")) {
  46. if (e.getInventory().getItem(5).getAmount() == this.plugin
  47. .getConfig()
  48. .getInt("config.numbers.s5")) {
  49. if (e.getInventory().getItem(6).getAmount() == this.plugin
  50. .getConfig()
  51. .getInt("config.numbers.s6")) {
  52. if (e.getInventory().getItem(7).getAmount() == this.plugin
  53. .getConfig()
  54. .getInt("config.numbers.s7")) {
  55. if (e.getInventory().getItem(8).getAmount() == this.plugin
  56. .getConfig()
  57. .getInt("config.numbers.s8")) {
  58. if (e.getInventory().getItem(9).getAmount() == this.plugin
  59. .getConfig()
  60. .getInt("config.numbers.s9")) {
  61. return;
  62. }
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }
  69. }
  70. }
  71. e.getInventory().setResult(
  72. new ItemStack(Material.AIR, 0));
  73. }
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment