fixed easter egg duration

parser list improvement
This commit is contained in:
Cheese 2015-04-03 21:47:43 +11:00
parent 54948cc61e
commit ff0883e7d7
3 changed files with 46 additions and 20 deletions

View File

@ -29,6 +29,8 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -180,13 +182,13 @@ public class MorphBunny extends MorphGadget
//Announce //Announce
Bukkit.broadcastMessage(C.cYellow + C.Bold + player.getName() + Bukkit.broadcastMessage(C.cYellow + C.Bold + player.getName() +
ChatColor.RESET + C.Bold + " has hidden an " + ChatColor.RESET + C.Bold + " hid an " +
C.cYellow + C.Bold + "Easter Egg" + C.cYellow + C.Bold + "Easter Egg" +
ChatColor.RESET + C.Bold + " worth " + ChatColor.RESET + C.Bold + " worth " +
C.cYellow + C.Bold + "450 Coins"); C.cYellow + C.Bold + "450 Coins");
for (Player other : UtilServer.getPlayers()) for (Player other : UtilServer.getPlayers())
player.playSound(other.getLocation(), Sound.CAT_HIT, 1.5f, 1.5f); other.playSound(other.getLocation(), Sound.CAT_HIT, 1.5f, 1.5f);
} }
@EventHandler @EventHandler
@ -194,6 +196,8 @@ public class MorphBunny extends MorphGadget
{ {
if (_eggs.containsKey(event.getItem()) && !_eggs.get(event.getItem()).equals(event.getPlayer().getName())) if (_eggs.containsKey(event.getItem()) && !_eggs.get(event.getItem()).equals(event.getPlayer().getName()))
{ {
_eggs.remove(event.getItem());
event.setCancelled(true); event.setCancelled(true);
event.getItem().remove(); event.getItem().remove();
@ -204,12 +208,12 @@ public class MorphBunny extends MorphGadget
UtilFirework.playFirework(event.getItem().getLocation(), Type.BURST, Color.YELLOW, true, true); UtilFirework.playFirework(event.getItem().getLocation(), Type.BURST, Color.YELLOW, true, true);
UtilPlayer.message(event.getPlayer(), //Announce
ChatColor.RESET + C.Bold + "You picked up an " + Bukkit.broadcastMessage(C.cYellow + C.Bold + event.getPlayer().getName() +
C.cYellow + C.Bold + "Easter Egg" + ChatColor.RESET + C.Bold + " found an " +
ChatColor.RESET + C.Bold + " worth " + C.cGold + C.Bold + "Easter Egg" +
C.cYellow + C.Bold + "450 Coins"); ChatColor.RESET + C.Bold + "! " + _eggs.size() + " Eggs left!");
} }
} }
@EventHandler @EventHandler
@ -218,16 +222,26 @@ public class MorphBunny extends MorphGadget
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
return; return;
Iterator<Item> gemIterator = _eggs.keySet().iterator(); Iterator<Item> eggIter = _eggs.keySet().iterator();
while (gemIterator.hasNext()) while (eggIter.hasNext())
{ {
Item gem = gemIterator.next(); Item egg = eggIter.next();
if (!gem.isValid() || gem.getTicksLived() > 24000) if (!egg.isValid() || egg.getTicksLived() > 24000)
{ {
gem.remove(); egg.remove();
gemIterator.remove(); eggIter.remove();
//Announce
Bukkit.broadcastMessage(
ChatColor.RESET + C.Bold + "No one found an " +
C.cGold + C.Bold + "Easter Egg" +
ChatColor.RESET + C.Bold + "! " + _eggs.size() + " Eggs left!");
}
else
{
UtilParticle.PlayParticle(ParticleType.SPELL, egg.getLocation().add(0, 0.1, 0), 0.1f, 0.1f, 0.1f, 0, 1);
} }
} }
} }

View File

@ -209,6 +209,9 @@ public class WorldManager extends MiniPlugin
if (!(ent instanceof Item)) if (!(ent instanceof Item))
continue; continue;
if (((Item)ent).getItemStack().getType() == Material.MONSTER_EGG)
continue;
if (ent.getTicksLived() > 1200) if (ent.getTicksLived() > 1200)
ent.remove(); ent.remove();
} }

View File

@ -34,6 +34,9 @@ public class ListCommand extends BaseCommand
for (GameType gameType : GameType.values()) for (GameType gameType : GameType.values())
{ {
if (gameType == GameType.InProgress)
continue;
if (listMaps(player, gameType, colorSwitch)) if (listMaps(player, gameType, colorSwitch))
colorSwitch = !colorSwitch; colorSwitch = !colorSwitch;
} }
@ -41,16 +44,22 @@ public class ListCommand extends BaseCommand
else if (args.length == 1) else if (args.length == 1)
{ {
GameType gameType = null; GameType gameType = null;
try if (args[0].equalsIgnoreCase("p"))
{ {
gameType = GameType.valueOf(args[0]); gameType = GameType.InProgress;
} }
catch (Exception e) else
{ {
getPlugin().sendValidGameTypes(player); try
{
gameType = GameType.valueOf(args[0]);
}
catch (Exception e)
{
getPlugin().sendValidGameTypes(player);
}
} }
UtilPlayer.message(player, F.main("Parser", "Listing Maps for gametype " + F.elem(gameType.GetName()))); UtilPlayer.message(player, F.main("Parser", "Listing Maps for gametype " + F.elem(gameType.GetName())));
listMaps(player, gameType, false); listMaps(player, gameType, false);
} }