Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static FileConfiguration config = CorePlus.pl.getConfig();
- private static Inventory i = Bukkit.createInventory(null, 9 , ChatColor.LIGHT_PURPLE + "Ender Well");
- public static void openEnderWell(Player p){
- if(!DustAPI.hasDust(p)){
- return;
- }
- if(DustMySQL.getDust(p.getUniqueId()) < 250){
- p.sendMessage(StringUtil.format(config.getString("notenoughdust")));
- return;
- }
- new BukkitRunnable(){
- int d = 0;
- @Override
- public void run() {
- d++;
- if(d == 2){
- p.openInventory(i);
- }
- if(d == 20){
- int[] mat = new int[3];
- mat[0] = Material.getMaterial(mat[381]).getId();
- mat[1] = Material.getMaterial(mat[388]).getId();
- mat[2] = Material.getMaterial(mat[133]).getId();
- int chooser = (int) (Math.random() * 3);
- i.setItem(0, new ItemStack(Material.getMaterial(mat[chooser])));
- i.setItem(1, new ItemStack(Material.getMaterial(mat[chooser])));
- i.setItem(2, new ItemStack(Material.getMaterial(mat[chooser])));
- if(i.contains(new ItemStack(Material.EYE_OF_ENDER))){
- p.sendMessage(ChatColor.LIGHT_PURPLE + "You have won 150 ender dust");
- DustAPI.updateDust(p, DustMySQL.getDust(p.getUniqueId()) + 250);
- }
- if(i.contains(new ItemStack(Material.EMERALD))){
- p.sendMessage(ChatColor.GREEN + "You have won 100 gems");
- GemsAPI.updateGems(p, GemsMySQL.getGems(p.getUniqueId()) + 100);
- }
- if(i.contains(new ItemStack(Material.EMERALD_BLOCK))){
- p.sendMessage(ChatColor.GREEN + "You have won 250 gems");
- GemsAPI.updateGems(p, GemsMySQL.getGems(p.getUniqueId()) + 250);
- }
- if(d == 45){
- p.closeInventory();
- this.cancel();
- }
- }
- }
- }.runTaskTimer(CorePlus.pl, 0, 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement