Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. private static FileConfiguration config = CorePlus.pl.getConfig();
  2. private static Inventory i = Bukkit.createInventory(null, 9 , ChatColor.LIGHT_PURPLE + "Ender Well");
  3.  
  4. public static void openEnderWell(Player p){
  5. if(!DustAPI.hasDust(p)){
  6. return;
  7. }
  8.  
  9. if(DustMySQL.getDust(p.getUniqueId()) < 250){
  10. p.sendMessage(StringUtil.format(config.getString("notenoughdust")));
  11. return;
  12. }
  13.  
  14. new BukkitRunnable(){
  15.  
  16. int d = 0;
  17.  
  18. @Override
  19. public void run() {
  20. d++;
  21.  
  22. if(d == 2){
  23. p.openInventory(i);
  24. }
  25.  
  26. if(d == 20){
  27. int[] mat = new int[3];
  28. mat[0] = Material.getMaterial(mat[381]).getId();
  29. mat[1] = Material.getMaterial(mat[388]).getId();
  30. mat[2] = Material.getMaterial(mat[133]).getId();
  31. int chooser = (int) (Math.random() * 3);
  32. i.setItem(0, new ItemStack(Material.getMaterial(mat[chooser])));
  33. i.setItem(1, new ItemStack(Material.getMaterial(mat[chooser])));
  34. i.setItem(2, new ItemStack(Material.getMaterial(mat[chooser])));
  35. if(i.contains(new ItemStack(Material.EYE_OF_ENDER))){
  36. p.sendMessage(ChatColor.LIGHT_PURPLE + "You have won 150 ender dust");
  37. DustAPI.updateDust(p, DustMySQL.getDust(p.getUniqueId()) + 250);
  38. }
  39.  
  40. if(i.contains(new ItemStack(Material.EMERALD))){
  41. p.sendMessage(ChatColor.GREEN + "You have won 100 gems");
  42. GemsAPI.updateGems(p, GemsMySQL.getGems(p.getUniqueId()) + 100);
  43. }
  44.  
  45. if(i.contains(new ItemStack(Material.EMERALD_BLOCK))){
  46. p.sendMessage(ChatColor.GREEN + "You have won 250 gems");
  47. GemsAPI.updateGems(p, GemsMySQL.getGems(p.getUniqueId()) + 250);
  48. }
  49.  
  50. if(d == 45){
  51. p.closeInventory();
  52. this.cancel();
  53. }
  54.  
  55. }
  56. }
  57. }.runTaskTimer(CorePlus.pl, 0, 0);
  58. }
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement