Changes from QA testing

This commit is contained in:
Sam 2017-11-11 13:26:24 +00:00 committed by Alexander Meech
parent 98ef9764d7
commit 3274cc434e
6 changed files with 182 additions and 162 deletions

View File

@ -22,8 +22,6 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.account.permissions.Permission; import mineplex.core.account.permissions.Permission;
@ -41,6 +39,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -80,7 +79,7 @@ public class SnowFight extends TeamGame
.build(); .build();
private static final int GUN_BULLETS = 5; private static final int GUN_BULLETS = 5;
private static final long COMBAT_TIME = TimeUnit.SECONDS.toMillis(8); private static final long COMBAT_TIME = TimeUnit.SECONDS.toMillis(8);
private static final PotionEffect REGENERATION = new PotionEffect(PotionEffectType.REGENERATION, Integer.MAX_VALUE, 1); private static final String CONDITION_REASON = "Out of Combat";
private boolean _gunMode; private boolean _gunMode;
private long _gunModeTime = GUN_MODE_TIME; private long _gunModeTime = GUN_MODE_TIME;
@ -119,6 +118,8 @@ public class SnowFight extends TeamGame
.register(this); .register(this);
new CompassModule() new CompassModule()
.setGiveCompassToAlive(true)
.setGiveCompass(false)
.register(this); .register(this);
registerDebugCommand("launchers", Perm.DEBUG_COMMANDS, PermissionGroup.ADMIN, (player, args) -> _gunModeTime = 0); registerDebugCommand("launchers", Perm.DEBUG_COMMANDS, PermissionGroup.ADMIN, (player, args) -> _gunModeTime = 0);
@ -152,7 +153,7 @@ public class SnowFight extends TeamGame
{ {
if (event.GetState() == GameState.Prepare) if (event.GetState() == GameState.Prepare)
{ {
UtilTextMiddle.display(C.cGreenB + "Get Ready", "Collect Snowballs!", 0, 60, 10, UtilServer.getPlayers()); UtilTextMiddle.display(C.cGreenB + "Get Ready", "Collect Snowballs!", 20, 60, 10, UtilServer.getPlayers());
} }
else if (event.GetState() == GameState.Live) else if (event.GetState() == GameState.Live)
{ {
@ -254,7 +255,7 @@ public class SnowFight extends TeamGame
if (damagee != null) if (damagee != null)
{ {
_lastDamage.put(damagee, System.currentTimeMillis()); _lastDamage.put(damagee, System.currentTimeMillis());
damagee.removePotionEffect(PotionEffectType.REGENERATION); Manager.GetCondition().EndCondition(damagee, ConditionType.REGENERATION, CONDITION_REASON);
} }
Player shooter = (Player) projectile.getShooter(); Player shooter = (Player) projectile.getShooter();
@ -267,7 +268,7 @@ public class SnowFight extends TeamGame
if (_blizzard) if (_blizzard)
{ {
UtilPlayer.hunger(shooter, 2); UtilPlayer.hunger(shooter, 4);
} }
} }
@ -296,10 +297,10 @@ public class SnowFight extends TeamGame
} }
else if (UtilTime.elapsed(GetStateTime(), _blizzardTime)) else if (UtilTime.elapsed(GetStateTime(), _blizzardTime))
{ {
List<Player> alive = GetPlayers(true);
if (!_blizzard) if (!_blizzard)
{ {
List<Player> alive = GetPlayers(true);
Announce(F.main("Game", F.color("Blizzard", C.cRedB) + " incoming! Attack players to restore hunger.")); Announce(F.main("Game", F.color("Blizzard", C.cRedB) + " incoming! Attack players to restore hunger."));
UtilTextMiddle.display(C.cRedB + "Blizzard", "Attack players to restore hunger", 0, 40, 10, alive.toArray(new Player[0])); UtilTextMiddle.display(C.cRedB + "Blizzard", "Attack players to restore hunger", 0, 40, 10, alive.toArray(new Player[0]));
HungerSet = -1; HungerSet = -1;
@ -307,7 +308,7 @@ public class SnowFight extends TeamGame
_blizzard = true; _blizzard = true;
} }
GetPlayers(true).forEach(player -> alive.forEach(player ->
{ {
if (player.getFoodLevel() == 0) if (player.getFoodLevel() == 0)
{ {
@ -317,7 +318,7 @@ public class SnowFight extends TeamGame
); );
} }
player.setSaturation(0); UtilPlayer.hunger(player, -1);
}); });
} }
} }
@ -371,13 +372,13 @@ public class SnowFight extends TeamGame
if (_blizzard) if (_blizzard)
{ {
player.removePotionEffect(PotionEffectType.REGENERATION); Manager.GetCondition().EndCondition(player, ConditionType.REGENERATION, CONDITION_REASON);
return true; return true;
} }
if (UtilTime.elapsed(lastDamage, COMBAT_TIME) && !player.hasPotionEffect(PotionEffectType.REGENERATION)) if (UtilTime.elapsed(lastDamage, COMBAT_TIME))
{ {
player.addPotionEffect(REGENERATION); Manager.GetCondition().Factory().Regen(CONDITION_REASON, player, player, 10, 1, false, false, true);
} }
return !IsAlive(player); return !IsAlive(player);

View File

@ -1,49 +1,52 @@
package nautilus.game.arcade.game.games.snowfight.kits; package nautilus.game.arcade.game.games.snowfight.kits;
import mineplex.core.common.util.C; import java.util.concurrent.TimeUnit;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.potion.Potion; import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionType; import org.bukkit.potion.PotionType;
public class KitMedic extends ProgressingKit import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitMedic extends KitSnowFight
{ {
private final Potion POTION = new Potion(PotionType.INSTANT_HEAL).splash(); private static final Potion POTION = new Potion(PotionType.INSTANT_HEAL).splash();
private static final long COOLDOWN = TimeUnit.SECONDS.toMillis(12);
private static final String[] DESCRIPTION = { private static final String[] DESCRIPTION =
"Throw warmth potions to heal allies!", {
ChatColor.RESET + " ", "Throw warmth potions to heal allies!",
C.cWhite + "Receive" + C.cGreen + " 1 " + C.cWhite + "Warmth Potion every" + C.cGreen + " 16 seconds. Maximum of 1.", C.blankLine,
}; C.cWhite + receiveItem("Warmth Potion", 1, 12, 1)
};
private static final Perk[] PERKS = {}; private static final Perk[] PERKS = {};
private static final ItemStack IN_HAND = new ItemStack(Material.POTION); private static final ItemStack IN_HAND = new ItemStack(Material.POTION);
private static final ItemStack[] PLAYER_ITEMS = { static
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"), {
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"), POTION.setLevel(2);
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"), }
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew")
};
public KitMedic(ArcadeManager manager) public KitMedic(ArcadeManager manager)
{ {
super(manager, "Medic", "snowfightmedic", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); super(manager, "Medic", "snowfightmedic", KitAvailability.Free, DESCRIPTION, PERKS, IN_HAND);
} }
@Override @Override
@ -51,53 +54,51 @@ public class KitMedic extends ProgressingKit
{ {
player.getInventory().setItem(1, getPotion()); player.getInventory().setItem(1, getPotion());
for (int i = 0; i < PLAYER_ITEMS.length; i++) super.GiveItems(player);
{
player.getInventory().setItem(i + 2, PLAYER_ITEMS[i]);
}
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
} }
@EventHandler @EventHandler
public void KitItems(UpdateEvent event) public void kitItems(UpdateEvent event)
{ {
if(!Manager.GetGame().IsLive()) if (event.getType() != UpdateType.SEC || !Manager.GetGame().InProgress())
return;
if (event.getType() == UpdateType.SLOWER)
{ {
for (Player player : Manager.GetGame().GetPlayers(true)) return;
{ }
if (!HasKit(player))
{
continue;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (HasKit(player) && !player.getInventory().contains(Material.POTION) && Recharge.Instance.usable(player, GetName()))
{
player.getInventory().setItem(1, getPotion()); player.getInventory().setItem(1, getPotion());
} }
} }
} }
@EventHandler
public void playerInteract(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
Player player = event.getPlayer();
ItemStack itemStack = player.getItemInHand();
if (itemStack == null || itemStack.getType() != Material.POTION || !HasKit(player))
{
return;
}
Recharge.Instance.useForce(player, GetName(), COOLDOWN);
}
private ItemStack getPotion() private ItemStack getPotion()
{ {
ItemStack stack = POTION.toItemStack(1); ItemStack stack = POTION.toItemStack(1);
ItemMeta meta = stack.getItemMeta(); ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(ChatColor.RESET + "Warmth Potion"); meta.setDisplayName(C.cYellow + "Warmth Potion");
stack.setItemMeta(meta); stack.setItemMeta(meta);
return stack; return stack;
} }
@Override
public boolean usesXp()
{
return false;
}
} }

View File

@ -0,0 +1,58 @@
package nautilus.game.arcade.game.games.snowfight.kits;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
class KitSnowFight extends ProgressingKit
{
private static final ItemStack[] ARMOUR =
{
new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.RED).build(),
new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.RED).build(),
new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.RED).build(),
new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.RED).build()
};
private static final ItemStack WINTER_STEW = new ItemBuilder(Material.MUSHROOM_SOUP)
.setTitle(C.cYellow + "Hearty Winter Strew")
.build();
KitSnowFight(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, ItemStack itemInHand)
{
super(manager, name, internalName, kitAvailability, kitDesc, kitPerks, EntityType.ZOMBIE, itemInHand);
}
@Override
public void GiveItems(Player player)
{
for (int i = 2; i < 5; i++)
{
player.getInventory().setItem(i, WINTER_STEW);
}
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setArmorContents(ARMOUR);
}
@Override
public boolean usesXp()
{
return false;
}
}

View File

@ -1,67 +1,39 @@
package nautilus.game.arcade.game.games.snowfight.kits; package nautilus.game.arcade.game.games.snowfight.kits;
import mineplex.core.itemstack.ItemStackFactory; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkFallDamage; import nautilus.game.arcade.kit.perks.PerkFallDamage;
import nautilus.game.arcade.kit.perks.PerkSpeed; import nautilus.game.arcade.kit.perks.PerkSpeed;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitSportsman extends ProgressingKit public class KitSportsman extends KitSnowFight
{ {
private static final String[] DESCRIPTION = { private static final String[] DESCRIPTION =
"Trained to be the fastest on snow and ice.", {
}; "Trained to be the fastest on snow and ice.",
C.blankLine,
C.cYellow + "Tap Jump Twice" + C.cWhite + " to " + C.cGreen + "Snow Jump",
};
private static final Perk[] PERKS = { private static final Perk[] PERKS =
new PerkSpeed(0), {
new PerkFallDamage(-2), new PerkSpeed(0),
new PerkDoubleJump("Snow Jump", 1, 0.8, true, 6000, true), new PerkFallDamage(-2),
}; new PerkDoubleJump("Snow Jump", 1, 0.8, true, 6000, true),
};
private static final ItemStack IN_HAND = new ItemStack(Material.SNOW_BALL); private static final ItemStack IN_HAND = new ItemStack(Material.SNOW_BALL);
private static final ItemStack[] PLAYER_ITEMS = {
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"),
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"),
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew")
};
public KitSportsman(ArcadeManager manager) public KitSportsman(ArcadeManager manager)
{ {
super(manager, "Sportsman", "snowfightsportsman", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); super(manager, "Sportsman", "snowfightsportsman", KitAvailability.Free, DESCRIPTION, PERKS, IN_HAND);
} }
@Override
public void GiveItems(Player player)
{
for (int i = 0; i < PLAYER_ITEMS.length; i++)
{
player.getInventory().setItem(i + 2, PLAYER_ITEMS[i]);
}
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
}
@Override
public boolean usesXp()
{
return false;
}
} }

View File

@ -1,68 +1,50 @@
package nautilus.game.arcade.game.games.snowfight.kits; package nautilus.game.arcade.game.games.snowfight.kits;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.monsterleague.perks.PerkStoneWall;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class KitTactician extends ProgressingKit import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.monsterleague.perks.PerkStoneWall;
import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitTactician extends KitSnowFight
{ {
private static final String[] DESCRIPTION = { private static final String[] DESCRIPTION =
"No Snowfight is complete without a tactical game!", {
}; "No Snowfight is complete without a tactical game!",
C.blankLine,
click(false, "Clay to construct a wall of Ice")
};
private static final Perk[] PERKS = { private static final Perk[] PERKS =
new PerkStoneWall("Ice Wall", Material.ICE, Material.CLAY_BALL), {
}; new PerkStoneWall("Ice Wall", Material.ICE, Material.CLAY_BALL),
};
private static final ItemStack IN_HAND = new ItemStack(Material.CLAY_BALL); private static final ItemStack IN_HAND = new ItemStack(Material.CLAY_BALL);
private static final ItemStack[] PLAYER_ITEMS = { private static final ItemStack PLAYER_ITEM = new ItemBuilder(Material.CLAY_BALL)
ItemStackFactory.Instance.CreateStack(Material.CLAY_BALL, (byte) 0, 1, ChatColor.RESET + "Ice Wall"), .setTitle(C.cYellow + "Ice Wall")
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"), .build();
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"),
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"),
};
public KitTactician(ArcadeManager manager) public KitTactician(ArcadeManager manager)
{ {
super(manager, "Tactician", "snowfighttactician", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); super(manager, "Tactician", "snowfighttactician", KitAvailability.Free, DESCRIPTION, PERKS, IN_HAND);
} }
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().setItem(1, PLAYER_ITEMS[0]); player.getInventory().setItem(1, PLAYER_ITEM);
player.getInventory().setItem(7, CompassModule.getCompassItem());
for (int i = 1; i < PLAYER_ITEMS.length - 1; i++) super.GiveItems(player);
{
player.getInventory().setItem(i + 2, PLAYER_ITEMS[i]);
}
player.getInventory().setItem(7, PLAYER_ITEMS[4]);
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
}
@Override
public boolean usesXp()
{
return false;
} }
} }

View File

@ -41,12 +41,18 @@ import nautilus.game.arcade.game.modules.compass.menu.CompassMenu;
public class CompassModule extends Module public class CompassModule extends Module
{ {
private static final ItemStack COMPASS_ITEM = private static final ItemStack COMPASS_ITEM =
new ItemBuilder(Material.COMPASS) new ItemBuilder(Material.COMPASS)
.setAmount(1) .setAmount(1)
.setTitle(C.cGreen + C.Bold + "Tracking Compass") .setTitle(C.cGreenB + "Tracking Compass")
.build(); .build();
public static ItemStack getCompassItem()
{
return COMPASS_ITEM;
}
private List<Supplier<Collection<CompassEntry>>> _suppliers = new ArrayList<>(); private List<Supplier<Collection<CompassEntry>>> _suppliers = new ArrayList<>();
private CompassMenu _compassMenu; private CompassMenu _compassMenu;