Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static List<Player> animation = new ArrayList<>();
- public static String candle = "http://textures.minecraft.net/texture/f79c7a2c7350b0f361502c0e06dab0fd2c0859e237df544d20cd3447b0c75fcf";
- public static String skull = "http://textures.minecraft.net/texture/660932b2c224b7c2163cbac05f286a06e6922527b03667c4e96f728e5c4ffb66";
- public static ItemStack getSkull(String url) {
- ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
- if (url == null || url.isEmpty()) return skull;
- SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
- GameProfile profile = new GameProfile(UUID.randomUUID(), null);
- byte[] encodedData = Base64.encodeBase64(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes());
- profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
- Field profileField = null;
- try {
- profileField = skullMeta.getClass().getDeclaredField("profile");
- }catch (NoSuchFieldException | SecurityException e) {
- e.printStackTrace();
- }
- profileField.setAccessible(true);
- try {
- profileField.set(skullMeta, profile);
- }catch (IllegalArgumentException | IllegalAccessException e) {
- e.printStackTrace();
- }
- skull.setItemMeta(skullMeta);
- return skull;
- }
- public static void iniciar(Player jogador) {
- World w = jogador.getLocation().getWorld();
- animation.add(jogador);
- w.strikeLightning(jogador.getLocation().clone().add(0, 0.5, 0));
- int points = 8;
- for (int i = 0; i < 360; i += 360/points) {
- double angle = (i * Math.PI / 180);
- double bx = 4 * Math.cos(angle);
- double bz = 4 * Math.sin(angle);
- double x = 0 * Math.cos(angle);
- double z = 0 * Math.sin(angle);
- Location bases = jogador.getLocation().clone().add(bx, 0, bz);
- Location candles = jogador.getLocation().clone().add(x, 0.8, z);
- ArmorStand as = (ArmorStand) w.spawnEntity(candles, EntityType.ARMOR_STAND);
- as.setMetadata("candle", new FixedMetadataValue(Main.plugin, new Object()));
- ParticleEffect.LAVA.display(as.getEyeLocation(), 0, 0, 0, 5, 0, 15);
- as.setCustomNameVisible(false);
- as.setGravity(false);
- as.setVisible(false);
- as.setHelmet(getSkull(candle));
- as.getWorld().playSound(as.getEyeLocation(), Sound.LAVA_POP, 6F, 5F);
- new BukkitRunnable() {
- public void run() {
- as.teleport(bases);
- }
- }.runTaskLaterAsynchronously(Main.plugin, 2 * 20L);
- }
- int fires = new BukkitRunnable() {
- public void run() {
- for (Entity entities : w.getEntities()) {
- if (entities instanceof ArmorStand) {
- ArmorStand candles = (ArmorStand) entities;
- Location l = candles.getEyeLocation();
- ParticleEffect.FLAME.display(l.add(0.0D, 0.4D, 0.0D), 15, 0, 0, 0, 0, 10);
- ParticleEffect.SMOKE_NORMAL.display(l.add(0.0D, 0.4D, 0.0D), 15, 0, 0, 0, 0, 10);
- }
- }
- }
- }.runTaskTimerAsynchronously(Main.plugin, 0L, 20L).getTaskId();
- int yaws = new BukkitRunnable() {
- float yaw = 0.0F;
- public void run() {
- for (Entity entities : w.getEntities()) {
- if (entities instanceof ArmorStand) {
- ArmorStand candles = (ArmorStand) entities;
- if (candles.hasMetadata("candle")) {
- Location l = candles.getLocation();
- l.setYaw(l.getYaw() + yaw);
- candles.teleport(l);
- }
- }
- }
- yaw += 0.2F;
- }
- }.runTaskTimerAsynchronously(Main.plugin, 1L, 1L).getTaskId();
- jogador.getEquipment().setArmorContents(null);
- jogador.getEquipment().setHelmet(getSkull(skull));
- ItemStack c = Item.addItem(Material.LEATHER_CHESTPLATE, 1);
- LeatherArmorMeta lam = (LeatherArmorMeta) c.getItemMeta();
- lam.setColor(Color.BLACK);
- c.setItemMeta(lam);
- jogador.getEquipment().setChestplate(c);
- int particulas = new BukkitRunnable() {
- float i = 0.0F;
- public void run() {
- for (int k = 0; k < 1; k++) {
- Location local = jogador.getLocation();
- double x = Math.sin(this.i * 3.7F);
- double y = Math.cos(this.i * 3.7F);
- double z = this.i * 0.4F;
- Vector v = new Vector(x, z, y);
- local.add(v);
- ParticleEffect.CRIT.display(local.add(0, 0, 0), 0, 0, 0, 10, 0, 25.0D);
- }
- this.i += 0.1F;
- if (this.i > 5.0F) {
- this.i = 0.0F;
- }
- }
- }.runTaskTimerAsynchronously(Main.plugin, 1L, 1L).getTaskId();
- new BukkitRunnable() {
- public void run() {
- Bukkit.getScheduler().cancelTask(yaws);
- Bukkit.getScheduler().cancelTask(fires);
- Bukkit.getScheduler().cancelTask(particulas);
- for (Entity entities : w.getEntities()) {
- if (entities instanceof ArmorStand) {
- ArmorStand candles = (ArmorStand) entities;
- if (candles.hasMetadata("candle")) {
- ParticleEffect.SMOKE_LARGE.display(candles.getEyeLocation(), 0, 0, 0, 5, 0, 15);
- candles.getWorld().playSound(candles.getEyeLocation(), Sound.CHICKEN_EGG_POP, 3F, 2F);
- candles.remove();
- }
- jogador.getEquipment().setArmorContents(null);
- animation.remove(jogador);
- }
- }
- }
- }.runTaskLaterAsynchronously(Main.plugin, 5 * 20L);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement