Bug fixes

This commit is contained in:
CoderTim 2014-10-27 18:09:23 -04:00
parent 0472870e78
commit 9f8b119fb7
6 changed files with 24 additions and 25 deletions

View File

@ -82,6 +82,8 @@ public class Npc
} }
public void returnToPost() public void returnToPost()
{
if (_entity instanceof CraftCreature)
{ {
EntityCreature ec = ((CraftCreature) _entity).getHandle(); EntityCreature ec = ((CraftCreature) _entity).getHandle();
@ -89,20 +91,24 @@ public class Npc
_returning = true; _returning = true;
} }
}
public boolean isReturning() public boolean isReturning()
{ {
return _returning; return _returning;
} }
public void clearGoals(Entity entity) public void clearGoals()
{
if (_entity instanceof CraftCreature)
{ {
_returning = false; _returning = false;
Location entityLocation = entity.getLocation(); Location entityLocation = _entity.getLocation();
EntityCreature ec = ((CraftCreature) entity).getHandle(); EntityCreature ec = ((CraftCreature) _entity).getHandle();
ec.getNavigation().a(entityLocation.getX(), entityLocation.getY(), entityLocation.getZ(), .8f); ec.getNavigation().a(entityLocation.getX(), entityLocation.getY(), entityLocation.getZ(), .8f);
} }
}
public NpcManager getNpcManager() public NpcManager getNpcManager()
{ {

View File

@ -430,15 +430,15 @@ public class NpcManager extends MiniPlugin
entity.setVelocity(new Vector(0, 0, 0)); entity.setVelocity(new Vector(0, 0, 0));
npc.setFailedAttempts(0); npc.setFailedAttempts(0);
} }
else if (!npc.isInRadius(entity.getLocation())) else if (!npc.isInRadius(entity.getLocation()) && npc.getEntity() instanceof CraftCreature)
{ {
npc.returnToPost(); npc.returnToPost();
npc.incrementFailedAttempts(); npc.incrementFailedAttempts();
} }
else else if (npc.getEntity() instanceof CraftCreature)
{ {
if (npc.isReturning()) if (npc.isReturning())
npc.clearGoals(entity); npc.clearGoals();
npc.setFailedAttempts(0); npc.setFailedAttempts(0);
} }

View File

@ -245,7 +245,7 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
} }
} }
AddButton(40, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowCount++ + " Games In Progress", new String[]{MESSAGE_SPECTATE}, yellowCount > 64 ? 1 : yellowCount, false), new SingleButton() AddButton(40, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowCount + " Game" + (yellowCount == 1 ? "" : "s") + " In Progress", new String[]{MESSAGE_SPECTATE}, yellowCount > 64 ? 1 : yellowCount, false), new SingleButton()
{ {
@Override @Override
public void Clicked(Player player) public void Clicked(Player player)

View File

@ -26,7 +26,7 @@ public class KitSheepPig extends Kit
{ {
public KitSheepPig(ArcadeManager manager) public KitSheepPig(ArcadeManager manager)
{ {
super(manager, "'Pig'", KitAvailability.Green, 5000, super(manager, "Pig", KitAvailability.Green, 5000,
new String[] new String[]
{ {

View File

@ -175,7 +175,7 @@ public class PerkBomber extends Perk
@EventHandler @EventHandler
public void ExplosionPrime(ExplosionPrimeEvent event) public void ExplosionPrime(ExplosionPrimeEvent event)
{ {
Player player = _tntMap.remove(event.getEntity()); Player player = _tntMap.get(event.getEntity());
if (player != null) if (player != null)
{ {
for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14)) for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14))
@ -185,7 +185,7 @@ public class PerkBomber extends Perk
} }
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent event) public void onEntityExplode(EntityExplodeEvent event)
{ {
Player player = _tntMap.remove(event.getEntity()); Player player = _tntMap.remove(event.getEntity());
@ -198,16 +198,9 @@ public class PerkBomber extends Perk
if (block.getType() == Material.DIAMOND_ORE) if (block.getType() == Material.DIAMOND_ORE)
{ {
it.remove();
if (Math.random() < event.getYield())
{
block.breakNaturally();
Bukkit.getPluginManager().callEvent(new BomberExplodeDiamondBlock(player, block)); Bukkit.getPluginManager().callEvent(new BomberExplodeDiamondBlock(player, block));
} block.breakNaturally();
else it.remove();
block.setType(Material.AIR);
} }
} }
} }

View File

@ -24,7 +24,7 @@ public class KaboomStatTracker extends StatTracker<MineStrike>
{ {
for (Player player : event.getDamagedPlayers()) for (Player player : event.getDamagedPlayers())
{ {
if (!player.isDead()) if (player.getHealth() != player.getMaxHealth())
return; return;
} }