Advertisement
Guest User

Main.java

a guest
Apr 7th, 2014
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 23.51 KB | None | 0 0
  1.  
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.Location;
  7. import org.bukkit.Material;
  8. import org.bukkit.block.Block;
  9. import org.bukkit.enchantments.Enchantment;
  10. import org.bukkit.entity.Player;
  11. import org.bukkit.event.EventHandler;
  12. import org.bukkit.event.Listener;
  13. import org.bukkit.event.block.BlockBreakEvent;
  14. import org.bukkit.inventory.ItemStack;
  15. import org.bukkit.plugin.PluginDescriptionFile;
  16. import org.bukkit.plugin.java.JavaPlugin;
  17.  
  18. public class Main extends JavaPlugin implements Listener {
  19.     public final Logger logger = Logger.getLogger("Minecraft");
  20.     public static Main Plugin;
  21.  
  22.     @Override
  23.     public void onDisable() {
  24.         PluginDescriptionFile pdfFile = this.getDescription();
  25.         this.logger.info(pdfFile.getName() + " Has Been Disabled!");
  26.  
  27.     }
  28.  
  29.     @Override
  30.     public void onEnable() {
  31.         PluginDescriptionFile pdfFile = this.getDescription();
  32.         this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion()
  33.                 + " Has Been Enabled!");
  34.         getConfig().options().copyDefaults(true);
  35.         saveConfig();
  36.         Bukkit.getPluginManager().registerEvents(this, this);
  37.     }
  38.  
  39.     @EventHandler
  40.     public void onBlockBreak(BlockBreakEvent event) {
  41.         Player player = event.getPlayer();
  42.         ItemStack item = player.getItemInHand();
  43.         if (item.getEnchantments().containsKey(Enchantment.LOOT_BONUS_BLOCKS)) {
  44.             if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) <= 4) {
  45.                 Location loc = event.getBlock().getLocation();
  46.                 if (event.getBlock().getType() == Material.IRON_ORE) {
  47.                     event.getBlock().getWorld()
  48.                             .getBlockAt(event.getBlock().getLocation())
  49.                             .setType(Material.AIR);
  50.                     event.getBlock()
  51.                             .getWorld()
  52.                             .dropItemNaturally(loc,
  53.                                     new ItemStack(Material.IRON_INGOT, 1));
  54.                     player.giveExp(1);
  55.                     event.getBlock().getDrops().clear();
  56.  
  57.                 } else {
  58.                     if (item.getEnchantments().containsKey(
  59.                             Enchantment.LOOT_BONUS_BLOCKS)) {
  60.                         if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) <= 4) {
  61.                             if (event.getBlock().getType() == Material.GOLD_ORE) {
  62.                                 event.getBlock()
  63.                                         .getWorld()
  64.                                         .getBlockAt(
  65.                                                 event.getBlock().getLocation())
  66.                                         .setType(Material.AIR);
  67.                                 event.getBlock()
  68.                                         .getWorld()
  69.                                         .dropItemNaturally(
  70.                                                 loc,
  71.                                                 new ItemStack(
  72.                                                         Material.GOLD_INGOT, 1));
  73.                                 player.giveExp(1);
  74.                                 event.getBlock().getDrops().clear();
  75.  
  76.                             } else {
  77.                                 if (item.getEnchantments().containsKey(
  78.                                         Enchantment.LOOT_BONUS_BLOCKS)) {
  79.                                     if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) <= 4) {
  80.                                         if (event.getBlock().getType() == Material.STONE) {
  81.                                             event.getBlock()
  82.                                                     .getWorld()
  83.                                                     .getBlockAt(
  84.                                                             event.getBlock()
  85.                                                                     .getLocation())
  86.                                                     .setType(Material.AIR);
  87.                                             event.getBlock()
  88.                                                     .getWorld()
  89.                                                     .dropItemNaturally(
  90.                                                             loc,
  91.                                                             new ItemStack(
  92.                                                                     Material.STONE,
  93.                                                                     1));
  94.                                             player.giveExp(1);
  95.                                             event.getBlock().getDrops().clear();
  96.  
  97.                                         } else {
  98.                                             if (item.getEnchantments()
  99.                                                     .containsKey(
  100.                                                             Enchantment.LOOT_BONUS_BLOCKS)) {
  101.                                                 if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) <= 4) {
  102.                                                     if (event.getBlock()
  103.                                                             .getType() == Material.NETHERRACK) {
  104.                                                         event.getBlock()
  105.                                                                 .getWorld()
  106.                                                                 .getBlockAt(
  107.                                                                         event.getBlock()
  108.                                                                                 .getLocation())
  109.                                                                 .setType(
  110.                                                                         Material.AIR);
  111.                                                         event.getBlock()
  112.                                                                 .getWorld()
  113.                                                                 .dropItemNaturally(
  114.                                                                         loc,
  115.                                                                         new ItemStack(
  116.                                                                                 Material.NETHER_BRICK_ITEM,
  117.                                                                                 1));
  118.                                                         player.giveExp(1);
  119.                                                         event.getBlock()
  120.                                                                 .getDrops()
  121.                                                                 .clear();
  122.  
  123.                                                     }
  124.                                                 }
  125.                                             }
  126.                                         }
  127.                                     }
  128.                                 }
  129.                             }
  130.                         }
  131.                     }
  132.                 }
  133.             }
  134.         }
  135.     }
  136.  
  137.     @EventHandler
  138.     public void onBlockBreak0(BlockBreakEvent event) {
  139.         Player player = event.getPlayer();
  140.         ItemStack item = player.getItemInHand();
  141.         Location loc = event.getBlock().getLocation();
  142.         if (item.getEnchantments().containsKey(Enchantment.LOOT_BONUS_BLOCKS)) {
  143.             if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 5) {
  144.                 if (event.getBlock().getType() == Material.IRON_ORE) {
  145.                     event.getBlock().getWorld()
  146.                             .getBlockAt(event.getBlock().getLocation())
  147.                             .setType(Material.AIR);
  148.                     event.getBlock()
  149.                             .getWorld()
  150.                             .dropItemNaturally(
  151.                                     loc,
  152.                                     new ItemStack(Material.IRON_INGOT,
  153.                                             getConfig().getInt("Five")));
  154.                     player.giveExp(1);
  155.                     event.getBlock().getDrops().clear();
  156.  
  157.                 } else {
  158.  
  159.                     if (item.getEnchantments().containsKey(
  160.                             Enchantment.LOOT_BONUS_BLOCKS)) {
  161.                         if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 5) {
  162.                             if (event.getBlock().getType() == Material.GOLD_ORE) {
  163.                                 event.getBlock()
  164.                                         .getWorld()
  165.                                         .getBlockAt(
  166.                                                 event.getBlock().getLocation())
  167.                                         .setType(Material.AIR);
  168.                                 event.getBlock()
  169.                                         .getWorld()
  170.                                         .dropItemNaturally(
  171.                                                 loc,
  172.                                                 new ItemStack(
  173.                                                         Material.GOLD_INGOT,
  174.                                                         getConfig().getInt(
  175.                                                                 "Five")));
  176.                                 player.giveExp(1);
  177.                                 event.getBlock().getDrops().clear();
  178.  
  179.                             } else {
  180.                                 if (item.getEnchantments().containsKey(
  181.                                         Enchantment.LOOT_BONUS_BLOCKS)) {
  182.                                     if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 5) {
  183.                                         if (event.getBlock().getType() == Material.STONE) {
  184.                                             event.getBlock()
  185.                                                     .getWorld()
  186.                                                     .getBlockAt(
  187.                                                             event.getBlock()
  188.                                                                     .getLocation())
  189.                                                     .setType(Material.AIR);
  190.                                             event.getBlock()
  191.                                                     .getWorld()
  192.                                                     .dropItemNaturally(
  193.                                                             loc,
  194.                                                             new ItemStack(
  195.                                                                     Material.STONE,
  196.                                                                     getConfig()
  197.                                                                             .getInt("Five")));
  198.                                             player.giveExp(1);
  199.                                             event.getBlock().getDrops().clear();
  200.  
  201.                                         } else {
  202.                                             if (item.getEnchantments()
  203.                                                     .containsKey(
  204.                                                             Enchantment.LOOT_BONUS_BLOCKS)) {
  205.                                                 if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 5) {
  206.                                                     if (event.getBlock()
  207.                                                             .getType() == Material.NETHERRACK) {
  208.                                                         event.getBlock()
  209.                                                                 .getWorld()
  210.                                                                 .getBlockAt(
  211.                                                                         event.getBlock()
  212.                                                                                 .getLocation())
  213.                                                                 .setType(
  214.                                                                         Material.AIR);
  215.                                                         event.getBlock()
  216.                                                                 .getWorld()
  217.                                                                 .dropItemNaturally(
  218.                                                                         loc,
  219.                                                                         new ItemStack(
  220.                                                                                 Material.NETHER_BRICK_ITEM,
  221.                                                                                 getConfig()
  222.                                                                                         .getInt("Five")));
  223.                                                         player.giveExp(1);
  224.                                                         event.getBlock()
  225.                                                                 .getDrops()
  226.                                                                 .clear();
  227.                                                     }
  228.                                                 }
  229.                                             }
  230.                                         }
  231.                                     }
  232.                                 }
  233.                             }
  234.                         }
  235.                     }
  236.                 }
  237.             }
  238.         }
  239.     }
  240.  
  241.     @EventHandler
  242.     public void onBlockBreak1(BlockBreakEvent event) {
  243.         Player player = event.getPlayer();
  244.         ItemStack item = player.getItemInHand();
  245.         Location loc = event.getBlock().getLocation();
  246.         if (item.getEnchantments().containsKey(Enchantment.LOOT_BONUS_BLOCKS)) {
  247.             if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 10) {
  248.                 if (event.getBlock().getType() == Material.IRON_ORE) {
  249.                     event.getBlock().getWorld()
  250.                             .getBlockAt(event.getBlock().getLocation())
  251.                             .setType(Material.AIR);
  252.                     event.getBlock()
  253.                             .getWorld()
  254.                             .dropItemNaturally(
  255.                                     loc,
  256.                                     new ItemStack(Material.IRON_INGOT,
  257.                                             getConfig().getInt("Ten")));
  258.                     player.giveExp(1);
  259.                     event.getBlock().getDrops().clear();
  260.  
  261.                 } else {
  262.  
  263.                     if (item.getEnchantments().containsKey(
  264.                             Enchantment.LOOT_BONUS_BLOCKS)) {
  265.                         if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 10) {
  266.                             if (event.getBlock().getType() == Material.GOLD_ORE) {
  267.                                 event.getBlock()
  268.                                         .getWorld()
  269.                                         .getBlockAt(
  270.                                                 event.getBlock().getLocation())
  271.                                         .setType(Material.AIR);
  272.                                 event.getBlock()
  273.                                         .getWorld()
  274.                                         .dropItemNaturally(
  275.                                                 loc,
  276.                                                 new ItemStack(
  277.                                                         Material.GOLD_INGOT,
  278.                                                         getConfig().getInt(
  279.                                                                 "Ten")));
  280.                                 player.giveExp(1);
  281.                                 event.getBlock().getDrops().clear();
  282.  
  283.                             } else {
  284.                                 if (item.getEnchantments().containsKey(
  285.                                         Enchantment.LOOT_BONUS_BLOCKS)) {
  286.                                     if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 10) {
  287.                                         if (event.getBlock().getType() == Material.STONE) {
  288.                                             event.getBlock()
  289.                                                     .getWorld()
  290.                                                     .getBlockAt(
  291.                                                             event.getBlock()
  292.                                                                     .getLocation())
  293.                                                     .setType(Material.AIR);
  294.                                             event.getBlock()
  295.                                                     .getWorld()
  296.                                                     .dropItemNaturally(
  297.                                                             loc,
  298.                                                             new ItemStack(
  299.                                                                     Material.STONE,
  300.                                                                     getConfig()
  301.                                                                             .getInt("Ten")));
  302.                                             player.giveExp(1);
  303.                                             event.getBlock().getDrops().clear();
  304.  
  305.                                         } else {
  306.                                             if (item.getEnchantments()
  307.                                                     .containsKey(
  308.                                                             Enchantment.LOOT_BONUS_BLOCKS)) {
  309.                                                 if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 10) {
  310.                                                     if (event.getBlock()
  311.                                                             .getType() == Material.NETHERRACK) {
  312.                                                         event.getBlock()
  313.                                                                 .getWorld()
  314.                                                                 .getBlockAt(
  315.                                                                         event.getBlock()
  316.                                                                                 .getLocation())
  317.                                                                 .setType(
  318.                                                                         Material.AIR);
  319.                                                         event.getBlock()
  320.                                                                 .getWorld()
  321.                                                                 .dropItemNaturally(
  322.                                                                         loc,
  323.                                                                         new ItemStack(
  324.                                                                                 Material.NETHER_BRICK_ITEM,
  325.                                                                                 getConfig()
  326.                                                                                         .getInt("Ten")));
  327.                                                         player.giveExp(1);
  328.                                                         event.getBlock()
  329.                                                                 .getDrops()
  330.                                                                 .clear();
  331.                                                     }
  332.                                                 }
  333.                                             }
  334.                                         }
  335.                                     }
  336.                                 }
  337.                             }
  338.                         }
  339.                     }
  340.                 }
  341.             }
  342.         }
  343.     }
  344.  
  345.     @EventHandler
  346.     public void onBlockBreak2(BlockBreakEvent event) {
  347.         Player player = event.getPlayer();
  348.         ItemStack item = player.getItemInHand();
  349.         Location loc = event.getBlock().getLocation();
  350.         if (item.getEnchantments().containsKey(Enchantment.LOOT_BONUS_BLOCKS)) {
  351.             if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 15) {
  352.                 if (event.getBlock().getType() == Material.IRON_ORE) {
  353.                     event.getBlock().getWorld()
  354.                             .getBlockAt(event.getBlock().getLocation())
  355.                             .setType(Material.AIR);
  356.                     event.getBlock()
  357.                             .getWorld()
  358.                             .dropItemNaturally(
  359.                                     loc,
  360.                                     new ItemStack(Material.IRON_INGOT,
  361.                                             getConfig().getInt("Fiften")));
  362.                     player.giveExp(1);
  363.                     event.getBlock().getDrops().clear();
  364.  
  365.                 } else {
  366.  
  367.                     if (item.getEnchantments().containsKey(
  368.                             Enchantment.LOOT_BONUS_BLOCKS)) {
  369.                         if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 15) {
  370.                             if (event.getBlock().getType() == Material.GOLD_ORE) {
  371.                                 event.getBlock()
  372.                                         .getWorld()
  373.                                         .getBlockAt(
  374.                                                 event.getBlock().getLocation())
  375.                                         .setType(Material.AIR);
  376.                                 event.getBlock()
  377.                                         .getWorld()
  378.                                         .dropItemNaturally(
  379.                                                 loc,
  380.                                                 new ItemStack(
  381.                                                         Material.GOLD_INGOT,
  382.                                                         getConfig().getInt(
  383.                                                                 "Fiften")));
  384.                                 player.giveExp(1);
  385.                                 event.getBlock().getDrops().clear();
  386.  
  387.                             } else {
  388.                                 if (item.getEnchantments().containsKey(
  389.                                         Enchantment.LOOT_BONUS_BLOCKS)) {
  390.                                     if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 15) {
  391.                                         if (event.getBlock().getType() == Material.STONE) {
  392.                                             event.getBlock()
  393.                                                     .getWorld()
  394.                                                     .getBlockAt(
  395.                                                             event.getBlock()
  396.                                                                     .getLocation())
  397.                                                     .setType(Material.AIR);
  398.                                             event.getBlock()
  399.                                                     .getWorld()
  400.                                                     .dropItemNaturally(
  401.                                                             loc,
  402.                                                             new ItemStack(
  403.                                                                     Material.STONE,
  404.                                                                     getConfig()
  405.                                                                             .getInt("Fiften")));
  406.                                             player.giveExp(1);
  407.                                             event.getBlock().getDrops().clear();
  408.  
  409.                                         } else {
  410.                                             if (item.getEnchantments()
  411.                                                     .containsKey(
  412.                                                             Enchantment.LOOT_BONUS_BLOCKS)) {
  413.                                                 if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 15) {
  414.                                                     if (event.getBlock()
  415.                                                             .getType() == Material.NETHERRACK) {
  416.                                                         event.getBlock()
  417.                                                                 .getWorld()
  418.                                                                 .getBlockAt(
  419.                                                                         event.getBlock()
  420.                                                                                 .getLocation())
  421.                                                                 .setType(
  422.                                                                         Material.AIR);
  423.                                                         event.getBlock()
  424.                                                                 .getWorld()
  425.                                                                 .dropItemNaturally(
  426.                                                                         loc,
  427.                                                                         new ItemStack(
  428.                                                                                 Material.NETHER_BRICK_ITEM,
  429.                                                                                 getConfig()
  430.                                                                                         .getInt("Fiften")));
  431.                                                         player.giveExp(1);
  432.                                                         event.getBlock()
  433.                                                                 .getDrops()
  434.                                                                 .clear();
  435.                                                     }
  436.                                                 }
  437.                                             }
  438.                                         }
  439.                                     }
  440.                                 }
  441.                             }
  442.                         }
  443.                     }
  444.                 }
  445.             }
  446.         }
  447.     }
  448.  
  449.     @EventHandler
  450.     public void onBlockBreak3(BlockBreakEvent event) {
  451.         Player player = event.getPlayer();
  452.         ItemStack item = player.getItemInHand();
  453.         Location loc = event.getBlock().getLocation();
  454.         if (item.getEnchantments().containsKey(Enchantment.LOOT_BONUS_BLOCKS)) {
  455.             if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 20) {
  456.                 if (event.getBlock().getType() == Material.IRON_ORE) {
  457.                     event.getBlock().getWorld()
  458.                             .getBlockAt(event.getBlock().getLocation())
  459.                             .setType(Material.AIR);
  460.                     event.getBlock()
  461.                             .getWorld()
  462.                             .dropItemNaturally(
  463.                                     loc,
  464.                                     new ItemStack(Material.IRON_INGOT,
  465.                                             getConfig().getInt("Twenty")));
  466.                     player.giveExp(1);
  467.                     event.getBlock().getDrops().clear();
  468.  
  469.                 } else {
  470.  
  471.                     if (item.getEnchantments().containsKey(
  472.                             Enchantment.LOOT_BONUS_BLOCKS)) {
  473.                         if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 20) {
  474.                             if (event.getBlock().getType() == Material.GOLD_ORE) {
  475.                                 event.getBlock()
  476.                                         .getWorld()
  477.                                         .getBlockAt(
  478.                                                 event.getBlock().getLocation())
  479.                                         .setType(Material.AIR);
  480.                                 event.getBlock()
  481.                                         .getWorld()
  482.                                         .dropItemNaturally(
  483.                                                 loc,
  484.                                                 new ItemStack(
  485.                                                         Material.GOLD_INGOT,
  486.                                                         getConfig().getInt(
  487.                                                                 "Twenty")));
  488.                                 player.giveExp(1);
  489.                                 event.getBlock().getDrops().clear();
  490.  
  491.                             } else {
  492.                                 if (item.getEnchantments().containsKey(
  493.                                         Enchantment.LOOT_BONUS_BLOCKS)) {
  494.                                     if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 20) {
  495.                                         if (event.getBlock().getType() == Material.STONE) {
  496.                                             event.getBlock()
  497.                                                     .getWorld()
  498.                                                     .getBlockAt(
  499.                                                             event.getBlock()
  500.                                                                     .getLocation())
  501.                                                     .setType(Material.AIR);
  502.                                             event.getBlock()
  503.                                                     .getWorld()
  504.                                                     .dropItemNaturally(
  505.                                                             loc,
  506.                                                             new ItemStack(
  507.                                                                     Material.STONE,
  508.                                                                     getConfig()
  509.                                                                             .getInt("Twenty")));
  510.                                             player.giveExp(1);
  511.                                             event.getBlock().getDrops().clear();
  512.  
  513.                                         } else {
  514.                                             if (item.getEnchantments()
  515.                                                     .containsKey(
  516.                                                             Enchantment.LOOT_BONUS_BLOCKS)) {
  517.                                                 if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 20) {
  518.                                                     if (event.getBlock()
  519.                                                             .getType() == Material.NETHERRACK) {
  520.                                                         event.getBlock()
  521.                                                                 .getWorld()
  522.                                                                 .getBlockAt(
  523.                                                                         event.getBlock()
  524.                                                                                 .getLocation())
  525.                                                                 .setType(
  526.                                                                         Material.AIR);
  527.                                                         event.getBlock()
  528.                                                                 .getWorld()
  529.                                                                 .dropItemNaturally(
  530.                                                                         loc,
  531.                                                                         new ItemStack(
  532.                                                                                 Material.NETHER_BRICK_ITEM,
  533.                                                                                 getConfig()
  534.                                                                                         .getInt("Twenty")));
  535.                                                         player.giveExp(1);
  536.                                                         event.getBlock()
  537.                                                                 .getDrops()
  538.                                                                 .clear();
  539.                                                     }
  540.                                                 }
  541.                                             }
  542.                                         }
  543.                                     }
  544.                                 }
  545.                             }
  546.                         }
  547.                     }
  548.                 }
  549.             }
  550.         }
  551.     }
  552.  
  553.     @EventHandler
  554.     public void onBlockBreak4(BlockBreakEvent event) {
  555.         Player player = event.getPlayer();
  556.         ItemStack item = player.getItemInHand();
  557.         Location loc = event.getBlock().getLocation();
  558.         if (item.getEnchantments().containsKey(Enchantment.LOOT_BONUS_BLOCKS)) {
  559.             if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 25) {
  560.                 if (event.getBlock().getType() == Material.IRON_ORE) {
  561.                     event.getBlock().getWorld()
  562.                             .getBlockAt(event.getBlock().getLocation())
  563.                             .setType(Material.AIR);
  564.                     event.getBlock()
  565.                             .getWorld()
  566.                             .dropItemNaturally(
  567.                                     loc,
  568.                                     new ItemStack(Material.IRON_INGOT,
  569.                                             getConfig().getInt("Twentyfive")));
  570.                     player.giveExp(1);
  571.                     event.getBlock().getDrops().clear();
  572.  
  573.                 } else {
  574.  
  575.                     if (item.getEnchantments().containsKey(
  576.                             Enchantment.LOOT_BONUS_BLOCKS)) {
  577.                         if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 25) {
  578.                             if (event.getBlock().getType() == Material.GOLD_ORE) {
  579.                                 event.getBlock()
  580.                                         .getWorld()
  581.                                         .getBlockAt(
  582.                                                 event.getBlock().getLocation())
  583.                                         .setType(Material.AIR);
  584.                                 event.getBlock()
  585.                                         .getWorld()
  586.                                         .dropItemNaturally(
  587.                                                 loc,
  588.                                                 new ItemStack(
  589.                                                         Material.GOLD_INGOT,
  590.                                                         getConfig().getInt(
  591.                                                                 "Twentyfive")));
  592.                                 player.giveExp(1);
  593.                                 event.getBlock().getDrops().clear();
  594.  
  595.                             } else {
  596.                                 if (item.getEnchantments().containsKey(
  597.                                         Enchantment.LOOT_BONUS_BLOCKS)) {
  598.                                     if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 25) {
  599.                                         if (event.getBlock().getType() == Material.STONE) {
  600.                                             event.getBlock()
  601.                                                     .getWorld()
  602.                                                     .getBlockAt(
  603.                                                             event.getBlock()
  604.                                                                     .getLocation())
  605.                                                     .setType(Material.AIR);
  606.                                             event.getBlock()
  607.                                                     .getWorld()
  608.                                                     .dropItemNaturally(
  609.                                                             loc,
  610.                                                             new ItemStack(
  611.                                                                     Material.STONE,
  612.                                                                     getConfig()
  613.                                                                             .getInt("Twentyfive")));
  614.                                             player.giveExp(1);
  615.                                             event.getBlock().getDrops().clear();
  616.  
  617.                                         } else {
  618.                                             if (item.getEnchantments()
  619.                                                     .containsKey(
  620.                                                             Enchantment.LOOT_BONUS_BLOCKS)) {
  621.                                                 if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 25) {
  622.                                                     if (event.getBlock()
  623.                                                             .getType() == Material.NETHERRACK) {
  624.                                                         event.getBlock()
  625.                                                                 .getWorld()
  626.                                                                 .getBlockAt(
  627.                                                                         event.getBlock()
  628.                                                                                 .getLocation())
  629.                                                                 .setType(
  630.                                                                         Material.AIR);
  631.                                                         event.getBlock()
  632.                                                                 .getWorld()
  633.                                                                 .dropItemNaturally(
  634.                                                                         loc,
  635.                                                                         new ItemStack(
  636.                                                                                 Material.NETHER_BRICK_ITEM,
  637.                                                                                 getConfig()
  638.                                                                                         .getInt("Twentyfive")));
  639.                                                         player.giveExp(1);
  640.                                                         event.getBlock()
  641.                                                                 .getDrops()
  642.                                                                 .clear();
  643.                                                     }
  644.                                                 }
  645.                                             }
  646.                                         }
  647.                                     }
  648.                                 }
  649.                             }
  650.                         }
  651.                     }
  652.                 }
  653.             }
  654.         }
  655.     }
  656.  
  657.     @EventHandler
  658.     public void onBlockBreak5(BlockBreakEvent event) {
  659.         Player player = event.getPlayer();
  660.         ItemStack item = player.getItemInHand();
  661.         Location loc = event.getBlock().getLocation();
  662.         if (item.getEnchantments().containsKey(Enchantment.LOOT_BONUS_BLOCKS)) {
  663.             if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 30) {
  664.                 if (event.getBlock().getType() == Material.IRON_ORE) {
  665.                     event.getBlock().getWorld()
  666.                             .getBlockAt(event.getBlock().getLocation())
  667.                             .setType(Material.AIR);
  668.                     event.getBlock()
  669.                             .getWorld()
  670.                             .dropItemNaturally(
  671.                                     loc,
  672.                                     new ItemStack(Material.IRON_INGOT,
  673.                                             getConfig().getInt("Thirty")));
  674.                     player.giveExp(1);
  675.                     event.getBlock().getDrops().clear();
  676.  
  677.                 } else {
  678.  
  679.                     if (item.getEnchantments().containsKey(
  680.                             Enchantment.LOOT_BONUS_BLOCKS)) {
  681.                         if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 30) {
  682.                             if (event.getBlock().getType() == Material.GOLD_ORE) {
  683.                                 event.getBlock()
  684.                                         .getWorld()
  685.                                         .getBlockAt(
  686.                                                 event.getBlock().getLocation())
  687.                                         .setType(Material.AIR);
  688.                                 event.getBlock()
  689.                                         .getWorld()
  690.                                         .dropItemNaturally(
  691.                                                 loc,
  692.                                                 new ItemStack(
  693.                                                         Material.GOLD_INGOT,
  694.                                                         getConfig().getInt(
  695.                                                                 "Thirty")));
  696.                                 player.giveExp(1);
  697.                                 event.getBlock().getDrops().clear();
  698.  
  699.                             } else {
  700.                                 if (item.getEnchantments().containsKey(
  701.                                         Enchantment.LOOT_BONUS_BLOCKS)) {
  702.                                     if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 30) {
  703.                                         if (event.getBlock().getType() == Material.STONE) {
  704.                                             event.getBlock()
  705.                                                     .getWorld()
  706.                                                     .getBlockAt(
  707.                                                             event.getBlock()
  708.                                                                     .getLocation())
  709.                                                     .setType(Material.AIR);
  710.                                             event.getBlock()
  711.                                                     .getWorld()
  712.                                                     .dropItemNaturally(
  713.                                                             loc,
  714.                                                             new ItemStack(
  715.                                                                     Material.STONE,
  716.                                                                     getConfig()
  717.                                                                             .getInt("Thirty")));
  718.                                             player.giveExp(1);
  719.                                             event.getBlock().getDrops().clear();
  720.  
  721.                                         } else {
  722.                                             if (item.getEnchantments()
  723.                                                     .containsKey(
  724.                                                             Enchantment.LOOT_BONUS_BLOCKS)) {
  725.                                                 if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) >= 30) {
  726.                                                     if (event.getBlock()
  727.                                                             .getType() == Material.NETHERRACK) {
  728.                                                         event.getBlock()
  729.                                                                 .getWorld()
  730.                                                                 .getBlockAt(
  731.                                                                         event.getBlock()
  732.                                                                                 .getLocation())
  733.                                                                 .setType(
  734.                                                                         Material.AIR);
  735.                                                         event.getBlock()
  736.                                                                 .getWorld()
  737.                                                                 .dropItemNaturally(
  738.                                                                         loc,
  739.                                                                         new ItemStack(
  740.                                                                                 Material.NETHER_BRICK_ITEM,
  741.                                                                                 getConfig()
  742.                                                                                         .getInt("Thirty")));
  743.                                                         player.giveExp(1);
  744.                                                         event.getBlock()
  745.                                                                 .getDrops()
  746.                                                                 .clear();
  747.                                                     }
  748.                                                 }
  749.                                             }
  750.                                         }
  751.                                     }
  752.                                 }
  753.                             }
  754.                         }
  755.                     }
  756.                 }
  757.             }
  758.         }
  759.     }
  760. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement