diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPinataBurst.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPinataBurst.java index 5c9febbd8..4ecb32660 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPinataBurst.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPinataBurst.java @@ -1,19 +1,13 @@ package mineplex.core.gadget.gadgets.death; -import org.bukkit.Color; -import org.bukkit.FireworkEffect; -import org.bukkit.FireworkEffect.Type; -import org.bukkit.entity.Player; import org.bukkit.Material; -import org.bukkit.event.EventHandler; +import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import mineplex.core.blood.BloodEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.DeathEffectGadget; @@ -34,31 +28,11 @@ public class DeathPinataBurst extends DeathEffectGadget public void onBlood(Player player, BloodEvent event) { event.setCancelled(true); - Color[] colors = new Color[10]; - for(int i = 0; i < colors.length; i++) { - colors[i] = Color.fromRGB(UtilMath.r(255*255*255)); - } - UtilFirework.playFirework(event.getLocation(), - FireworkEffect.builder().flicker(true).trail(true).withColor(colors).with(Type.BURST).build()); - - for(int i = 0; i < colors.length; i++) { - colors[i] = Color.fromRGB(UtilMath.r(255*255*255)); - } - UtilFirework.playFirework(event.getLocation().add(0, 1, 0), - FireworkEffect.builder().flicker(true).trail(true).withColor(colors).with(Type.BURST).build()); - - for(byte data : _data) + for(byte d : _data) { - UtilItem.dropItem(new ItemStack(Material.WOOL, 1, (short)0, data), event.getLocation(), true, false, 20*3, false); + ItemStack item = new ItemStack(Material.INK_SACK, 1, (short) 0, d); + UtilItem.dropItem(item, event.getLocation(), true, false, 40, false); } - for(Material m : new Material[]{Material.SUGAR, Material.PUMPKIN_PIE, Material.CAKE}) - { - for(int i = 0; i < 3; i++) - { - UtilItem.dropItem(new ItemStack(m), event.getLocation(), true, false, 20*3, false); - } - } - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEmerald.java index 0d802b8f2..28607c9db 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEmerald.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEmerald.java @@ -40,6 +40,18 @@ public class ParticleEmerald extends ParticleGadget if(getSet() == null || !getSet().isActive(player)) return; + if(!Manager.isMoving(player)) + { + UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(0, 2 - y, 0), 0.3f, 0f, 0.3f, 0, 2, ViewDist.NORMAL, + UtilServer.getPlayers()); + } + else + { + UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation(), 0.1f, 0f, 0.1f, 0, 2, ViewDist.NORMAL, + UtilServer.getPlayers()); + } + + /* tick += 17; x = (float) (Math.sin(tick / 7d) * 1f); z = (float) (Math.cos(tick / 7d) * 1f); @@ -48,25 +60,7 @@ public class ParticleEmerald extends ParticleGadget UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(x, y, z), 0f, 0f, 0f, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); - - // if (Manager.isMoving(player)) - // { - // UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(0, 1f, 0), 0f, 0f, 0f, 0, 1); - // } - // else - // { - // float scale = Math.abs((float) (Math.sin(player.getTicksLived()/30d) * 2f)) + 1; - // // float vertical = (float) (Math.cos(player.getTicksLived()/50d) * 1f); - // - // int dir = player.isSneaking() ? 1 : -1; - // - // for (double i=0 ; i _text = new HashMap<>(); private Chicken _chicken; + private DisguisePlayer _npc; private List _teamChickens = new ArrayList<>(); + private int _tick; public WinEffectBabyChicken(GadgetManager manager) { super(manager, "Baby Chicken", UtilText.splitLineToArray(C.cGray + "Bawk Bawk strikes again! Summon his minions and run around as an itty bitty chicken.", LineFormat.LORE), 1, Material.EGG, (byte) 0); - -// teleportMode = WinEffectTeleportMode.Grid_Team_Behind; + + _schematicName = "ChickenPodium"; } @Override public void play() { - _chicken = spawnChicken(_player, _baseLocation); - - UtilEnt.addGoalSelector(_chicken, 0, new PathfinderRandomRun(((CraftChicken)_chicken).getHandle(), getBaseLocation(), 4, 2.8)); + Location loc = getBaseLocation().add(-4, 0, 0); + loc.setDirection(_player.getLocation().subtract(loc).toVector()); + + _npc = getNPC(getPlayer(), loc); + + _tick = 0; List circle = UtilShapes.getPointsInCircle(getBaseLocation(), team.size(), 3); for(int i = 0; i < team.size(); i++) @@ -68,8 +76,6 @@ public class WinEffectBabyChicken extends WinEffectGadget UtilEnt.setBoundingBox(c, 0, 0); _teamChickens.add(c); } - -// lockAllPlayers = true; } public Chicken spawnChicken(Player player, Location loc) @@ -99,40 +105,70 @@ public class WinEffectBabyChicken extends WinEffectGadget { if (!isRunning()) return; - if (event.getType() == UpdateType.TICK) + if (event.getType() != UpdateType.TICK) return; + + _tick++; + + if(_tick < 20*2) { - // Flap Chicken Wings - PacketPlayOutRelEntityMove packet = new PacketPlayOutRelEntityMove(_chicken.getEntityId(), (byte) 0, (byte) 0, (byte) 0, false); - UtilPlayer.getNearby(_chicken.getLocation(), 64).stream().forEach(p -> UtilPlayer.sendPacket(_player, packet)); - - ((CraftChicken) _chicken).getHandle().lastDamager = ((CraftChicken) _chicken).getHandle(); - - if (UtilMath.r(10) == 0 || _text.size() < 3) + return; + } + else if(_tick == 20*2) + { + Location loc = _npc.GetEntity().getBukkitEntity().getLocation(); + + _npc.GetEntity().getBukkitEntity().remove(); + + UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, loc.clone().add(0, 1, 0), 0.3f, 0.6f, 0.3f, 0.07f, 200, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, loc.clone().add(0, 0.3, 0), 0.7f, 0.1f, 0.7f, 0.07f, 200, ViewDist.NORMAL); + + for(int i = 0; i < 10; i++) { - _chicken.getWorld().playSound(_chicken.getLocation(), Sound.CHICKEN_IDLE, 1, (float) (1 + Math.random()*0.6)); - - Hologram hologram = new Hologram(Manager.getHologramManager(), _chicken.getEyeLocation(), C.Italics + "BAWK"); - _text.put(hologram, Vector.getRandom().subtract(Vector.getRandom()).normalize().multiply(0.4).setY(0.6)); - hologram.start(); - } - - for (Iterator> it = _text.entrySet().iterator(); it.hasNext();) - { - Entry e = it.next(); - e.getValue().setY(e.getValue().getY() - 0.1); - if(e.getKey().getLocation().getY() < _chicken.getLocation().getY()) - { - e.getKey().stop(); - it.remove(); - } - e.getKey().setLocation(e.getKey().getLocation().add(e.getValue())); + Vector v = Vector.getRandom().subtract(Vector.getRandom()).multiply(0.25).setY(0.5); + UtilItem.dropItem(new ItemStack(Material.EGG), loc, false, false, 8*20, false).setVelocity(v); } - for(Chicken c : _teamChickens) - { - UtilEnt.CreatureLook(c, _chicken); - } + _chicken = spawnChicken(_player, loc); + UtilEnt.addGoalSelector(_chicken, 0, new PathfinderRandomRun(((CraftChicken)_chicken).getHandle(), getBaseLocation(), 4, 2.8)); + + _chicken.getWorld().playSound(_chicken.getLocation(), Sound.CHICKEN_EGG_POP, 1, 1); + + return; } + + + // Flap Chicken Wings + PacketPlayOutRelEntityMove packet = new PacketPlayOutRelEntityMove(_chicken.getEntityId(), (byte) 0, (byte) 0, (byte) 0, false); + UtilPlayer.getNearby(_chicken.getLocation(), 64).stream().forEach(p -> UtilPlayer.sendPacket(_player, packet)); + + ((CraftChicken) _chicken).getHandle().lastDamager = ((CraftChicken) _chicken).getHandle(); + + if (UtilMath.r(10) == 0 || _text.size() < 3) + { + _chicken.getWorld().playSound(_chicken.getLocation(), Sound.CHICKEN_IDLE, 1, (float) (1 + Math.random()*0.6)); + + Hologram hologram = new Hologram(Manager.getHologramManager(), _chicken.getEyeLocation(), C.Italics + "BAWK"); + _text.put(hologram, Vector.getRandom().subtract(Vector.getRandom()).normalize().multiply(0.4).setY(0.6)); + hologram.start(); + } + + for (Iterator> it = _text.entrySet().iterator(); it.hasNext();) + { + Entry e = it.next(); + e.getValue().setY(e.getValue().getY() - 0.1); + if(e.getKey().getLocation().getY() < _chicken.getLocation().getY()) + { + e.getKey().stop(); + it.remove(); + } + e.getKey().setLocation(e.getKey().getLocation().add(e.getValue())); + } + + for(Chicken c : _teamChickens) + { + UtilEnt.CreatureLook(c, _chicken); + } + } @Override @@ -147,6 +183,15 @@ public class WinEffectBabyChicken extends WinEffectGadget _teamChickens.forEach(c -> c.remove()); team.forEach(p -> UtilPlayer.showForAll(p)); } + + @Override + public void teleport(Player player, List team, List other, Location loc) + { + loc = getBaseLocation().add(-10, 0, 0); + _baseLocation.subtract(4, 4, 0); + super.teleport(player, team, other, loc); + _baseLocation.add(4, 0, 0); + } private static class PathfinderRandomRun extends PathfinderGoal { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectRiseOfTheElderGuardian.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectRiseOfTheElderGuardian.java index 9f3661e14..bed876aed 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectRiseOfTheElderGuardian.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectRiseOfTheElderGuardian.java @@ -36,6 +36,8 @@ public class WinEffectRiseOfTheElderGuardian extends WinEffectGadget { super(manager, "Rise of the Elder Guardian", UtilText.splitLinesToArray(new String[]{C.cGray + C.Italics + "Say hello to my little friend...", " ", " ", C.cGray + C.Italics + "the elder guardian."}, LineFormat.LORE), 1, Material.PRISMARINE, (byte) 2); + + _schematicName = "ElderGuardianPodium"; } @Override @@ -46,11 +48,11 @@ public class WinEffectRiseOfTheElderGuardian extends WinEffectGadget int amount = 4; for(int i = 0; i < amount; i++) { - double rad = ((Math.PI*2)/amount) * i; + double rad = ((Math.PI*2)/amount) * i + Math.PI/4.0; double x = Math.sin(rad); double z = Math.cos(rad); - Vector diff = new Vector(x, 0, z).multiply(4.5).setY(-2.5); + Vector diff = new Vector(x, 0, z).multiply(5.7).setY(1); Location loc = getBaseLocation().add(diff); @@ -104,7 +106,6 @@ public class WinEffectRiseOfTheElderGuardian extends WinEffectGadget { UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, getBaseLocation().add(0, 1, 0), 0.3f, 0.6f, 0.3f, 0.07f, 400, ViewDist.NORMAL); UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, getBaseLocation().add(0, 0.3, 0), 0.7f, 0.1f, 0.7f, 0.07f, 400, ViewDist.NORMAL); -// getBaseLocation().getWorld().playSound(getBaseLocation(), Sound.EXPLODE, 1, 1); getBaseLocation().getWorld().playSound(getBaseLocation(), Sound.ZOMBIE_REMEDY, 6f, 0.75f); getBaseLocation().getWorld().playSound(getBaseLocation(), Sound.EXPLODE, 1, 1); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java index b702b03d2..42dc8cc92 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -187,66 +187,10 @@ public abstract class WinEffectGadget extends Gadget p.setAllowFlight(false); UtilPlayer.hideFromAll(p); } - -// for(Entity e : loc.getWorld().getEntities()) -// { -// if(!(e instanceof LivingEntity)) continue; -// DisguiseBase d = Manager.getDisguiseManager().getDisguise((LivingEntity) e); -// if(d == null) continue; -// if(!(d instanceof DisguisePlayer)) continue; -//// d.resendMetadata(); -// } - - } public void buildWinnerRoom(Location loc) { - /* - Location floorCenter = loc.clone().add(0, -1, 0); - Location floorA = floorCenter.clone().subtract(8, 0, 8); - Location floorB = floorCenter.clone().add(7, 0, 7); - - for(Block b : UtilBlock.getInBoundingBox(floorA, floorB, false)) - { - Material mat = Material.STAINED_CLAY; - if(((b.getX()-floorA.getBlockX())%4 == 3 || (b.getX()-floorA.getBlockX())%4 == 0) && - (((b.getZ()-floorA.getBlockZ())%4 == 3 || (b.getZ()-floorA.getBlockZ())%4 == 0))) - { - mat = Material.REDSTONE_LAMP_ON; - b.getRelative(BlockFace.DOWN).setType(Material.REDSTONE_BLOCK); - } - b.setType(mat); - } - - Location wallB = floorB.clone().add(0, 8, 0); - - for(Block b : UtilBlock.getInBoundingBox(floorA, wallB, false, true, true, false)) - { - b.setTypeIdAndData(Material.STAINED_CLAY.getId(), (byte) (((b.getY()-floorCenter.getBlockY())%2 == 0)? 14 : 1), true); - } - - Location ceilA = floorA.clone().add(0, 8, 0); - - for(Block b : UtilBlock.getInBoundingBox(ceilA, wallB, false)) - { - b.setType(Material.LAPIS_BLOCK); - } - - int cxMin = floorB.getChunk().getX(); - int cxMax = floorA.getChunk().getX(); - int czMin = floorB.getChunk().getZ(); - int czMax = floorA.getChunk().getZ(); - for(int x = cxMin; x <= cxMax; x++) - { - for(int z = czMin; z <= czMax; z++) - { - ((CraftChunk)loc.getWorld().getChunkAt(x, z)).getHandle().initLighting(); - } - } -// ((CraftChunk)loc.getChunk()).getHandle().initLighting(); - */ - pasteScematic(_schematicName); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java index 6a0ddcf5d..aa1cb8479 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java @@ -43,8 +43,6 @@ public class WinEffectManager game.CreatureAllowOverride = true; playEffect(); - - game.CreatureAllowOverride = false; } public void prepareSetup(Location loc) { @@ -71,9 +69,7 @@ public class WinEffectManager effect.teleport(winner, team, other, loc.clone().add(loc.getDirection().normalize().multiply(10)).add(0, 3, 0)); new BukkitRunnable() { public void run() { - game.CreatureAllowOverride = true; effect.runPlay(); - game.CreatureAllowOverride = false; } }.runTaskLater(game.getArcadeManager().getPlugin(), 30); @@ -84,6 +80,8 @@ public class WinEffectManager effect.runFinish(); game.getArcadeManager().getCosmeticManager().getGadgetManager().setHideParticles(false); + + game.CreatureAllowOverride = false; } public WinEffectGadget getWinEffect(Player player)