Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex

This commit is contained in:
Chiss 2014-08-07 17:31:01 +10:00
commit 0317795a04
6 changed files with 51 additions and 24 deletions

View File

@ -246,15 +246,17 @@ public class NewsManager extends MiniPlugin
String text = col + C.Bold + "MINEPLEX" + ChatColor.RESET + " - " + _news[_newsIndex];
if (text.length() > 64)
text = text.substring(0, 64);
double healthPercent = (double)_newsIndex/(double)(_news.length-1);
for (Player player : UtilServer.getPlayers())
UtilDisplay.displayTextBar(Manager.GetPlugin(), player, (double)_newsIndex/(double)(_news.length-1), text);
UtilDisplay.displayTextBar(Manager.GetPlugin(), player, healthPercent, text);
for (Mount mount : Manager.GetMount().getMounts())
{
if (mount instanceof Dragon)
{
((Dragon)mount).SetName(text);
((Dragon)mount).setHealthPercent(healthPercent);
}
}
}

View File

@ -30,7 +30,10 @@ public class DragonMount extends Mount<DragonData>
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
//Store
_active.put(player, new DragonData(this, player));
DragonData dragonData = new DragonData(this, player);
//Set max health to 1 so player doesn't see a bunch of mount hearts flashing when NewsManager changes the health
dragonData.Dragon.setMaxHealth(1.0);
_active.put(player, dragonData);
}
@Override

View File

@ -103,7 +103,18 @@ public class Dragon extends DragonMount
for (DragonData dragon : GetActive().values())
dragon.Dragon.setCustomName(news);
}
public void setHealthPercent(double healthPercent)
{
for (DragonData dragon : GetActive().values())
{
double health = healthPercent * dragon.Dragon.getMaxHealth();
if (health <= 0.0)
health = 0.001;
dragon.Dragon.setHealth(health);
}
}
@EventHandler
public void HeroOwner(PlayerJoinEvent event)
{

View File

@ -187,9 +187,10 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
private void buildAvailableServerPage(List<ServerInfo> serverList, int slotsNeeded)
{
int serversToShow = 5;
int greenCount = 0;
int yellowCount = 0;
int greenStartSlot = 19;
int greenStartSlot = 18 + ((9 - serversToShow) / 2);
boolean showGreen = true;
long portalTime = Plugin.getMillisecondsUntilPortal(Player);
@ -203,7 +204,7 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
{
int slot = greenCount + greenStartSlot;
if (isStarting(serverInfo) && hasEnoughSlots(serverInfo, slotsNeeded) && greenCount < 7)
if (isStarting(serverInfo) && hasEnoughSlots(serverInfo, slotsNeeded) && greenCount < serversToShow)
{
if (showGreen)
{
@ -232,7 +233,7 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
// Clear empty slots
if (showGreen)
{
for (int i = greenCount + greenStartSlot; i < greenStartSlot + 7; i++)
for (int i = greenCount + greenStartSlot; i < greenStartSlot + serversToShow; i++)
{
setItem(i, null);
}

View File

@ -294,6 +294,13 @@ public class SneakyAssassins extends SoloGame
event.setCancelled(true);
}
@EventHandler(ignoreCancelled = true)
public void onDamageHanging(EntityDamageEvent event)
{
if (event.getEntity() instanceof Hanging)
event.setCancelled(true);
}
@EventHandler(ignoreCancelled = true)
public void onWitherEffectDamager(CustomDamageEvent event)
{

View File

@ -161,34 +161,37 @@ public class PowerUpManager implements Listener
event.setCancelled(true);
powerUp.remove();
int count = getPowerUpCount(event.getPlayer());
int count = incrementPowerUpCount(event.getPlayer());
PowerUpType.SMOKE_BOMB.powerUpPlayer(event.getPlayer(), getRandom());
if (count == 5)
if (count <= 4)
{
PowerUpType.COMPASS.powerUpPlayer(event.getPlayer(), getRandom());
powerUp.remove();
UtilPlayer.message(event.getPlayer(), F.main("Game", "You now have a " + F.item("Compass") + " for tracking players"));
if (PowerUpType.SMOKE_BOMB.powerUpPlayer(event.getPlayer(), getRandom()))
UtilPlayer.message(event.getPlayer(), F.main("Power-Up", "+1 " + F.item("Smoke Bomb")));
getGame().Announce(F.main("Game", F.name(C.Bold + event.getPlayer().getName()) + " has become a " + F.skill(C.Bold + "Master Assassin")));
for (Player player : UtilServer.getPlayers())
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f);
}
else
{
if (count < 5)
if (count == 4)
{
PowerUpType.COMPASS.powerUpPlayer(event.getPlayer(), getRandom());
UtilPlayer.message(event.getPlayer(), F.main("Game", "You now have a " + F.item("Compass") + " for tracking players"));
getGame().Announce(F.main("Game", F.name(C.Bold + event.getPlayer().getName()) + " has become a " + F.skill(C.Bold + "Master Assassin")));
for (Player player : UtilServer.getPlayers())
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f);
}
else
{
PowerUpType.WEAPON.powerUpPlayer(event.getPlayer(), getRandom());
PowerUpType.ARMOR.powerUpPlayer(event.getPlayer(), getRandom());
UtilPlayer.message(event.getPlayer(), F.main("Game", "Your " + F.item("Sword") + " and " + F.item("Armor") + " have been upgraded!"));
getGame().Announce(F.main("Game", F.name(event.getPlayer().getName()) + " collected a " + F.skill("Powerup") + "."));
}
getGame().Announce(F.main("Game", F.name(event.getPlayer().getName()) + " collected a " + F.skill("Powerup") + "."));
incrementPowerUpCount(event.getPlayer());
}
schedulePowerUpSpawn(10);