Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.Funergy.main;
- import java.util.logging.Logger;
- import org.bukkit.Bukkit;
- import org.bukkit.Material;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.PlayerInventory;
- import org.bukkit.plugin.java.JavaPlugin;
- public class main
- extends JavaPlugin
- {
- public void onEnable()
- {
- Bukkit.getLogger().info("OreToBlock Has been enabled!");
- }
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
- {
- if (command.getName().equalsIgnoreCase("block"))
- {
- Player p = (Player)sender;
- if (p.hasPermission("blocktoores.use")) {
- for (ItemStack i : p.getInventory().getContents()) {
- if (i != null)
- {
- if (i.getType().equals(Material.IRON_INGOT))
- {
- if ((i.getAmount() >= 9) && (i.getAmount() < 18))
- {
- i.setAmount(i.getAmount() - 9);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.IRON_BLOCK, 1) });
- }
- if ((i.getAmount() >= 18) && (i.getAmount() < 27))
- {
- i.setAmount(i.getAmount() - 18);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.IRON_BLOCK, 2) });
- }
- if ((i.getAmount() >= 27) && (i.getAmount() < 36))
- {
- i.setAmount(i.getAmount() - 27);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.IRON_BLOCK, 3) });
- }
- if ((i.getAmount() >= 36) && (i.getAmount() < 45))
- {
- i.setAmount(i.getAmount() - 36);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.IRON_BLOCK, 4) });
- }
- if ((i.getAmount() >= 45) && (i.getAmount() < 54))
- {
- i.setAmount(i.getAmount() - 45);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.IRON_BLOCK, 5) });
- }
- if ((i.getAmount() >= 54) && (i.getAmount() < 63))
- {
- i.setAmount(i.getAmount() - 54);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.IRON_BLOCK, 6) });
- }
- if ((i.getAmount() >= 63) && (i.getAmount() < 64))
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.IRON_BLOCK, 7) });
- }
- if (i.getAmount() == 64)
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.IRON_BLOCK, 7) });
- }
- }
- if (i.getType().equals(Material.DIAMOND))
- {
- if ((i.getAmount() >= 9) && (i.getAmount() < 18))
- {
- i.setAmount(i.getAmount() - 9);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.DIAMOND_BLOCK, 1) });
- }
- if ((i.getAmount() >= 18) && (i.getAmount() < 27))
- {
- i.setAmount(i.getAmount() - 18);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.DIAMOND_BLOCK, 2) });
- }
- if ((i.getAmount() >= 27) && (i.getAmount() < 36))
- {
- i.setAmount(i.getAmount() - 27);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.DIAMOND_BLOCK, 3) });
- }
- if ((i.getAmount() >= 36) && (i.getAmount() < 45))
- {
- i.setAmount(i.getAmount() - 36);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.DIAMOND_BLOCK, 4) });
- }
- if ((i.getAmount() >= 45) && (i.getAmount() < 54))
- {
- i.setAmount(i.getAmount() - 45);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.DIAMOND_BLOCK, 5) });
- }
- if ((i.getAmount() >= 54) && (i.getAmount() < 63))
- {
- i.setAmount(i.getAmount() - 54);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.DIAMOND_BLOCK, 6) });
- }
- if ((i.getAmount() >= 63) && (i.getAmount() < 64))
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.DIAMOND_BLOCK, 7) });
- }
- if (i.getAmount() == 64)
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.DIAMOND_BLOCK, 7) });
- }
- }
- if (i.getType().equals(Material.GOLD_INGOT))
- {
- if ((i.getAmount() >= 9) && (i.getAmount() < 18))
- {
- i.setAmount(i.getAmount() - 9);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.GOLD_BLOCK, 1) });
- }
- if ((i.getAmount() >= 18) && (i.getAmount() < 27))
- {
- i.setAmount(i.getAmount() - 18);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.GOLD_BLOCK, 2) });
- }
- if ((i.getAmount() >= 27) && (i.getAmount() < 36))
- {
- i.setAmount(i.getAmount() - 27);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.GOLD_BLOCK, 3) });
- }
- if ((i.getAmount() >= 36) && (i.getAmount() < 45))
- {
- i.setAmount(i.getAmount() - 36);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.GOLD_BLOCK, 4) });
- }
- if ((i.getAmount() >= 45) && (i.getAmount() < 54))
- {
- i.setAmount(i.getAmount() - 45);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.GOLD_BLOCK, 5) });
- }
- if ((i.getAmount() >= 54) && (i.getAmount() < 63))
- {
- i.setAmount(i.getAmount() - 54);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.GOLD_BLOCK, 6) });
- }
- if ((i.getAmount() >= 63) && (i.getAmount() < 64))
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.GOLD_BLOCK, 7) });
- }
- if (i.getAmount() == 64)
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.GOLD_BLOCK, 7) });
- }
- }
- if (i.getType().equals(Material.COAL))
- {
- if ((i.getAmount() >= 9) && (i.getAmount() < 18))
- {
- i.setAmount(i.getAmount() - 9);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.COAL_BLOCK, 1) });
- }
- if ((i.getAmount() >= 18) && (i.getAmount() < 27))
- {
- i.setAmount(i.getAmount() - 18);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.COAL_BLOCK, 2) });
- }
- if ((i.getAmount() >= 27) && (i.getAmount() < 36))
- {
- i.setAmount(i.getAmount() - 27);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.COAL_BLOCK, 3) });
- }
- if ((i.getAmount() >= 36) && (i.getAmount() < 45))
- {
- i.setAmount(i.getAmount() - 36);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.COAL_BLOCK, 4) });
- }
- if ((i.getAmount() >= 45) && (i.getAmount() < 54))
- {
- i.setAmount(i.getAmount() - 45);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.COAL_BLOCK, 5) });
- }
- if ((i.getAmount() >= 54) && (i.getAmount() < 63))
- {
- i.setAmount(i.getAmount() - 54);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.COAL_BLOCK, 6) });
- }
- if ((i.getAmount() >= 63) && (i.getAmount() < 64))
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.COAL_BLOCK, 7) });
- }
- if (i.getAmount() == 64)
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.COAL_BLOCK, 7) });
- }
- }
- if (i.getType().equals(Material.EMERALD))
- {
- if ((i.getAmount() >= 9) && (i.getAmount() < 18))
- {
- i.setAmount(i.getAmount() - 9);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.EMERALD_BLOCK, 1) });
- }
- if ((i.getAmount() >= 18) && (i.getAmount() < 27))
- {
- i.setAmount(i.getAmount() - 18);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.EMERALD_BLOCK, 2) });
- }
- if ((i.getAmount() >= 27) && (i.getAmount() < 36))
- {
- i.setAmount(i.getAmount() - 27);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.EMERALD_BLOCK, 3) });
- }
- if ((i.getAmount() >= 36) && (i.getAmount() < 45))
- {
- i.setAmount(i.getAmount() - 36);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.EMERALD_BLOCK, 4) });
- }
- if ((i.getAmount() >= 45) && (i.getAmount() < 54))
- {
- i.setAmount(i.getAmount() - 45);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.EMERALD_BLOCK, 5) });
- }
- if ((i.getAmount() >= 54) && (i.getAmount() < 63))
- {
- i.setAmount(i.getAmount() - 54);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.EMERALD_BLOCK, 6) });
- }
- if ((i.getAmount() >= 63) && (i.getAmount() < 64))
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.EMERALD_BLOCK, 7) });
- }
- if (i.getAmount() == 64)
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.EMERALD_BLOCK, 7) });
- }
- }
- if (i.getType().equals(Material.REDSTONE))
- {
- if ((i.getAmount() >= 9) && (i.getAmount() < 18))
- {
- i.setAmount(i.getAmount() - 9);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.REDSTONE_BLOCK, 1) });
- }
- if ((i.getAmount() >= 18) && (i.getAmount() < 27))
- {
- i.setAmount(i.getAmount() - 18);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.REDSTONE_BLOCK, 2) });
- }
- if ((i.getAmount() >= 27) && (i.getAmount() < 36))
- {
- i.setAmount(i.getAmount() - 27);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.REDSTONE_BLOCK, 3) });
- }
- if ((i.getAmount() >= 36) && (i.getAmount() < 45))
- {
- i.setAmount(i.getAmount() - 36);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.REDSTONE_BLOCK, 4) });
- }
- if ((i.getAmount() >= 45) && (i.getAmount() < 54))
- {
- i.setAmount(i.getAmount() - 45);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.REDSTONE_BLOCK, 5) });
- }
- if ((i.getAmount() >= 54) && (i.getAmount() < 63))
- {
- i.setAmount(i.getAmount() - 54);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.REDSTONE_BLOCK, 6) });
- }
- if ((i.getAmount() >= 63) && (i.getAmount() < 64))
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.REDSTONE_BLOCK, 7) });
- }
- if (i.getAmount() == 64)
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.REDSTONE_BLOCK, 7) });
- }
- }
- if (i.equals(new ItemStack(Material.INK_SACK, i.getAmount(), (short)4)))
- {
- if ((i.getAmount() >= 9) && (i.getAmount() < 18))
- {
- i.setAmount(i.getAmount() - 9);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.LAPIS_BLOCK, 1) });
- }
- if ((i.getAmount() >= 18) && (i.getAmount() < 27))
- {
- i.setAmount(i.getAmount() - 18);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.LAPIS_BLOCK, 2) });
- }
- if ((i.getAmount() >= 27) && (i.getAmount() < 36))
- {
- i.setAmount(i.getAmount() - 27);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.LAPIS_BLOCK, 3) });
- }
- if ((i.getAmount() >= 36) && (i.getAmount() < 45))
- {
- i.setAmount(i.getAmount() - 36);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.LAPIS_BLOCK, 4) });
- }
- if ((i.getAmount() >= 45) && (i.getAmount() < 54))
- {
- i.setAmount(i.getAmount() - 45);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.LAPIS_BLOCK, 5) });
- }
- if ((i.getAmount() >= 54) && (i.getAmount() < 63))
- {
- i.setAmount(i.getAmount() - 54);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.LAPIS_BLOCK, 6) });
- }
- if ((i.getAmount() >= 63) && (i.getAmount() < 64))
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.LAPIS_BLOCK, 7) });
- }
- if (i.getAmount() == 64)
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.LAPIS_BLOCK, 7) });
- }
- }
- if (i.getType().equals(Material.QUARTZ))
- {
- if ((i.getAmount() >= 9) && (i.getAmount() < 18))
- {
- i.setAmount(i.getAmount() - 9);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.QUARTZ_BLOCK, 1) });
- }
- if ((i.getAmount() >= 18) && (i.getAmount() < 27))
- {
- i.setAmount(i.getAmount() - 18);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.QUARTZ_BLOCK, 2) });
- }
- if ((i.getAmount() >= 27) && (i.getAmount() < 36))
- {
- i.setAmount(i.getAmount() - 27);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.QUARTZ_BLOCK, 3) });
- }
- if ((i.getAmount() >= 36) && (i.getAmount() < 45))
- {
- i.setAmount(i.getAmount() - 36);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.QUARTZ_BLOCK, 4) });
- }
- if ((i.getAmount() >= 45) && (i.getAmount() < 54))
- {
- i.setAmount(i.getAmount() - 45);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.QUARTZ_BLOCK, 5) });
- }
- if ((i.getAmount() >= 54) && (i.getAmount() < 63))
- {
- i.setAmount(i.getAmount() - 54);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.QUARTZ_BLOCK, 6) });
- }
- if ((i.getAmount() >= 63) && (i.getAmount() < 64))
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.QUARTZ_BLOCK, 7) });
- }
- if (i.getAmount() == 64)
- {
- i.setAmount(i.getAmount() - 63);
- p.getInventory().addItem(new ItemStack[] {
- new ItemStack(Material.QUARTZ_BLOCK, 7) });
- }
- }
- }
- }
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement