diff --git a/.recommenders/caches/identified-project-coordinates.json b/.recommenders/caches/identified-project-coordinates.json index 9e26dfeeb..d19ad1d37 100644 --- a/.recommenders/caches/identified-project-coordinates.json +++ b/.recommenders/caches/identified-project-coordinates.json @@ -1 +1 @@ -{} \ No newline at end of file +[[{"location":"C:\\Program Files\\Java\\jre1.8.0_51","type":"JRE","hints":{}},"jre:jre:1.8.0"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Mineplex.Core","type":"PROJECT","hints":{"PROJECT_NAME":"Mineplex.Core"}},"ABSENT"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Nautilus.Game.Arcade","type":"PROJECT","hints":{"PROJECT_NAME":"Nautilus.Game.Arcade"}},"ABSENT"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Libraries\\craftbukkit.jar","type":"JAR","hints":{}},"ABSENT"]] \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java index 6cdfd05bd..2282e360e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java @@ -35,6 +35,7 @@ public abstract class Challenge implements Listener { LastStanding, FirstComplete } + public MineWare Host; protected int Places; @@ -512,5 +513,4 @@ public abstract class Challenge implements Listener { return !Completed.isEmpty(); } - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/DeathEffect.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/DeathEffect.java new file mode 100644 index 000000000..fca7625c0 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/DeathEffect.java @@ -0,0 +1,102 @@ +package nautilus.game.arcade.game.games.mineware; + +import java.util.ArrayList; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.itemstack.ItemBuilder; + +public class DeathEffect +{ + private MineWare _host; + private JavaPlugin _plugin; + private ArrayList _eggs = new ArrayList(); + + public DeathEffect(MineWare host) + { + _host = host; + _plugin = host.getArcadeManager().getPlugin(); + } + + public void playDeath(Player player) + { + Location loc = player.getLocation(); + Block belowFirst = loc.getBlock().getRelative(BlockFace.DOWN); + Block belowSecond = belowFirst.getRelative(BlockFace.DOWN); + + if (!belowFirst.isEmpty() || !belowSecond.isEmpty()) + { + System.out.println("Death effect triggered for " + player.getName() + "."); + startEggSpawnTask(loc); + } + } + + private void startEggSpawnTask(Location loc) + { + for (int i = 0; i < 20; i++) + { + loc.add(0, 1, 0); + + ItemBuilder builder = new ItemBuilder(Material.EGG); + builder.setTitle(UtilMath.r(999999) + "Egg"); + + Item egg = loc.getWorld().dropItem(loc, builder.build()); + + Vector velocity = new Vector((Math.random() - 0.5) * 0.5, 0.1 + Math.random() * 0.3, + (Math.random() - 0.5) * 0.5); + egg.setVelocity(velocity); + + _eggs.add(egg); + removeSpawnedEggTask(egg); + } + + loc.getWorld().playSound(loc, Sound.CHICKEN_EGG_POP, 1.0F, 1.0F); + } + + private void removeSpawnedEggTask(Item egg) + { + new BukkitRunnable() + { + @Override + public void run() + { + if (egg.isValid() && _eggs.contains(egg)) + { + UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, egg.getLocation(), 0.0F, 0.0F, 0.0F, + 0.0F, 1, ViewDist.MAX); + _eggs.remove(egg); + egg.remove(); + } + } + }.runTaskLater(_plugin, 60L); + } + + public void removeSpawnedEggs() + { + for (Item item : _eggs) + { + if (item.isValid()) + { + item.remove(); + } + } + } + + private boolean shouldCancel() + { + return !_host.IsLive() || !_host.isChallengeStarted(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java index c6d196bc8..3956ad159 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java @@ -32,6 +32,7 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitRunnable; import mineplex.core.account.CoreClient; +import mineplex.core.blood.BloodEvent; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -116,6 +117,8 @@ public class MineWare extends SoloGame implements IThrown private ArrayList> _challenges = new ArrayList>(); private ArrayList> _challengesCopy = new ArrayList>(); + private DeathEffect _deathEffect = new DeathEffect(this); + @SuppressWarnings("unchecked") public MineWare(ArcadeManager manager) { @@ -141,7 +144,7 @@ public class MineWare extends SoloGame implements IThrown AutomaticRespawn = false; DeathMessages = false; GiveClock = false; - + Manager.GetCreature().SetDisableCustomDrops(true); PopulateOrders(); @@ -218,6 +221,12 @@ public class MineWare extends SoloGame implements IThrown Manager.GetLobby().DisplayWaiting(); } } + + @EventHandler + public void onBlood(BloodEvent event) + { + event.setCancelled(true); + } @Override public void EndCheck() @@ -481,8 +490,11 @@ public class MineWare extends SoloGame implements IThrown { if (_challenge == null) return; + + Player player = event.getEntity(); - _challenge.getLost().add(event.getEntity()); + _challenge.getLost().add(player); + _deathEffect.playDeath(player); LoseLife(event.getEntity(), true); } @@ -911,8 +923,6 @@ public class MineWare extends SoloGame implements IThrown { Manager.addSpectator(player, true); } - - player.playSound(player.getLocation(), Sound.CHICKEN_HURT, 1.5F, 1.0F); } } @@ -939,6 +949,7 @@ public class MineWare extends SoloGame implements IThrown Bukkit.getServer().getPluginManager().callEvent(new ChallengeEndEvent(_challenge)); HandlerList.unregisterAll(_challenge); + _deathEffect.removeSpawnedEggs(); _challenge.EndOrder(); _isChallengeStarted = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeReverseTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeReverseTag.java index 9fd1202cc..3c9b9a56a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeReverseTag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeReverseTag.java @@ -214,7 +214,7 @@ public class ChallengeReverseTag extends Challenge { //UtilPlayer.message(player, C.cYellow + C.Bold + "You are " + C.cRed + "NO LONGER" + C.cYellow + " tagged!"); - UtilTextMiddle.display(null, C.cRed + "You are no longer tagged.", 5, 40, 5); + UtilTextMiddle.display(null, C.cRed + "You are no longer tagged.", 5, 40, 5, player); player.getInventory().setHelmet(new ItemStack(Material.AIR)); _tagged.remove(player.getName()); @@ -236,7 +236,7 @@ public class ChallengeReverseTag extends Challenge { // UtilPlayer.message(player, C.cYellow + C.Bold + "You are " + C.cGreen + "NOW" + C.cYellow + " tagged! Keep it up!"); - UtilTextMiddle.display(null, C.cGreen + "You are now tagged, keep it up.", 5, 40, 5); + UtilTextMiddle.display(null, C.cGreen + "You are now tagged, keep it up.", 5, 40, 5, player); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(35, (byte) 5)); _tagged.add(player.getName()); _cooldowned.add(player.getName()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/kit/KitBawksFood.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/kit/KitBawksFood.java index 576ff71a6..61eef0b82 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/kit/KitBawksFood.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/kit/KitBawksFood.java @@ -19,7 +19,7 @@ public class KitBawksFood extends Kit public KitBawksFood(ArcadeManager manager) { super(manager, - "Bawks Food", + "Bawk's Food", KitAvailability.Free, new String[] { "You must listen to Bawk Bawk." }, new Perk[] { }, @@ -42,21 +42,25 @@ public class KitBawksFood extends Kit ItemStack helmet = new ItemStack(Material.LEATHER_HELMET); LeatherArmorMeta helmetMeta = (LeatherArmorMeta) helmet.getItemMeta(); helmetMeta.setColor(Color.WHITE); + helmetMeta.spigot().setUnbreakable(true); helmet.setItemMeta(helmetMeta); ItemStack chestplate = new ItemStack(Material.LEATHER_CHESTPLATE); LeatherArmorMeta chestplateMeta = (LeatherArmorMeta) chestplate.getItemMeta(); chestplateMeta.setColor(Color.WHITE); + chestplateMeta.spigot().setUnbreakable(true); chestplate.setItemMeta(chestplateMeta); ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS); LeatherArmorMeta leggingsMeta = (LeatherArmorMeta) leggings.getItemMeta(); leggingsMeta.setColor(Color.WHITE); + leggingsMeta.spigot().setUnbreakable(true); leggings.setItemMeta(leggingsMeta); ItemStack boots = new ItemStack(Material.LEATHER_BOOTS); LeatherArmorMeta bootsMeta = (LeatherArmorMeta) boots.getItemMeta(); bootsMeta.setColor(Color.WHITE); + bootsMeta.spigot().setUnbreakable(true); boots.setItemMeta(bootsMeta); equipment.setHelmet(helmet);