Fixes an issue where players would be able to duplicate kit items by
giving them to another player then using their "Early game revive"
This commit is contained in:
Sam 2016-06-03 23:29:46 +01:00
parent c01b6da390
commit f99d4bc14d
5 changed files with 49 additions and 11 deletions

View File

@ -1931,5 +1931,10 @@ public class Bridge extends TeamGame implements OreObsfucation
{ {
_bridgeTime = time; _bridgeTime = time;
} }
public boolean hasUsedRevive(Player player)
{
return _usedLife.contains(player);
}
} }

View File

@ -1,19 +1,21 @@
package nautilus.game.arcade.game.games.bridge.kits; package nautilus.game.arcade.game.games.bridge.kits;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkBarrage;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitArcher extends Kit public class KitArcher extends Kit
{ {
public KitArcher(ArcadeManager manager) public KitArcher(ArcadeManager manager)
{ {
super(manager, "Archer", KitAvailability.Gem, super(manager, "Archer", KitAvailability.Gem,
@ -36,6 +38,13 @@ public class KitArcher extends Kit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); if(Manager.GetGame() instanceof Bridge)
{
return;
}
Bridge bridge = (Bridge) Manager.GetGame();
if(!bridge.hasUsedRevive(player))
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
} }
} }

View File

@ -7,6 +7,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
@ -36,6 +37,13 @@ public class KitBeserker extends Kit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); if(Manager.GetGame() instanceof Bridge)
{
return;
}
Bridge bridge = (Bridge) Manager.GetGame();
if(!bridge.hasUsedRevive(player))
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
} }
} }

View File

@ -7,6 +7,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
@ -36,6 +37,13 @@ public class KitMammoth extends Kit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
if(Manager.GetGame() instanceof Bridge)
{
return;
}
Bridge bridge = (Bridge) Manager.GetGame();
if(!bridge.hasUsedRevive(player))
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
} }
} }

View File

@ -7,6 +7,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
@ -36,6 +37,13 @@ public class KitMiner extends Kit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE)); if(Manager.GetGame() instanceof Bridge)
{
return;
}
Bridge bridge = (Bridge) Manager.GetGame();
if(!bridge.hasUsedRevive(player))
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE));
} }
} }