diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBouncingBlock.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBouncingBlock.java index 1fdc1b6ef..8e5164d2f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBouncingBlock.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBouncingBlock.java @@ -5,23 +5,35 @@ import java.util.HashMap; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilShapes; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.Challenge; import nautilus.game.arcade.game.games.mineware.MineWare; import org.bukkit.Bukkit; import org.bukkit.FireworkEffect.Type; +import org.bukkit.ChatColor; +import org.bukkit.DyeColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.material.Wool; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import com.sun.xml.internal.ws.resources.UtilMessages; + public class ChallengeBouncingBlock extends Challenge { @@ -30,7 +42,7 @@ public class ChallengeBouncingBlock extends Challenge public ChallengeBouncingBlock(MineWare host) { - super(host, ChallengeType.FirstComplete, "Bouncing Block", "Jump and punch the wool", "Land on red wool = score reset"); + super(host, ChallengeType.FirstComplete, "Bouncing Block", "Jump and punch the wool!", "Land on red wool = score reset", "First to 10 wins!"); } @Override @@ -56,7 +68,9 @@ public class ChallengeBouncingBlock extends Challenge woolBlocks.setType(Material.AIR); } _scoreBlocks.clear(); + _playerScore.clear(); Host.StrictAntiHack = true; + Host.DamageFall = false; } @Override @@ -64,11 +78,12 @@ public class ChallengeBouncingBlock extends Challenge { for(Player player : Host.GetPlayers(true)) { - player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 4)); - + player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 5)); + _playerScore.put(player, 0); } Host.StrictAntiHack = false; + Host.DamageFall = true; } @Override @@ -82,7 +97,7 @@ public class ChallengeBouncingBlock extends Challenge } spawnStartingWool(); } - + @EventHandler public void onPlayerPunchWool(PlayerInteractEvent event) { @@ -107,17 +122,70 @@ public class ChallengeBouncingBlock extends Challenge Bukkit.broadcastMessage("Clicked block doesn't appear in list of blocks"); return; } - - _playerScore.put(event.getPlayer(), _playerScore.get(event.getPlayer())+1); + + _playerScore.put(event.getPlayer(), _playerScore.get(event.getPlayer()) + 1); event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.SUCCESSFUL_HIT, 0.2f, 0.2f); event.getClickedBlock().setType(Material.AIR); - spawnRandomWool(getArenaSize(9), (UtilMath.r(7)+3)); - + spawnRandomWool(getArenaSize(9), (UtilMath.r(7) + 3)); + if(_playerScore.get(event.getPlayer()) >= 10) { SetCompleted(event.getPlayer()); } - + } + + @EventHandler + public void onPlayerFallDamage(EntityDamageEvent event) + { + if(!Host.IsLive()) + { + return; + } + if(!(event.getEntity() instanceof Player)) + { + return; + } + if(event.getCause() != DamageCause.FALL) + { + return; + } + event.setCancelled(true); + + Player player = (Player) event.getEntity(); + Location pLocation = player.getLocation(); + Block blockUnderPlayer = player.getWorld().getBlockAt(pLocation.getBlockX(), pLocation.getBlockY() - 1, pLocation.getBlockZ()); + { + if(blockUnderPlayer.getType() == Material.WOOL) + { + Wool wool = (Wool) blockUnderPlayer; + if(wool.getColor() == DyeColor.RED) + { + _playerScore.put(player, 0); + UtilPlayer.message(player, "You landed on a RED wool! Score Reset!"); + } + } + } + } + + @EventHandler + public void scoreHandler(UpdateEvent event) + { + if(!Host.IsLive()) + { + return; + } + if(event.getType() != UpdateType.FASTEST) + { + return; + } + for(Player player : Host.GetPlayers(true)) + { + if(isDone(player)) + { + continue; + } + UtilTextBottom.display(ChatColor.YELLOW + "Your Score: " + ChatColor.GREEN + _playerScore.get(player), player); + } } private void spawnStartingWool() @@ -136,6 +204,12 @@ public class ChallengeBouncingBlock extends Challenge { if(UtilMath.r(200) == 50) { + Byte color = (byte) UtilMath.r(16); + while(color == 14) + { + color = (byte) UtilMath.r(16); + } + b.setType(Material.WOOL); b.setData((byte) UtilMath.r(16)); _scoreBlocks.add(b); @@ -154,13 +228,19 @@ public class ChallengeBouncingBlock extends Challenge private void spawnRandomWool(int size, int height) { - int x = UtilMath.r(size*2) - size; + int x = UtilMath.r(size * 2) - size; int y = height; - int z = UtilMath.r(size*2) - size; + int z = UtilMath.r(size * 2) - size; Block b = getCenter().getBlock().getRelative(x, y, z); + Byte color = (byte) UtilMath.r(16); + while(color == 14) + { + color = (byte) UtilMath.r(16); + } + b.setType(Material.WOOL); - b.setData((byte) UtilMath.r(16)); + b.setData(color); UtilFirework.playFirework(b.getLocation(), Type.BALL, ((Wool) b).getColor().getColor(), false, false); _scoreBlocks.add(b); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDogvsCat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDogvsCat.java index 615241299..e9414d3ce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDogvsCat.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDogvsCat.java @@ -6,6 +6,7 @@ import java.util.HashMap; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; @@ -41,7 +42,7 @@ public class ChallengeDogvsCat extends Challenge public ChallengeDogvsCat(MineWare host) { - super(host, ChallengeType.FirstComplete, "Dogs VS Cats", "If you are a dog, bark!", "If you are a cat, meow!", "Left-Click to Bark/Meow!"); + super(host, ChallengeType.FirstComplete, "Dogs VS Cats", "Look up and Bark/Meow!", "Keep an eye on your Action bar!"); } @Override @@ -100,6 +101,7 @@ public class ChallengeDogvsCat extends Challenge player.getInventory().addItem( ItemStackFactory.Instance.CreateStack(Material.BONE, (byte) 0, 1, ChatColor.GREEN + "Left-click to bark!")); + UtilPlayer.message(player, "You are a DOG! Bark!"); } else { @@ -110,6 +112,7 @@ public class ChallengeDogvsCat extends Challenge player.getInventory().addItem( ItemStackFactory.Instance.CreateStack(Material.SUGAR, (byte) 0, 1, ChatColor.GREEN + "Left-click to meow!")); + UtilPlayer.message(player, "You are a CAT! Meow!"); } looped++; }