Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void blockMode(Player player) {
- List<Drop> dropList = new ArrayList<>();
- for (Drop drop : DropConfig.getConfig().getDrops()) for (int chance = 0; chance < drop.getChance(); chance++) dropList.add(drop);
- Collections.shuffle(dropList);
- titleHologram.clearLines();
- new BukkitRunnable() {
- int ticks = 0;
- boolean isOpened = false;
- @Override
- public void run() {
- ticks++;
- if (!isOpened) {
- double radius = 5 / (double) ticks * 20;
- Bukkit.broadcastMessage(String.valueOf(radius));
- if (ticks % 4 == 0) location.getWorld().playSound(location, Sound.BLOCK_NOTE_GUITAR, 1, (float) radius);
- double increment = (2 * Math.PI) / 25;
- for (int i = 0; i < 25; i++) {
- double angle = i * increment;
- double x = radius * Math.cos(angle);
- double z = radius * Math.sin(angle);
- Utils.playEffect(location.clone().add(x + 0.5D, 0.5D, z + 0.5D), false, false, 0, 0, 0, 0, EnumWrappers.Particle.FLAME, Material.AIR, 1);
- }
- }
- if (ticks % (Config.ROLL_TIME.getInteger() * 20) == 0) {
- Drop drop = dropList.get(Utils.getRandom().nextInt(dropList.size()));
- for (Player players : Bukkit.getOnlinePlayers()) player.sendMessage(Utils.getPrefix() + Utils.stripColor(drop.getWinMessage().replace("%player%", player.getName())));
- titleHologram.appendTextLine(Utils.stripColor(drop.getDisplayItem().getItemMeta().getDisplayName())).getParent().appendItemLine(drop.getDisplayItem());
- location.getWorld().playSound(location, Sound.ENTITY_GENERIC_EXPLODE, 1, 1.5f);
- isOpened = true;
- return;
- }
- if (ticks % ((Config.ROLL_TIME.getInteger() * 20) + 100) != 0) return;
- isUsed = false;
- titleHologram.clearLines();
- titleHologram = HologramsAPI.createHologram(Main.plugin, location.clone().add(0.5D, 2, 0.5D)).appendTextLine(Utils.stripColor(Config.MESSAGE_HOLO_CASE_NAME.getString())).getParent().appendTextLine(Utils.stripColor(Config.MESSAGE_HOLO_HELP.getString())).getParent();
- cancel();
- }
- }.runTaskTimer(Main.plugin, 1, 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement