Small fixed. Preparing updating.
This commit is contained in:
parent
040f99f62a
commit
3c85079d6d
@ -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
|
||||
@ -117,7 +132,60 @@ public class ChallengeBouncingBlock extends Challenge
|
||||
{
|
||||
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);
|
||||
@ -159,8 +233,14 @@ public class ChallengeBouncingBlock extends Challenge
|
||||
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);
|
||||
|
@ -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++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user