Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.95 KB | None | 0 0
  1. package me.SirMonkeyFood.SMTreasureHunt;
  2.  
  3. import java.util.Random;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.ChatColor;
  7. import org.bukkit.Location;
  8. import org.bukkit.Material;
  9. import org.bukkit.block.Chest;
  10. import org.bukkit.command.Command;
  11. import org.bukkit.command.CommandSender;
  12. import org.bukkit.entity.Player;
  13. import org.bukkit.inventory.ItemStack;
  14. import org.bukkit.plugin.java.JavaPlugin;
  15.  
  16. public class TreasureHunt extends JavaPlugin{
  17. public static TreasureHunt plugin;
  18. public void onEnable(){
  19. getLogger().info("SMTreasureHunt Is Enabled!");
  20. plugin = this;
  21. }
  22. public void onDisable(){
  23. getLogger().info("SMTreasureHunt is Disabled");
  24. plugin = null;
  25. }
  26.  
  27. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
  28. if (cmd.getName().equalsIgnoreCase("THcreate")){
  29. if (sender.hasPermission("TreasureHunt.use")){
  30. Player admin = (Player)sender;
  31. Location loc = admin.getPlayer().getLocation();
  32. Location loc1 = admin.getPlayer().getLocation();
  33. loc1.setX(loc1.getX() -1);
  34. Location loc2 = admin.getPlayer().getLocation();
  35. loc2.setX(loc2.getX() +1);
  36. Location loc3 = admin.getPlayer().getLocation();
  37. loc3.setZ(loc3.getZ() -1);
  38. Location loc4 = admin.getPlayer().getLocation();
  39. loc4.setZ(loc4.getZ() +1);
  40. Location loc5 = admin.getPlayer().getLocation();
  41. loc5.setX(loc5.getX() -1);
  42. loc5.setZ(loc5.getZ() -1);
  43. Location loc6 = admin.getPlayer().getLocation();
  44. loc6.setX(loc6.getX() +1);
  45. loc6.setZ(loc6.getZ() -1);
  46. Location loc7 = admin.getPlayer().getLocation();
  47. loc7.setX(loc7.getX() - 1);
  48. loc7.setZ(loc7.getZ() + 1);
  49. Location loc8 = admin.getPlayer().getLocation();
  50. loc8.setX(loc8.getX() +1);
  51. loc8.setZ(loc8.getZ() +1);
  52. Location loc9 = admin.getPlayer().getLocation();
  53. loc9.setX(loc9.getX() +1);
  54. loc9.setY(loc9.getY() +1);
  55. Location loca = admin.getPlayer().getLocation();
  56. loca.setX(loca.getX() -1);
  57. loca.setY(loca.getY() +1);
  58. Location locb = admin.getPlayer().getLocation();
  59. locb.setZ(locb.getZ() +1);
  60. locb.setY(locb.getY() +1);
  61. Location locc = admin.getPlayer().getLocation();
  62. locc.setZ(locc.getZ() -1);
  63. locc.setY(locc.getY() +1);
  64. Location locd = admin.getPlayer().getLocation();
  65. locd.setY(locd.getY() +2);
  66. Location locchest = admin.getPlayer().getLocation();
  67. locchest.setY(locchest.getY() +3);
  68. Location locf = admin.getPlayer().getLocation();
  69. locf.setY(locf.getY() +4);
  70. Location locg = admin.getPlayer().getLocation();
  71. locg.setZ(locg.getZ() +2);
  72. locg.setY(locg.getY() -1);
  73. Location loch = admin.getPlayer().getLocation();
  74. loch.setZ(loch.getZ() -2);
  75. loch.setY(loch.getY() -1);
  76. Location loci = admin.getPlayer().getLocation();
  77. loci.setX(loci.getX() +2);
  78. loci.setY(loci.getY() -1);
  79. Location locj = admin.getPlayer().getLocation();
  80. locj.setX(locj.getX() -2);
  81. locj.setY(locj.getY() -1);
  82. Location lock = admin.getPlayer().getLocation();
  83. lock.setX(lock.getX() -2);
  84. lock.setZ(lock.getZ() -2);
  85. lock.setY(lock.getY() -1);
  86. Location locl = admin.getPlayer().getLocation();
  87. locl.setX(locl.getX() +2);
  88. locl.setZ(locl.getZ() -2);
  89. locl.setY(locl.getY() -1);
  90. Location locm = admin.getPlayer().getLocation();
  91. locm.setX(locm.getX() +2);
  92. locm.setZ(locm.getZ() +2);
  93. locm.setY(locm.getY() -1);
  94. Location locn = admin.getPlayer().getLocation();
  95. locn.setX(locn.getX() -2);
  96. locn.setZ(locn.getZ() +2);
  97. locn.setY(locn.getY() -1);
  98. Location loco = admin.getPlayer().getLocation();
  99. loco.setX(loco.getX() -1);
  100. loco.setZ(loco.getZ() +2);
  101. loco.setY(loco.getY() -1);
  102. Location locp = admin.getPlayer().getLocation();
  103. locp.setX(locp.getX() +1);
  104. locp.setZ(locp.getZ() +2);
  105. locp.setY(locp.getY() -1);
  106. Location locq = admin.getPlayer().getLocation();
  107. locq.setX(locq.getX() -1);
  108. locq.setZ(locq.getZ() -2);
  109. locq.setY(locq.getY() -1);
  110. Location locr = admin.getPlayer().getLocation();
  111. locr.setX(locr.getX() +1);
  112. locr.setZ(locr.getZ() -2);
  113. locr.setY(locr.getY() -1);
  114. Location locs = admin.getPlayer().getLocation();
  115. locs.setX(locs.getX() +2);
  116. locs.setZ(locs.getZ() -1);
  117. locs.setY(locs.getY() -1);
  118. Location loct = admin.getPlayer().getLocation();
  119. loct.setX(loct.getX() +2);
  120. loct.setZ(loct.getZ() +1);
  121. loct.setY(loct.getY() -1);
  122. Location locu = admin.getPlayer().getLocation();
  123. locu.setX(locu.getX() -2);
  124. locu.setZ(locu.getZ() -1);
  125. locu.setY(locu.getY() -1);
  126. Location locv = admin.getPlayer().getLocation();
  127. locv.setX(locv.getX() -2);
  128. locv.setZ(locv.getZ() +1);
  129. locv.setY(locv.getY() -1);
  130. Location locw = admin.getPlayer().getLocation();
  131. locw.setX(locw.getX() -2);
  132. locw.setZ(locw.getZ() -2);
  133. Location locx = admin.getPlayer().getLocation();
  134. locx.setX(locx.getX() +2);
  135. locx.setZ(locx.getZ() -2);
  136. Location locy = admin.getPlayer().getLocation();
  137. locy.setX(locy.getX() +2);
  138. locy.setZ(locy.getZ() +2);
  139. Location locz = admin.getPlayer().getLocation();
  140. locz.setX(locz.getX() -2);
  141. locz.setZ(locz.getZ() +2);
  142. Location loc0 = admin.getPlayer().getLocation();
  143. loc0.setY(loc0.getY() +5);
  144. loc1.getBlock().setType(Material.SMOOTH_BRICK);
  145. loc2.getBlock().setType(Material.SMOOTH_BRICK);
  146. loc3.getBlock().setType(Material.SMOOTH_BRICK);
  147. loc4.getBlock().setType(Material.SMOOTH_BRICK);
  148. loc5.getBlock().setType(Material.SMOOTH_BRICK);
  149. loc6.getBlock().setType(Material.SMOOTH_BRICK);
  150. loc7.getBlock().setType(Material.SMOOTH_BRICK);
  151. loc8.getBlock().setType(Material.SMOOTH_BRICK);
  152. loc9.getBlock().setType(Material.SMOOTH_BRICK);
  153. loca.getBlock().setType(Material.SMOOTH_BRICK);
  154. locb.getBlock().setType(Material.SMOOTH_BRICK);
  155. locc.getBlock().setType(Material.SMOOTH_BRICK);
  156. locd.getBlock().setType(Material.SMOOTH_BRICK);
  157. locchest.getBlock().setType(Material.CHEST);
  158. locg.getBlock().setType(Material.NETHERRACK);
  159. loch.getBlock().setType(Material.NETHERRACK);
  160. loci.getBlock().setType(Material.NETHERRACK);
  161. locj.getBlock().setType(Material.NETHERRACK);
  162. lock.getBlock().setType(Material.NETHERRACK);
  163. locl.getBlock().setType(Material.NETHERRACK);
  164. locm.getBlock().setType(Material.NETHERRACK);
  165. locn.getBlock().setType(Material.NETHERRACK);
  166. loco.getBlock().setType(Material.NETHERRACK);
  167. locp.getBlock().setType(Material.NETHERRACK);
  168. locq.getBlock().setType(Material.NETHERRACK);
  169. locr.getBlock().setType(Material.NETHERRACK);
  170. locs.getBlock().setType(Material.NETHERRACK);
  171. loct.getBlock().setType(Material.NETHERRACK);
  172. locu.getBlock().setType(Material.NETHERRACK);
  173. locv.getBlock().setType(Material.NETHERRACK);
  174. locw.getBlock().setType(Material.FIRE);
  175. locx.getBlock().setType(Material.FIRE);
  176. locy.getBlock().setType(Material.FIRE);
  177. locz.getBlock().setType(Material.FIRE);
  178. loc.getBlock().setType(Material.ENDER_PORTAL_FRAME);
  179. admin.getWorld().strikeLightning(locw);
  180. admin.getWorld().strikeLightning(locx);
  181. admin.getWorld().strikeLightning(locy);
  182. admin.getWorld().strikeLightning(locz);
  183. admin.getWorld().strikeLightning(locw);
  184. admin.getWorld().strikeLightning(locx);
  185. admin.getWorld().strikeLightning(locy);
  186. admin.getWorld().strikeLightning(locz);
  187. admin.getWorld().strikeLightning(locw);
  188. admin.getWorld().strikeLightning(locx);
  189. admin.getWorld().strikeLightning(locy);
  190. admin.getWorld().strikeLightning(locz);
  191. admin.getWorld().strikeLightning(locw);
  192. admin.getWorld().strikeLightning(locx);
  193. admin.getWorld().strikeLightning(locy);
  194. admin.getWorld().strikeLightning(locz);
  195. admin.getWorld().strikeLightning(locw);
  196. admin.getWorld().strikeLightning(locx);
  197. admin.getWorld().strikeLightning(locy);
  198. admin.getWorld().strikeLightning(locz);
  199. admin.teleport(loc0);
  200. Random ChestLevel = new Random();
  201. int maxLength = 10;
  202. int level = ChestLevel.nextInt(maxLength);
  203. Random contents = new Random();
  204. int items = contents.nextInt(100);
  205. Random contents1 = new Random();
  206. int items1 = contents1.nextInt(100);if(level == 0){
  207.  
  208.  
  209. locf.getBlock().setType(Material.DIAMOND_BLOCK);
  210. }
  211. if(level == 1 || level == 2 || level == 3){
  212. locf.getBlock().setType(Material.GOLD_BLOCK);
  213. }
  214. if(level > 3 && level < maxLength){
  215. //FIRST ITEM
  216. Bukkit.broadcastMessage(ChatColor.GOLD + "[" + ChatColor.GREEN + "TreasureHunt" + ChatColor.GOLD + "]" + ChatColor.GRAY + " A" + ChatColor.YELLOW + " Common " + ChatColor.GRAY + "Treasure Chest Has Been Spawned!");
  217. locf.getBlock().setType(Material.IRON_BLOCK);
  218. if(items >= 0 && items <= 19){
  219. Random redstoneamount = new Random();
  220. int rsamount = redstoneamount.nextInt(5);
  221. Chest c = (Chest) locchest.getBlock().getState();
  222. c.getInventory().addItem(new ItemStack(Material.REDSTONE, rsamount + 1));
  223. } else {
  224. if(items >= 20 && items <= 59){
  225. Random breadamount = new Random();
  226. int bdamount = breadamount.nextInt(5);
  227. Chest c = (Chest) locchest.getBlock().getState();
  228. c.getInventory().addItem(new ItemStack(Material.BREAD, bdamount + 1));
  229. } else {
  230. if(items >= 60 && items <= 84){
  231. Random coalamount = new Random();
  232. int clamount = coalamount.nextInt(10);
  233. Chest c = (Chest) locchest.getBlock().getState();
  234. c.getInventory().addItem(new ItemStack(Material.COAL, clamount + 1));
  235. } else {
  236. if(items >= 85 && items <= 89){
  237. Random horseamount = new Random();
  238. int hramount = horseamount.nextInt(2);
  239. Chest c = (Chest) locchest.getBlock().getState();
  240. c.getInventory().addItem(new ItemStack(417, hramount + 1));
  241. } else {
  242. if(items >= 90 && items <= 99){
  243. Random goldamount = new Random();
  244. int gdamount = goldamount.nextInt(5);
  245. Chest c = (Chest) locchest.getBlock().getState();
  246. c.getInventory().addItem(new ItemStack(Material.BREAD, gdamount + 1));
  247. }}}}}
  248. //SECOND ITEM
  249. if(items1 >= 0 && items1 <= 19){
  250. Random redstoneamount = new Random();
  251. int rsamount = redstoneamount.nextInt(5);
  252. Chest c = (Chest) locchest.getBlock().getState();
  253. c.getInventory().addItem(new ItemStack(Material.REDSTONE, rsamount + 1));
  254. } else {
  255. if(items1 >= 20 && items1 <= 59){
  256. Random breadamount = new Random();
  257. int bdamount = breadamount.nextInt(5);
  258. Chest c = (Chest) locchest.getBlock().getState();
  259. c.getInventory().addItem(new ItemStack(Material.BREAD, bdamount + 1));
  260. } else {
  261. if(items1 >= 60 && items1 <= 84){
  262. Random coalamount = new Random();
  263. int clamount = coalamount.nextInt(10);
  264. Chest c = (Chest) locchest.getBlock().getState();
  265. c.getInventory().addItem(new ItemStack(Material.COAL, clamount + 1));
  266. } else {
  267. if(items1 >= 85 && items1 <= 89){
  268. Random horseamount = new Random();
  269. int hramount = horseamount.nextInt(2);
  270. Chest c = (Chest) locchest.getBlock().getState();
  271. c.getInventory().addItem(new ItemStack(417, hramount + 1));
  272. } else {
  273. if(items1 >= 90 && items1 <= 99){
  274. Random goldamount = new Random();
  275. int gdamount = goldamount.nextInt(5);
  276. Chest c = (Chest) locchest.getBlock().getState();
  277. c.getInventory().addItem(new ItemStack(Material.BREAD, gdamount + 1));
  278. }}}}}
  279. //THIRD ITEM
  280. Random contents2 = new Random();
  281. int items2 = contents2.nextInt(100);
  282. if(items2 >= 0 && items2 <= 19){
  283. Random redstoneamount = new Random();
  284. int rsamount = redstoneamount.nextInt(5);
  285. Chest c = (Chest) locchest.getBlock().getState();
  286. c.getInventory().addItem(new ItemStack(Material.REDSTONE, rsamount + 1));
  287. } else {
  288. if(items2 >= 20 && items2 <= 59){
  289. Random breadamount = new Random();
  290. int bdamount = breadamount.nextInt(5);
  291. Chest c = (Chest) locchest.getBlock().getState();
  292. c.getInventory().addItem(new ItemStack(Material.BREAD, bdamount + 1));
  293. } else {
  294. if(items2 >= 60 && items2 <= 84){
  295. Random coalamount = new Random();
  296. int clamount = coalamount.nextInt(10);
  297. Chest c = (Chest) locchest.getBlock().getState();
  298. c.getInventory().addItem(new ItemStack(Material.COAL, clamount + 1));
  299. } else {
  300. if(items2 >= 85 && items2 <= 89){
  301. Random horseamount = new Random();
  302. int hramount = horseamount.nextInt(2);
  303. Chest c = (Chest) locchest.getBlock().getState();
  304. c.getInventory().addItem(new ItemStack(417, hramount + 1));
  305. } else {
  306. if(items2 >= 90 && items2 <= 99){
  307. Random goldamount = new Random();
  308. int gdamount = goldamount.nextInt(5);
  309. Chest c = (Chest) locchest.getBlock().getState();
  310. c.getInventory().addItem(new ItemStack(Material.BREAD, gdamount + 1));
  311. }}}}}
  312. //FOURTH ITEM
  313. Random contents3 = new Random();
  314. int items3 = contents3.nextInt(100);
  315. if(items3 >= 0 && items3 <= 19){
  316. Random redstoneamount = new Random();
  317. int rsamount = redstoneamount.nextInt(5);
  318. Chest c = (Chest) locchest.getBlock().getState();
  319. c.getInventory().addItem(new ItemStack(Material.REDSTONE, rsamount + 1));
  320. } else {
  321. if(items3 >= 20 && items3 <= 59){
  322. Random breadamount = new Random();
  323. int bdamount = breadamount.nextInt(5);
  324. Chest c = (Chest) locchest.getBlock().getState();
  325. c.getInventory().addItem(new ItemStack(Material.BREAD, bdamount + 1));
  326. } else {
  327. if(items3 >= 60 && items3 <= 84){
  328. Random coalamount = new Random();
  329. int clamount = coalamount.nextInt(10);
  330. Chest c = (Chest) locchest.getBlock().getState();
  331. c.getInventory().addItem(new ItemStack(Material.COAL, clamount + 1));
  332. } else {
  333. if(items3 >= 85 && items3 <= 89){
  334. Random horseamount = new Random();
  335. int hramount = horseamount.nextInt(2);
  336. Chest c = (Chest) locchest.getBlock().getState();
  337. c.getInventory().addItem(new ItemStack(417, hramount + 1));
  338. } else {
  339. if(items3 >= 90 && items3 <= 99){
  340. Random goldamount = new Random();
  341. int gdamount = goldamount.nextInt(5);
  342. Chest c = (Chest) locchest.getBlock().getState();
  343. c.getInventory().addItem(new ItemStack(Material.BREAD, gdamount + 1));
  344. }}}}}
  345. //FIFTH ITEM
  346. Random contents4 = new Random();
  347. int items4 = contents4.nextInt(100);
  348. if(items4 >= 0 && items4 <= 19){
  349. Random redstoneamount = new Random();
  350. int rsamount = redstoneamount.nextInt(5);
  351. Chest c = (Chest) locchest.getBlock().getState();
  352. c.getInventory().addItem(new ItemStack(Material.REDSTONE, rsamount + 1));
  353. } else {
  354. if(items4 >= 20 && items4 <= 59){
  355. Random breadamount = new Random();
  356. int bdamount = breadamount.nextInt(5);
  357. Chest c = (Chest) locchest.getBlock().getState();
  358. c.getInventory().addItem(new ItemStack(Material.BREAD, bdamount + 1));
  359. } else {
  360. if(items4 >= 60 && items4 <= 84){
  361. Random coalamount = new Random();
  362. int clamount = coalamount.nextInt(10);
  363. Chest c = (Chest) locchest.getBlock().getState();
  364. c.getInventory().addItem(new ItemStack(Material.COAL, clamount + 1));
  365. } else {
  366. if(items4 >= 85 && items4 <= 89){
  367. Random horseamount = new Random();
  368. int hramount = horseamount.nextInt(2);
  369. Chest c = (Chest) locchest.getBlock().getState();
  370. c.getInventory().addItem(new ItemStack(417, hramount + 1));
  371. } else {
  372. if(items4 >= 90 && items4 <= 99){
  373. Random goldamount = new Random();
  374. int gdamount = goldamount.nextInt(5);
  375. Chest c = (Chest) locchest.getBlock().getState();
  376. c.getInventory().addItem(new ItemStack(Material.BREAD, gdamount + 1));
  377. }}}}}
  378. //SIXTH ITEM
  379. Random contents5 = new Random();
  380. int items5 = contents5.nextInt(100);
  381. if(items5 >= 0 && items5 <= 19){
  382. Random redstoneamount = new Random();
  383. int rsamount = redstoneamount.nextInt(5);
  384. Chest c = (Chest) locchest.getBlock().getState();
  385. c.getInventory().addItem(new ItemStack(Material.REDSTONE, rsamount + 1));
  386. } else {
  387. if(items5 >= 20 && items5 <= 59){
  388. Random breadamount = new Random();
  389. int bdamount = breadamount.nextInt(5);
  390. Chest c = (Chest) locchest.getBlock().getState();
  391. c.getInventory().addItem(new ItemStack(Material.BREAD, bdamount + 1));
  392. } else {
  393. if(items5 >= 60 && items5 <= 84){
  394. Random coalamount = new Random();
  395. int clamount = coalamount.nextInt(10);
  396. Chest c = (Chest) locchest.getBlock().getState();
  397. c.getInventory().addItem(new ItemStack(Material.COAL, clamount + 1));
  398. } else {
  399. if(items5 >= 85 && items5 <= 89){
  400. Random horseamount = new Random();
  401. int hramount = horseamount.nextInt(2);
  402. Chest c = (Chest) locchest.getBlock().getState();
  403. c.getInventory().addItem(new ItemStack(417, hramount + 1));
  404. } else {
  405. if(items5 >= 90 && items5 <= 99){
  406. Random goldamount = new Random();
  407. int gdamount = goldamount.nextInt(5);
  408. Chest c = (Chest) locchest.getBlock().getState();
  409. c.getInventory().addItem(new ItemStack(Material.BREAD, gdamount + 1));
  410. }}}}}
  411. //SEVENTH ITEM
  412. Random contents6 = new Random();
  413. int items6 = contents6.nextInt(100);
  414. if(items6 >= 0 && items6 <= 19){
  415. Random redstoneamount = new Random();
  416. int rsamount = redstoneamount.nextInt(5);
  417. Chest c = (Chest) locchest.getBlock().getState();
  418. c.getInventory().addItem(new ItemStack(Material.REDSTONE, rsamount + 1));
  419. } else {
  420. if(items6 >= 20 && items6 <= 59){
  421. Random breadamount = new Random();
  422. int bdamount = breadamount.nextInt(5);
  423. Chest c = (Chest) locchest.getBlock().getState();
  424. c.getInventory().addItem(new ItemStack(Material.BREAD, bdamount + 1));
  425. } else {
  426. if(items6 >= 60 && items6 <= 84){
  427. Random coalamount = new Random();
  428. int clamount = coalamount.nextInt(10);
  429. Chest c = (Chest) locchest.getBlock().getState();
  430. c.getInventory().addItem(new ItemStack(Material.COAL, clamount + 1));
  431. } else {
  432. if(items6 >= 85 && items6 <= 89){
  433. Random horseamount = new Random();
  434. int hramount = horseamount.nextInt(2);
  435. Chest c = (Chest) locchest.getBlock().getState();
  436. c.getInventory().addItem(new ItemStack(417, hramount + 1));
  437. } else {
  438. if(items6 >= 90 && items6 <= 99){
  439. Random goldamount = new Random();
  440. int gdamount = goldamount.nextInt(5);
  441. Chest c = (Chest) locchest.getBlock().getState();
  442. c.getInventory().addItem(new ItemStack(Material.BREAD, gdamount + 1));
  443. }}}}}
  444. //EIGTH ITEM
  445. Random contents7 = new Random();
  446. int items7 = contents7.nextInt(100);
  447. if(items7 >= 0 && items7 <= 19){
  448. Random redstoneamount = new Random();
  449. int rsamount = redstoneamount.nextInt(5);
  450. Chest c = (Chest) locchest.getBlock().getState();
  451. c.getInventory().addItem(new ItemStack(Material.REDSTONE, rsamount + 1));
  452. } else {
  453. if(items7 >= 20 && items7 <= 59){
  454. Random breadamount = new Random();
  455. int bdamount = breadamount.nextInt(5);
  456. Chest c = (Chest) locchest.getBlock().getState();
  457. c.getInventory().addItem(new ItemStack(Material.BREAD, bdamount + 1));
  458. } else {
  459. if(items7 >= 60 && items7 <= 84){
  460. Random coalamount = new Random();
  461. int clamount = coalamount.nextInt(10);
  462. Chest c = (Chest) locchest.getBlock().getState();
  463. c.getInventory().addItem(new ItemStack(Material.COAL, clamount + 1));
  464. } else {
  465. if(items7 >= 85 && items7 <= 89){
  466. Random horseamount = new Random();
  467. int hramount = horseamount.nextInt(2);
  468. Chest c = (Chest) locchest.getBlock().getState();
  469. c.getInventory().addItem(new ItemStack(417, hramount + 1));
  470. } else {
  471. if(items7 >= 90 && items7 <= 99){
  472. Random goldamount = new Random();
  473. int gdamount = goldamount.nextInt(5);
  474. Chest c = (Chest) locchest.getBlock().getState();
  475. c.getInventory().addItem(new ItemStack(Material.BREAD, gdamount + 1));
  476. }}}}}
  477. //NINTH ITEM
  478. Random contents8 = new Random();
  479. int items8 = contents8.nextInt(100);
  480. if(items8 >= 0 && items8 <= 19){
  481. Random redstoneamount = new Random();
  482. int rsamount = redstoneamount.nextInt(5);
  483. Chest c = (Chest) locchest.getBlock().getState();
  484. c.getInventory().addItem(new ItemStack(Material.REDSTONE, rsamount + 1));
  485. } else {
  486. if(items8 >= 20 && items8 <= 59){
  487. Random breadamount = new Random();
  488. int bdamount = breadamount.nextInt(5);
  489. Chest c = (Chest) locchest.getBlock().getState();
  490. c.getInventory().addItem(new ItemStack(Material.BREAD, bdamount + 1));
  491. } else {
  492. if(items8 >= 60 && items8 <= 84){
  493. Random coalamount = new Random();
  494. int clamount = coalamount.nextInt(10);
  495. Chest c = (Chest) locchest.getBlock().getState();
  496. c.getInventory().addItem(new ItemStack(Material.COAL, clamount + 1));
  497. } else {
  498. if(items8 >= 85 && items8 <= 89){
  499. Random horseamount = new Random();
  500. int hramount = horseamount.nextInt(2);
  501. Chest c = (Chest) locchest.getBlock().getState();
  502. c.getInventory().addItem(new ItemStack(417, hramount + 1));
  503. } else {
  504. if(items8 >= 90 && items8 <= 99){
  505. Random goldamount = new Random();
  506. int gdamount = goldamount.nextInt(5);
  507. Chest c = (Chest) locchest.getBlock().getState();
  508. c.getInventory().addItem(new ItemStack(Material.BREAD, gdamount + 1));
  509. }}}}}
  510. //TENTH ITEM
  511. Random contents9 = new Random();
  512. int items9 = contents9.nextInt(100);
  513. if(items9 >= 0 && items9 <= 19){
  514. Random redstoneamount = new Random();
  515. int rsamount = redstoneamount.nextInt(5);
  516. Chest c = (Chest) locchest.getBlock().getState();
  517. c.getInventory().addItem(new ItemStack(Material.REDSTONE, rsamount + 1));
  518. } else {
  519. if(items9 >= 20 && items9 <= 59){
  520. Random breadamount = new Random();
  521. int bdamount = breadamount.nextInt(5);
  522. Chest c = (Chest) locchest.getBlock().getState();
  523. c.getInventory().addItem(new ItemStack(Material.BREAD, bdamount + 1));
  524. } else {
  525. if(items9 >= 60 && items9 <= 84){
  526. Random coalamount = new Random();
  527. int clamount = coalamount.nextInt(10);
  528. Chest c = (Chest) locchest.getBlock().getState();
  529. c.getInventory().addItem(new ItemStack(Material.COAL, clamount + 1));
  530. } else {
  531. if(items9 >= 85 && items9 <= 89){
  532. Random horseamount = new Random();
  533. int hramount = horseamount.nextInt(2);
  534. Chest c = (Chest) locchest.getBlock().getState();
  535. c.getInventory().addItem(new ItemStack(417, hramount + 1));
  536. } else {
  537. if(items9 >= 90 && items9 <= 99){
  538. Random goldamount = new Random();
  539. int gdamount = goldamount.nextInt(5);
  540. Chest c = (Chest) locchest.getBlock().getState();
  541. c.getInventory().addItem(new ItemStack(Material.BREAD, gdamount + 1));
  542. }}}}}
  543. }
  544. }else {
  545. sender.sendMessage(ChatColor.DARK_RED + "You do not have permission to use that command!");
  546. }
  547. }
  548. return true;
  549.  
  550. }
  551. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement