Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.42 KB | None | 0 0
  1. package me.Funergy.main;
  2.  
  3. import java.util.logging.Logger;
  4. import org.bukkit.Bukkit;
  5. import org.bukkit.Material;
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.inventory.ItemStack;
  10. import org.bukkit.inventory.PlayerInventory;
  11. import org.bukkit.plugin.java.JavaPlugin;
  12.  
  13. public class main
  14. extends JavaPlugin
  15. {
  16. public void onEnable()
  17. {
  18. Bukkit.getLogger().info("OreToBlock Has been enabled!");
  19. }
  20.  
  21. public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
  22. {
  23. if (command.getName().equalsIgnoreCase("block"))
  24. {
  25. Player p = (Player)sender;
  26. if (p.hasPermission("blocktoores.use")) {
  27. for (ItemStack i : p.getInventory().getContents()) {
  28. if (i != null)
  29. {
  30. if (i.getType().equals(Material.IRON_INGOT))
  31. {
  32. if ((i.getAmount() >= 9) && (i.getAmount() < 18))
  33. {
  34. i.setAmount(i.getAmount() - 9);
  35. p.getInventory().addItem(new ItemStack[] {
  36. new ItemStack(Material.IRON_BLOCK, 1) });
  37. }
  38. if ((i.getAmount() >= 18) && (i.getAmount() < 27))
  39. {
  40. i.setAmount(i.getAmount() - 18);
  41. p.getInventory().addItem(new ItemStack[] {
  42. new ItemStack(Material.IRON_BLOCK, 2) });
  43. }
  44. if ((i.getAmount() >= 27) && (i.getAmount() < 36))
  45. {
  46. i.setAmount(i.getAmount() - 27);
  47. p.getInventory().addItem(new ItemStack[] {
  48. new ItemStack(Material.IRON_BLOCK, 3) });
  49. }
  50. if ((i.getAmount() >= 36) && (i.getAmount() < 45))
  51. {
  52. i.setAmount(i.getAmount() - 36);
  53. p.getInventory().addItem(new ItemStack[] {
  54. new ItemStack(Material.IRON_BLOCK, 4) });
  55. }
  56. if ((i.getAmount() >= 45) && (i.getAmount() < 54))
  57. {
  58. i.setAmount(i.getAmount() - 45);
  59. p.getInventory().addItem(new ItemStack[] {
  60. new ItemStack(Material.IRON_BLOCK, 5) });
  61. }
  62. if ((i.getAmount() >= 54) && (i.getAmount() < 63))
  63. {
  64. i.setAmount(i.getAmount() - 54);
  65. p.getInventory().addItem(new ItemStack[] {
  66. new ItemStack(Material.IRON_BLOCK, 6) });
  67. }
  68. if ((i.getAmount() >= 63) && (i.getAmount() < 64))
  69. {
  70. i.setAmount(i.getAmount() - 63);
  71. p.getInventory().addItem(new ItemStack[] {
  72. new ItemStack(Material.IRON_BLOCK, 7) });
  73. }
  74. if (i.getAmount() == 64)
  75. {
  76. i.setAmount(i.getAmount() - 63);
  77. p.getInventory().addItem(new ItemStack[] {
  78. new ItemStack(Material.IRON_BLOCK, 7) });
  79. }
  80. }
  81. if (i.getType().equals(Material.DIAMOND))
  82. {
  83. if ((i.getAmount() >= 9) && (i.getAmount() < 18))
  84. {
  85. i.setAmount(i.getAmount() - 9);
  86. p.getInventory().addItem(new ItemStack[] {
  87. new ItemStack(Material.DIAMOND_BLOCK, 1) });
  88. }
  89. if ((i.getAmount() >= 18) && (i.getAmount() < 27))
  90. {
  91. i.setAmount(i.getAmount() - 18);
  92. p.getInventory().addItem(new ItemStack[] {
  93. new ItemStack(Material.DIAMOND_BLOCK, 2) });
  94. }
  95. if ((i.getAmount() >= 27) && (i.getAmount() < 36))
  96. {
  97. i.setAmount(i.getAmount() - 27);
  98. p.getInventory().addItem(new ItemStack[] {
  99. new ItemStack(Material.DIAMOND_BLOCK, 3) });
  100. }
  101. if ((i.getAmount() >= 36) && (i.getAmount() < 45))
  102. {
  103. i.setAmount(i.getAmount() - 36);
  104. p.getInventory().addItem(new ItemStack[] {
  105. new ItemStack(Material.DIAMOND_BLOCK, 4) });
  106. }
  107. if ((i.getAmount() >= 45) && (i.getAmount() < 54))
  108. {
  109. i.setAmount(i.getAmount() - 45);
  110. p.getInventory().addItem(new ItemStack[] {
  111. new ItemStack(Material.DIAMOND_BLOCK, 5) });
  112. }
  113. if ((i.getAmount() >= 54) && (i.getAmount() < 63))
  114. {
  115. i.setAmount(i.getAmount() - 54);
  116. p.getInventory().addItem(new ItemStack[] {
  117. new ItemStack(Material.DIAMOND_BLOCK, 6) });
  118. }
  119. if ((i.getAmount() >= 63) && (i.getAmount() < 64))
  120. {
  121. i.setAmount(i.getAmount() - 63);
  122. p.getInventory().addItem(new ItemStack[] {
  123. new ItemStack(Material.DIAMOND_BLOCK, 7) });
  124. }
  125. if (i.getAmount() == 64)
  126. {
  127. i.setAmount(i.getAmount() - 63);
  128. p.getInventory().addItem(new ItemStack[] {
  129. new ItemStack(Material.DIAMOND_BLOCK, 7) });
  130. }
  131. }
  132. if (i.getType().equals(Material.GOLD_INGOT))
  133. {
  134. if ((i.getAmount() >= 9) && (i.getAmount() < 18))
  135. {
  136. i.setAmount(i.getAmount() - 9);
  137. p.getInventory().addItem(new ItemStack[] {
  138. new ItemStack(Material.GOLD_BLOCK, 1) });
  139. }
  140. if ((i.getAmount() >= 18) && (i.getAmount() < 27))
  141. {
  142. i.setAmount(i.getAmount() - 18);
  143. p.getInventory().addItem(new ItemStack[] {
  144. new ItemStack(Material.GOLD_BLOCK, 2) });
  145. }
  146. if ((i.getAmount() >= 27) && (i.getAmount() < 36))
  147. {
  148. i.setAmount(i.getAmount() - 27);
  149. p.getInventory().addItem(new ItemStack[] {
  150. new ItemStack(Material.GOLD_BLOCK, 3) });
  151. }
  152. if ((i.getAmount() >= 36) && (i.getAmount() < 45))
  153. {
  154. i.setAmount(i.getAmount() - 36);
  155. p.getInventory().addItem(new ItemStack[] {
  156. new ItemStack(Material.GOLD_BLOCK, 4) });
  157. }
  158. if ((i.getAmount() >= 45) && (i.getAmount() < 54))
  159. {
  160. i.setAmount(i.getAmount() - 45);
  161. p.getInventory().addItem(new ItemStack[] {
  162. new ItemStack(Material.GOLD_BLOCK, 5) });
  163. }
  164. if ((i.getAmount() >= 54) && (i.getAmount() < 63))
  165. {
  166. i.setAmount(i.getAmount() - 54);
  167. p.getInventory().addItem(new ItemStack[] {
  168. new ItemStack(Material.GOLD_BLOCK, 6) });
  169. }
  170. if ((i.getAmount() >= 63) && (i.getAmount() < 64))
  171. {
  172. i.setAmount(i.getAmount() - 63);
  173. p.getInventory().addItem(new ItemStack[] {
  174. new ItemStack(Material.GOLD_BLOCK, 7) });
  175. }
  176. if (i.getAmount() == 64)
  177. {
  178. i.setAmount(i.getAmount() - 63);
  179. p.getInventory().addItem(new ItemStack[] {
  180. new ItemStack(Material.GOLD_BLOCK, 7) });
  181. }
  182. }
  183. if (i.getType().equals(Material.COAL))
  184. {
  185. if ((i.getAmount() >= 9) && (i.getAmount() < 18))
  186. {
  187. i.setAmount(i.getAmount() - 9);
  188. p.getInventory().addItem(new ItemStack[] {
  189. new ItemStack(Material.COAL_BLOCK, 1) });
  190. }
  191. if ((i.getAmount() >= 18) && (i.getAmount() < 27))
  192. {
  193. i.setAmount(i.getAmount() - 18);
  194. p.getInventory().addItem(new ItemStack[] {
  195. new ItemStack(Material.COAL_BLOCK, 2) });
  196. }
  197. if ((i.getAmount() >= 27) && (i.getAmount() < 36))
  198. {
  199. i.setAmount(i.getAmount() - 27);
  200. p.getInventory().addItem(new ItemStack[] {
  201. new ItemStack(Material.COAL_BLOCK, 3) });
  202. }
  203. if ((i.getAmount() >= 36) && (i.getAmount() < 45))
  204. {
  205. i.setAmount(i.getAmount() - 36);
  206. p.getInventory().addItem(new ItemStack[] {
  207. new ItemStack(Material.COAL_BLOCK, 4) });
  208. }
  209. if ((i.getAmount() >= 45) && (i.getAmount() < 54))
  210. {
  211. i.setAmount(i.getAmount() - 45);
  212. p.getInventory().addItem(new ItemStack[] {
  213. new ItemStack(Material.COAL_BLOCK, 5) });
  214. }
  215. if ((i.getAmount() >= 54) && (i.getAmount() < 63))
  216. {
  217. i.setAmount(i.getAmount() - 54);
  218. p.getInventory().addItem(new ItemStack[] {
  219. new ItemStack(Material.COAL_BLOCK, 6) });
  220. }
  221. if ((i.getAmount() >= 63) && (i.getAmount() < 64))
  222. {
  223. i.setAmount(i.getAmount() - 63);
  224. p.getInventory().addItem(new ItemStack[] {
  225. new ItemStack(Material.COAL_BLOCK, 7) });
  226. }
  227. if (i.getAmount() == 64)
  228. {
  229. i.setAmount(i.getAmount() - 63);
  230. p.getInventory().addItem(new ItemStack[] {
  231. new ItemStack(Material.COAL_BLOCK, 7) });
  232. }
  233. }
  234. if (i.getType().equals(Material.EMERALD))
  235. {
  236. if ((i.getAmount() >= 9) && (i.getAmount() < 18))
  237. {
  238. i.setAmount(i.getAmount() - 9);
  239. p.getInventory().addItem(new ItemStack[] {
  240. new ItemStack(Material.EMERALD_BLOCK, 1) });
  241. }
  242. if ((i.getAmount() >= 18) && (i.getAmount() < 27))
  243. {
  244. i.setAmount(i.getAmount() - 18);
  245. p.getInventory().addItem(new ItemStack[] {
  246. new ItemStack(Material.EMERALD_BLOCK, 2) });
  247. }
  248. if ((i.getAmount() >= 27) && (i.getAmount() < 36))
  249. {
  250. i.setAmount(i.getAmount() - 27);
  251. p.getInventory().addItem(new ItemStack[] {
  252. new ItemStack(Material.EMERALD_BLOCK, 3) });
  253. }
  254. if ((i.getAmount() >= 36) && (i.getAmount() < 45))
  255. {
  256. i.setAmount(i.getAmount() - 36);
  257. p.getInventory().addItem(new ItemStack[] {
  258. new ItemStack(Material.EMERALD_BLOCK, 4) });
  259. }
  260. if ((i.getAmount() >= 45) && (i.getAmount() < 54))
  261. {
  262. i.setAmount(i.getAmount() - 45);
  263. p.getInventory().addItem(new ItemStack[] {
  264. new ItemStack(Material.EMERALD_BLOCK, 5) });
  265. }
  266. if ((i.getAmount() >= 54) && (i.getAmount() < 63))
  267. {
  268. i.setAmount(i.getAmount() - 54);
  269. p.getInventory().addItem(new ItemStack[] {
  270. new ItemStack(Material.EMERALD_BLOCK, 6) });
  271. }
  272. if ((i.getAmount() >= 63) && (i.getAmount() < 64))
  273. {
  274. i.setAmount(i.getAmount() - 63);
  275. p.getInventory().addItem(new ItemStack[] {
  276. new ItemStack(Material.EMERALD_BLOCK, 7) });
  277. }
  278. if (i.getAmount() == 64)
  279. {
  280. i.setAmount(i.getAmount() - 63);
  281. p.getInventory().addItem(new ItemStack[] {
  282. new ItemStack(Material.EMERALD_BLOCK, 7) });
  283. }
  284. }
  285. if (i.getType().equals(Material.REDSTONE))
  286. {
  287. if ((i.getAmount() >= 9) && (i.getAmount() < 18))
  288. {
  289. i.setAmount(i.getAmount() - 9);
  290. p.getInventory().addItem(new ItemStack[] {
  291. new ItemStack(Material.REDSTONE_BLOCK, 1) });
  292. }
  293. if ((i.getAmount() >= 18) && (i.getAmount() < 27))
  294. {
  295. i.setAmount(i.getAmount() - 18);
  296. p.getInventory().addItem(new ItemStack[] {
  297. new ItemStack(Material.REDSTONE_BLOCK, 2) });
  298. }
  299. if ((i.getAmount() >= 27) && (i.getAmount() < 36))
  300. {
  301. i.setAmount(i.getAmount() - 27);
  302. p.getInventory().addItem(new ItemStack[] {
  303. new ItemStack(Material.REDSTONE_BLOCK, 3) });
  304. }
  305. if ((i.getAmount() >= 36) && (i.getAmount() < 45))
  306. {
  307. i.setAmount(i.getAmount() - 36);
  308. p.getInventory().addItem(new ItemStack[] {
  309. new ItemStack(Material.REDSTONE_BLOCK, 4) });
  310. }
  311. if ((i.getAmount() >= 45) && (i.getAmount() < 54))
  312. {
  313. i.setAmount(i.getAmount() - 45);
  314. p.getInventory().addItem(new ItemStack[] {
  315. new ItemStack(Material.REDSTONE_BLOCK, 5) });
  316. }
  317. if ((i.getAmount() >= 54) && (i.getAmount() < 63))
  318. {
  319. i.setAmount(i.getAmount() - 54);
  320. p.getInventory().addItem(new ItemStack[] {
  321. new ItemStack(Material.REDSTONE_BLOCK, 6) });
  322. }
  323. if ((i.getAmount() >= 63) && (i.getAmount() < 64))
  324. {
  325. i.setAmount(i.getAmount() - 63);
  326. p.getInventory().addItem(new ItemStack[] {
  327. new ItemStack(Material.REDSTONE_BLOCK, 7) });
  328. }
  329. if (i.getAmount() == 64)
  330. {
  331. i.setAmount(i.getAmount() - 63);
  332. p.getInventory().addItem(new ItemStack[] {
  333. new ItemStack(Material.REDSTONE_BLOCK, 7) });
  334. }
  335. }
  336. if (i.equals(new ItemStack(Material.INK_SACK, i.getAmount(), (short)4)))
  337. {
  338. if ((i.getAmount() >= 9) && (i.getAmount() < 18))
  339. {
  340. i.setAmount(i.getAmount() - 9);
  341. p.getInventory().addItem(new ItemStack[] {
  342. new ItemStack(Material.LAPIS_BLOCK, 1) });
  343. }
  344. if ((i.getAmount() >= 18) && (i.getAmount() < 27))
  345. {
  346. i.setAmount(i.getAmount() - 18);
  347. p.getInventory().addItem(new ItemStack[] {
  348. new ItemStack(Material.LAPIS_BLOCK, 2) });
  349. }
  350. if ((i.getAmount() >= 27) && (i.getAmount() < 36))
  351. {
  352. i.setAmount(i.getAmount() - 27);
  353. p.getInventory().addItem(new ItemStack[] {
  354. new ItemStack(Material.LAPIS_BLOCK, 3) });
  355. }
  356. if ((i.getAmount() >= 36) && (i.getAmount() < 45))
  357. {
  358. i.setAmount(i.getAmount() - 36);
  359. p.getInventory().addItem(new ItemStack[] {
  360. new ItemStack(Material.LAPIS_BLOCK, 4) });
  361. }
  362. if ((i.getAmount() >= 45) && (i.getAmount() < 54))
  363. {
  364. i.setAmount(i.getAmount() - 45);
  365. p.getInventory().addItem(new ItemStack[] {
  366. new ItemStack(Material.LAPIS_BLOCK, 5) });
  367. }
  368. if ((i.getAmount() >= 54) && (i.getAmount() < 63))
  369. {
  370. i.setAmount(i.getAmount() - 54);
  371. p.getInventory().addItem(new ItemStack[] {
  372. new ItemStack(Material.LAPIS_BLOCK, 6) });
  373. }
  374. if ((i.getAmount() >= 63) && (i.getAmount() < 64))
  375. {
  376. i.setAmount(i.getAmount() - 63);
  377. p.getInventory().addItem(new ItemStack[] {
  378. new ItemStack(Material.LAPIS_BLOCK, 7) });
  379. }
  380. if (i.getAmount() == 64)
  381. {
  382. i.setAmount(i.getAmount() - 63);
  383. p.getInventory().addItem(new ItemStack[] {
  384. new ItemStack(Material.LAPIS_BLOCK, 7) });
  385. }
  386. }
  387. if (i.getType().equals(Material.QUARTZ))
  388. {
  389. if ((i.getAmount() >= 9) && (i.getAmount() < 18))
  390. {
  391. i.setAmount(i.getAmount() - 9);
  392. p.getInventory().addItem(new ItemStack[] {
  393. new ItemStack(Material.QUARTZ_BLOCK, 1) });
  394. }
  395. if ((i.getAmount() >= 18) && (i.getAmount() < 27))
  396. {
  397. i.setAmount(i.getAmount() - 18);
  398. p.getInventory().addItem(new ItemStack[] {
  399. new ItemStack(Material.QUARTZ_BLOCK, 2) });
  400. }
  401. if ((i.getAmount() >= 27) && (i.getAmount() < 36))
  402. {
  403. i.setAmount(i.getAmount() - 27);
  404. p.getInventory().addItem(new ItemStack[] {
  405. new ItemStack(Material.QUARTZ_BLOCK, 3) });
  406. }
  407. if ((i.getAmount() >= 36) && (i.getAmount() < 45))
  408. {
  409. i.setAmount(i.getAmount() - 36);
  410. p.getInventory().addItem(new ItemStack[] {
  411. new ItemStack(Material.QUARTZ_BLOCK, 4) });
  412. }
  413. if ((i.getAmount() >= 45) && (i.getAmount() < 54))
  414. {
  415. i.setAmount(i.getAmount() - 45);
  416. p.getInventory().addItem(new ItemStack[] {
  417. new ItemStack(Material.QUARTZ_BLOCK, 5) });
  418. }
  419. if ((i.getAmount() >= 54) && (i.getAmount() < 63))
  420. {
  421. i.setAmount(i.getAmount() - 54);
  422. p.getInventory().addItem(new ItemStack[] {
  423. new ItemStack(Material.QUARTZ_BLOCK, 6) });
  424. }
  425. if ((i.getAmount() >= 63) && (i.getAmount() < 64))
  426. {
  427. i.setAmount(i.getAmount() - 63);
  428. p.getInventory().addItem(new ItemStack[] {
  429. new ItemStack(Material.QUARTZ_BLOCK, 7) });
  430. }
  431. if (i.getAmount() == 64)
  432. {
  433. i.setAmount(i.getAmount() - 63);
  434. p.getInventory().addItem(new ItemStack[] {
  435. new ItemStack(Material.QUARTZ_BLOCK, 7) });
  436. }
  437. }
  438. }
  439. }
  440. }
  441. }
  442. return false;
  443. }
  444. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement