Prevent fully powered-up Sneaky Assassin players from using additional power-ups
This commit is contained in:
parent
d2038670d6
commit
4460f2e651
@ -37,12 +37,20 @@ public class ArmorPowerUp extends PowerUp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void powerUpPlayer(Player player)
|
public boolean powerUpPlayer(Player player)
|
||||||
{
|
{
|
||||||
if(powerUpArmor(player) || powerUpArmor(player))
|
if (powerUpArmor(player) || powerUpArmor(player))
|
||||||
|
{
|
||||||
player.sendMessage("Your armor was upgraded!");
|
player.sendMessage("Your armor was upgraded!");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
player.sendMessage("Your armor is already fully upgraded!");
|
player.sendMessage("Your armor is already fully upgraded!");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean powerUpArmor(Player player)
|
private boolean powerUpArmor(Player player)
|
||||||
|
@ -108,5 +108,5 @@ public abstract class PowerUp
|
|||||||
getPowerUpManager().removePowerUp(this);
|
getPowerUpManager().removePowerUp(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void powerUpPlayer(Player player);
|
public abstract boolean powerUpPlayer(Player player);
|
||||||
}
|
}
|
||||||
|
@ -145,21 +145,23 @@ public class PowerUpManager implements Listener
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlayerPickUpPowerUp(PlayerPickupItemEvent event)
|
public void onPlayerPickUpPowerUp(final PlayerPickupItemEvent event)
|
||||||
{
|
{
|
||||||
if (getGame().GetTeam(event.getPlayer()) != null)
|
if (getGame().GetTeam(event.getPlayer()) != null)
|
||||||
{
|
{
|
||||||
PowerUp powerUp = getPowerUpByItem(event.getItem());
|
final PowerUp powerUp = getPowerUpByItem(event.getItem());
|
||||||
|
|
||||||
if (powerUp != null)
|
if (powerUp != null)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
powerUp.powerUpPlayer(event.getPlayer());
|
if (powerUp.powerUpPlayer(event.getPlayer()))
|
||||||
powerUp.remove();
|
{
|
||||||
|
powerUp.remove();
|
||||||
|
|
||||||
schedulePowerUpSpawn(10);
|
schedulePowerUpSpawn(10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ public class WeaponPowerUp extends PowerUp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void powerUpPlayer(Player player)
|
public boolean powerUpPlayer(Player player)
|
||||||
{
|
{
|
||||||
for (int swordType = 0; swordType < SWORD_PROGRESSION.size(); swordType++)
|
for (int swordType = 0; swordType < SWORD_PROGRESSION.size(); swordType++)
|
||||||
{
|
{
|
||||||
@ -35,10 +35,12 @@ public class WeaponPowerUp extends PowerUp
|
|||||||
|
|
||||||
player.sendMessage("You sword was upgraded!");
|
player.sendMessage("You sword was upgraded!");
|
||||||
|
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendMessage("Your sword is already fully upgraded!");
|
player.sendMessage("Your sword is already fully upgraded!");
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user