diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index 7af6ab2dd..07a2058c5 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -1025,14 +1025,15 @@ public class UtilEnt } // Nicer than doing entity.getMetadata(key).get(0); - public static Object GetMetadata(Entity entity, String key) + @SuppressWarnings("unchecked") + public static T GetMetadata(Entity entity, String key) { if (!entity.hasMetadata(key)) { return null; } - return entity.getMetadata(key).get(0).value(); + return (T) entity.getMetadata(key).get(0).value(); } public static void removeMetadata(Entity entity, String key) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 33bb61aff..0439fa106 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -461,6 +461,15 @@ public enum Achievement new String[]{"Novice I", "Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, AchievementCategory.CASTLE_ASSAULT), + CASTLE_ASSAULT_ALCHEMIST_KIT("Alchemist", 0, + new String[]{"Castle Assault.AlchemistKitKills", "Castle Assault TDM.AlchemistKitKills"}, + new String[]{"Kill opponents while wearing the Alchemist Kit"}, + new int[][]{new int[]{0, 100, 500}, new int[]{0, 150, 750}, new int[]{0, 250, 1000}, new int[]{0, 500, 1500}, new int[]{0, 1000, 2500}, new int[]{0, 1500, 3500}, new int[]{0, 2000, 4500}, new int[]{0, 3000, 6000}, new int[]{0, 5000, 10000}, new int[]{0, 10000, 100000}}, + new int[]{50, 100, 250, 500, 1000, 1500, 3000, 5000, 10000, 20000}, + "Initiate", + new String[]{"Novice I", "Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, + AchievementCategory.CASTLE_ASSAULT), + CASTLE_ASSAULT_WINNER("Assault", 0, new String[]{"Castle Assault.Wins", "Castle Assault TDM.Wins"}, new String[]{"Win games of Castle Assault"}, diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/mounts/MountManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/mounts/MountManager.java index c0d55196d..0100cb175 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/mounts/MountManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/mounts/MountManager.java @@ -268,7 +268,7 @@ public class MountManager extends MiniDbClientPlugin { if (UtilEnt.GetMetadata(entry.getKey(), "DISMOUNT_TIME") != null) { - Long dismount = (Long) UtilEnt.GetMetadata(entry.getKey(), "DISMOUNT_TIME"); + Long dismount = UtilEnt.GetMetadata(entry.getKey(), "DISMOUNT_TIME"); if (UtilTime.elapsed(dismount.longValue(), MAX_TIME_DISMOUNTED)) { mountIterator.remove(); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java index e9158f679..f2d58351f 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java @@ -123,7 +123,6 @@ public class HubVisibilityManager extends MiniPlugin if (perspective == null || !perspective.isOnline() || online.length <= index) { - Bukkit.broadcastMessage("Done"); iterator.remove(); continue; } @@ -132,13 +131,8 @@ public class HubVisibilityManager extends MiniPlugin if (!perspective.equals(subject) && !shouldHide(subject)) { - Bukkit.broadcastMessage("Making visible " + subject.getName() + " for " + perspective.getName()); VisibilityManager.Instance.setVisibility(subject, true, perspective); } - else - { - Bukkit.broadcastMessage("Ignoring " + subject.getName() + " for " + perspective.getName()); - } _nextShownPlayer.put(perspective, ++index); } diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java index b8c09946c..d0bb8bc54 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java @@ -16,6 +16,8 @@ public enum GameType Build("Master Builders"), BuildMavericks("Mavericks Master Builders"), CastleSiege("Castle Siege"), + CastleAssault("Castle Assault"), + CastleAssaultTDM("Castle Assault TDM"), ChampionsTDM("Champions TDM", "Champions"), ChampionsDominate("Champions Domination", "Champions"), ChampionsCTF("Champions CTF", "Champions"), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssault.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssault.java index 9d651ad84..b8d2ea776 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssault.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssault.java @@ -14,6 +14,7 @@ import org.bukkit.ChatColor; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Chest; @@ -56,7 +57,6 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.material.Dispenser; import org.bukkit.material.MaterialData; import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.metadata.MetadataValue; import org.bukkit.util.Vector; import mineplex.core.Managers; @@ -97,6 +97,7 @@ import nautilus.game.arcade.game.games.castleassault.data.KillStreakData; import nautilus.game.arcade.game.games.castleassault.data.ObjectiveTNTSpawner; import nautilus.game.arcade.game.games.castleassault.data.TeamCrystal; import nautilus.game.arcade.game.games.castleassault.data.TeamKing; +import nautilus.game.arcade.game.games.castleassault.kits.KitAlchemist; import nautilus.game.arcade.game.games.castleassault.kits.KitArcher; import nautilus.game.arcade.game.games.castleassault.kits.KitDemolitionist; import nautilus.game.arcade.game.games.castleassault.kits.KitFighter; @@ -143,7 +144,7 @@ public class CastleAssault extends TeamGame super(manager, GameType.CastleAssault, new Kit[] { - //new KitAlchemist(manager), + new KitAlchemist(manager), new KitArcher(manager), new KitDemolitionist(manager), //new KitEnchanter(manager), @@ -233,7 +234,7 @@ public class CastleAssault extends TeamGame private void generateLoot() { { - _rangedGear.addLoot(new ItemStack(Material.BOW), 3); + _rangedGear.addLoot(new ItemStack(Material.EGG), 3, 5, 9); _rangedGear.addLoot(Material.ARROW, 3, 8, 16); } { @@ -246,7 +247,6 @@ public class CastleAssault extends TeamGame } { _potionGearRare.addLoot(new ItemBuilder(Material.POTION).setData((short)8193).build(), 2); - _potionGearRare.addLoot(new ItemBuilder(Material.POTION).setData((short)8195).build(), 2); } { _miscGear.addLoot(new ItemStack(Material.ENDER_PEARL), 2); @@ -956,7 +956,8 @@ public class CastleAssault extends TeamGame float radius = event.getRadius(); event.setRadius(0f); - Player player = UtilPlayer.searchExact(((MetadataValue)UtilEnt.GetMetadata(event.getEntity(), "THROWER")).asString()); + String thrower = UtilEnt.GetMetadata(event.getEntity(), "THROWER"); + Player player = UtilPlayer.searchExact(thrower); if (player == null) { return; @@ -1003,7 +1004,7 @@ public class CastleAssault extends TeamGame } blastProtEPF = Math.min(blastProtEPF, 20); - double damage = 8 * mult; + double damage = 10 * mult; damage = damage * (1 - (blastProtEPF / 25)); double knockbackReduction = 1 - (highestBlastProt * 0.15); @@ -1194,6 +1195,7 @@ public class CastleAssault extends TeamGame { if (Recharge.Instance.use(alert, "KingDamageAlert", 5000, false, false)) { + alert.playSound(alert.getLocation(), Sound.ANVIL_LAND, 10, 3); alert.sendMessage(king.getName(true) + " is under attack!"); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssaultTDM.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssaultTDM.java index 959288efe..e1401ca49 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssaultTDM.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssaultTDM.java @@ -46,7 +46,6 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.material.Dispenser; import org.bukkit.material.MaterialData; -import org.bukkit.metadata.MetadataValue; import mineplex.core.Managers; import mineplex.core.common.Pair; @@ -807,7 +806,8 @@ public class CastleAssaultTDM extends TeamGame float radius = event.getRadius(); event.setRadius(0f); - Player player = UtilPlayer.searchExact(((MetadataValue)UtilEnt.GetMetadata(event.getEntity(), "THROWER")).asString()); + String thrower = UtilEnt.GetMetadata(event.getEntity(), "THROWER"); + Player player = UtilPlayer.searchExact(thrower); if (player == null) { return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitAlchemist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitAlchemist.java index d42c40ae0..c0478f3ba 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitAlchemist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitAlchemist.java @@ -2,7 +2,12 @@ package nautilus.game.arcade.game.games.castleassault.kits; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.KitAvailability; @@ -12,21 +17,130 @@ public class KitAlchemist extends KitPlayer { public KitAlchemist(ArcadeManager manager) { - super(manager, "Alchemist", KitAvailability.Free, new String[] {}, new Perk[] {}, Material.POTION); + super(manager, "Alchemist", KitAvailability.Free, + new String[] + { + C.cWhiteB + "Starting Kit:", + C.cGray + "Diamond Sword", + C.cGray + "Diamond Helmet, Iron Chestplate, Iron Leggings, Diamond Boots", + C.cGray + "Speed I Potion", + C.cGreenB + "Passive Ability:", + C.cGreen + "Netherborne: Permanent Fire Resistance" + }, + new Perk[][] + { + new Perk[] {}, + new Perk[] {}, + new Perk[] {}, + new Perk[] {}, + new Perk[] {}, + new Perk[] {} + }, + new String[][] + { + { + C.cGray + "Receive a Regeneration II Potion" + }, + { + C.cGray + "Obtain a time extension on your Speed I Potion" + }, + { + C.cGray + "Obtain a time extension on your Regeneration II Potion" + }, + { + C.cGray + "Receive a Resistance I Potion" + }, + { + C.cGray + "Obtain a time extension on your Resistance I Potion" + } + }, + Material.POTION); } @Override public void GiveItems(Player player) { - player.getInventory().setItem(0, new ItemBuilder(Material.IRON_SWORD).setUnbreakable(true).build()); - player.getInventory().setItem(1, new ItemBuilder(Material.POTION).setData((short)8194).build()); - player.getInventory().setItem(2, new ItemBuilder(Material.POTION).setData((short)8193).build()); - player.getInventory().setHelmet(new ItemBuilder(Material.IRON_HELMET).setUnbreakable(true).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.IRON_CHESTPLATE).setUnbreakable(true).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).setUnbreakable(true).build()); - player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).setUnbreakable(true).build()); + giveRegeneration(player); + player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 100000, 0)); + + player.getInventory().setItem(0, new ItemBuilder(Material.DIAMOND_SWORD).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + + int level = getUpgradeLevel(player.getUniqueId()); + if (level == 0) + { + player.getInventory().setItem(1, new ItemBuilder(Material.POTION).setLore(C.cGold + "Kit Item").setData((short)8194).build()); + } + else if (level == 1) + { + player.getInventory().setItem(1, new ItemBuilder(Material.POTION).setLore(C.cGold + "Kit Item").setData((short)8194).build()); + player.getInventory().setItem(2, new ItemBuilder(Material.POTION).setLore(C.cGold + "Kit Item").setData((short)8225).build()); + } + else if (level == 2) + { + player.getInventory().setItem(1, new ItemBuilder(Material.POTION).setLore(C.cGold + "Kit Item").setData((short)8258).build()); + player.getInventory().setItem(2, new ItemBuilder(Material.POTION).setLore(C.cGold + "Kit Item").setData((short)8225).build()); + } + else if (level == 3) + { + player.getInventory().setItem(1, new ItemBuilder(Material.POTION).setLore(C.cGold + "Kit Item").setData((short)8258).build()); + player.getInventory().setItem(2, new ItemBuilder(Material.POTION).setLore(C.cGold + "Kit Item").setData((short)8289).build()); + } + else if (level == 4) + { + player.getInventory().setItem(1, new ItemBuilder(Material.POTION).setLore(C.cGold + "Kit Item").setData((short)8258).build()); + player.getInventory().setItem(2, new ItemBuilder(Material.POTION).setLore(C.cGold + "Kit Item").setData((short)8289).build()); + ItemStack item = new ItemBuilder(Material.POTION).setLore(C.cGold + "Kit Item").setData((short)8205).build(); + PotionMeta pm = (PotionMeta) item.getItemMeta(); + pm.clearCustomEffects(); + pm.addCustomEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 20 * 60, 0), true); + item.setItemMeta(pm); + player.getInventory().addItem(item); + } + else if (level == 5) + { + player.getInventory().setItem(1, new ItemBuilder(Material.POTION).setLore(C.cGold + "Kit Item").setData((short)8258).build()); + player.getInventory().setItem(2, new ItemBuilder(Material.POTION).setLore(C.cGold + "Kit Item").setData((short)8289).build()); + ItemStack item = new ItemBuilder(Material.POTION).setLore(C.cGold + "Kit Item").setData((short)8205).build(); + PotionMeta pm = (PotionMeta) item.getItemMeta(); + pm.clearCustomEffects(); + pm.addCustomEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 20 * 130, 0), true); + item.setItemMeta(pm); + player.getInventory().addItem(item); + } + + player.getInventory().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.IRON_CHESTPLATE).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); } @Override - public void awardKillStreak(Player player, int streak) {} + public void awardKillStreak(Player player, int streak) + { + if (streak == 2) + { + player.sendMessage(C.cRed + "You have received a Slowness I Splash Potion as a Kill Streak Reward!"); + player.getInventory().addItem(new ItemBuilder(Material.POTION).setData((short)16394).build()); + } + else if (streak == 4) + { + player.sendMessage(C.cRed + "You have received a Weakness I Splash Potion as a Kill Streak Reward!"); + player.getInventory().addItem(new ItemBuilder(Material.POTION).setData((short)16392).build()); + } + else if (streak == 6) + { + player.sendMessage(C.cRed + "You have received 4 Instant Damage II Splash Potions as a Kill Streak Reward!"); + player.getInventory().addItem(new ItemBuilder(Material.POTION, 4).setData((short)16428).build()); + } + else if (streak == 8) + { + player.sendMessage(C.cRed + "You have received a Regeneration III Potion as a Kill Streak Reward!"); + ItemStack item = new ItemBuilder(Material.POTION).setData((short)8193).build(); + PotionMeta pm = (PotionMeta) item.getItemMeta(); + pm.clearCustomEffects(); + pm.addCustomEffect(new PotionEffect(PotionEffectType.REGENERATION, 20 * 10, 2), true); + item.setItemMeta(pm); + player.getInventory().addItem(item); + } + } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitArcher.java index 94efc77d0..7aa25d439 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitArcher.java @@ -20,21 +20,22 @@ public class KitArcher extends KitPlayer super(manager, "Archer", KitAvailability.Free, new String[] { - C.cGrayB + "Starting Kit:", + C.cWhiteB + "Starting Kit:", C.cGray + "Diamond Sword", + C.cGray + "Bow", C.cGray + "Diamond Helmet, Iron Chestplate, Iron Leggings, Diamond Boots", C.cGray + "10 Fletched Arrows", C.cGreenB + "Starting Ability:", - C.cGreen + "Fletcher: Obtain 1 Fletched Arrow every 7 seconds (Max of 10)" + C.cGreen + "Fletcher: Obtain 1 Fletched Arrow every 6 seconds (Max of 10)" }, new Perk[][] { - new Perk[] {new PerkFletcher(7, 10, true, false)}, - new Perk[] {new PerkFletcher(7, 16, true, false)}, - new Perk[] {new PerkFletcher(7, 24, true, false)}, - new Perk[] {new PerkFletcher(7, 32, true, false)}, - new Perk[] {new PerkFletcher(7, 32, true, false)}, - new Perk[] {new PerkFletcher(7, 32, true, false)} + new Perk[] {new PerkFletcher(6, 10, true, false)}, + new Perk[] {new PerkFletcher(6, 16, true, false)}, + new Perk[] {new PerkFletcher(6, 24, true, false)}, + new Perk[] {new PerkFletcher(6, 32, true, false)}, + new Perk[] {new PerkFletcher(6, 32, true, false)}, + new Perk[] {new PerkFletcher(6, 32, true, false)} }, new String[][] { @@ -43,7 +44,8 @@ public class KitArcher extends KitPlayer }, { C.cGray + "Increase maximum and starting amount of Fletched Arrows to 24", - C.cGray + "Obtain a Power I Enchantment on your Bow" + C.cGray + "Obtain a Power I Enchantment on your Bow", + C.cGray + "Receive a Feather Falling II Enchantment on your Diamond Boots" }, { C.cGray + "Increase maximum and starting amount of Fletched Arrows to 32", @@ -100,10 +102,14 @@ public class KitArcher extends KitPlayer player.getInventory().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setChestplate(new ItemBuilder(Material.IRON_CHESTPLATE).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - if (level < 5) + if (level < 2) { player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); } + else if (level < 5) + { + player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_FALL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + } else { player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_FALL, 4).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); @@ -115,23 +121,24 @@ public class KitArcher extends KitPlayer { if (streak == 2) { - player.sendMessage(C.cRedB + "You have received 8 Arrows as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received 8 Arrows as a Kill Streak Reward!"); player.getInventory().addItem(new ItemBuilder(Material.ARROW).setAmount(8).setTitle(F.item("Fletched Arrow")).build()); } else if (streak == 4) { - player.sendMessage(C.cRedB + "You have received 12 Arrows as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received 12 Arrows as a Kill Streak Reward!"); player.getInventory().addItem(new ItemBuilder(Material.ARROW).setAmount(12).setTitle(F.item("Fletched Arrow")).build()); } else if (streak == 6) { - player.sendMessage(C.cRedB + "You have received a Punch I book as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received a Punch I book as a Kill Streak Reward!"); player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_KNOCKBACK, 1).build()); } else if (streak == 8) { - player.sendMessage(C.cRedB + "You have received 32 Arrows as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received 32 Arrows and a Flame I book as a Kill Streak Reward!"); player.getInventory().addItem(new ItemBuilder(Material.ARROW).setAmount(32).setTitle(F.item("Fletched Arrow")).build()); + player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_FIRE, 1).build()); } } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitDemolitionist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitDemolitionist.java index 5af012192..648fd93f0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitDemolitionist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitDemolitionist.java @@ -19,7 +19,7 @@ public class KitDemolitionist extends KitPlayer super(manager, "Demolitionist", KitAvailability.Free, new String[] { - C.cGrayB + "Starting Kit:", + C.cWhiteB + "Starting Kit:", C.cGray + "Diamond Sword, Flint and Steel", C.cGray + "Diamond Helmet, Iron Chestplate, Iron Leggings, Diamond Boots", C.cGray + "Blast Protection IV on all Armor", @@ -130,23 +130,24 @@ public class KitDemolitionist extends KitPlayer { if (streak == 2) { - player.sendMessage(C.cRedB + "You have received 2 Throwing TNT as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received 2 Throwing TNT as a Kill Streak Reward!"); player.getInventory().addItem(new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).setAmount(2).build()); } else if (streak == 4) { - player.sendMessage(C.cRedB + "You have received 3 Throwing TNT as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received 3 Throwing TNT as a Kill Streak Reward!"); player.getInventory().addItem(new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).setAmount(3).build()); } else if (streak == 6) { - player.sendMessage(C.cRedB + "You have received 4 Throwing TNT as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received 4 Throwing TNT as a Kill Streak Reward!"); player.getInventory().addItem(new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).setAmount(4).build()); } else if (streak == 8) { - player.sendMessage(C.cRedB + "You have received 5 Throwing TNT as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received 5 Throwing TNT and a 30-Use Flint and Steel as a Kill Streak Reward!"); player.getInventory().addItem(new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).setAmount(5).build()); + player.getInventory().addItem(new ItemBuilder(Material.FLINT_AND_STEEL).setData((short) (Material.FLINT_AND_STEEL.getMaxDurability() - 30)).build()); } } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitFighter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitFighter.java index 986bfb915..119380430 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitFighter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitFighter.java @@ -18,11 +18,11 @@ public class KitFighter extends KitPlayer super(manager, "Fighter", KitAvailability.Free, new String[] { - C.cGrayB + "Starting Kit:", + C.cWhiteB + "Starting Kit:", C.cGray + "Diamond Sword", C.cGray + "1 Golden Applegate", C.cGray + "Diamond Helmet, Iron Chestplate, Iron Leggings, Diamond Boots", - C.cGreenB + "Passive Ability:", + C.cGreenB + "Starting Ability:", C.cGreen + "Bloodlust: Deal half a heart more damage for 3 seconds after killing an enemy" }, new Perk[][] @@ -32,7 +32,7 @@ public class KitFighter extends KitPlayer new Perk[] {new PerkBloodlust(1, 3)}, new Perk[] {new PerkBloodlust(1, 3)}, new Perk[] {new PerkBloodlust(1, 3)}, - new Perk[] {new PerkBloodlust(1, 3)} + new Perk[] {new PerkBloodlust(1, 5)} }, new String[][] { @@ -50,7 +50,7 @@ public class KitFighter extends KitPlayer C.cGray + "Increase starting amount of Golden Applegates to 3" }, { - C.cGray + "Obtain a Sharpness II Enchantment on your Diamond Sword" + C.cGray + "Increase duration of Bloodlust to 5 seconds" } }, Material.DIAMOND_SWORD); @@ -92,7 +92,7 @@ public class KitFighter extends KitPlayer } else if (level == 5) { - player.getInventory().setItem(0, new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + player.getInventory().setItem(0, new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 1).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setItem(1, new ItemBuilder(Material.FISHING_ROD).addEnchantment(Enchantment.KNOCKBACK, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setItem(2, new ItemBuilder(Material.GOLDEN_APPLE).setAmount(3).setTitle(C.cPurple + "Golden Applegate").build()); } @@ -108,22 +108,22 @@ public class KitFighter extends KitPlayer { if (streak == 2) { - player.sendMessage(C.cRedB + "You have received a Golden Applegate as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received a Golden Applegate as a Kill Streak Reward!"); player.getInventory().addItem(new ItemBuilder(Material.GOLDEN_APPLE).setAmount(1).setTitle(C.cPurple + "Golden Applegate").build()); } else if (streak == 4) { - player.sendMessage(C.cRedB + "You have received a Splash Healing II Potion as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received a Healing II Splash Potion as a Kill Streak Reward!"); player.getInventory().addItem(new ItemBuilder(Material.POTION).setData((short)16421).build()); } else if (streak == 6) { - player.sendMessage(C.cRedB + "You have received a Speed II Potion as a Kill Streak Reward!"); - player.getInventory().addItem(new ItemBuilder(Material.POTION).setData((short)8290).build()); + player.sendMessage(C.cRed + "You have received a Speed II Potion as a Kill Streak Reward!"); + player.getInventory().addItem(new ItemBuilder(Material.POTION).setData((short)8226).build()); } else if (streak == 8) { - player.sendMessage(C.cRedB + "You have received a Fire Aspect I book as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received a Fire Aspect I book as a Kill Streak Reward!"); player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.FIRE_ASPECT, 1).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitPlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitPlayer.java index ac445dd49..ad992cb7c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitPlayer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitPlayer.java @@ -39,7 +39,9 @@ public abstract class KitPlayer extends ProgressingKit protected void giveRegeneration(Player player) { - player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 20 * 5, 3)); + player.getActivePotionEffects().forEach(p -> player.removePotionEffect(p.getType())); + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 20 * 8, 4)); + player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 20 * 8, 3)); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitTank.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitTank.java index c6b01406f..a98498e57 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitTank.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitTank.java @@ -22,10 +22,10 @@ public class KitTank extends KitPlayer super(manager, "Tank", KitAvailability.Free, new String[] { - C.cGrayB + "Starting Kit:", + C.cWhiteB + "Starting Kit:", C.cGray + "Diamond Sword", C.cGray + "Diamond Helmet, Iron Chestplate, Iron Leggings, Diamond Boots", - C.cGray + "Protection I on Iron Armor" + C.cGray + "Protection I on Iron Chestplace" }, new Perk[][] { @@ -39,21 +39,19 @@ public class KitTank extends KitPlayer new String[][] { { - C.cGray + "Obtain a Protection II Enchantment on your Iron Armor" + C.cGray + "Obtain a Protection I Enchantment on your Iron Leggings" + }, + { + C.cGray + "Obtain a Protection II Enchantment on your Iron Chestplate" + }, + { + C.cGray + "Obtain a Protection II Enchantment on your Iron Leggings" }, { C.cGray + "Obtain a Protection I Enchantment on your Diamond Helmet" }, { C.cGray + "Obtain a Protection I Enchantment on your Diamond Boots" - }, - { - C.cGray + "Obtain a Protection II Enchantment on your Diamond Helmet", - C.cGray + "Obtain a Protection II Enchantment on your Diamond Boots" - }, - { - C.cGray + "Obtain a Protection III Enchantment on your Iron Chestplate", - C.cGray + "Obtain a Protection III Enchantment on your Iron Leggings" } }, Material.DIAMOND_CHESTPLATE); @@ -71,44 +69,44 @@ public class KitTank extends KitPlayer { player.getInventory().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setChestplate(new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); } else if (level == 1) + { + player.getInventory().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + } + else if (level == 2) + { + player.getInventory().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); + } + else if (level == 3) { player.getInventory().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setChestplate(new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); } - else if (level == 2) + else if (level == 4) { player.getInventory().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setChestplate(new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); } - else if (level == 3) + else if (level == 5) { player.getInventory().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setChestplate(new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); } - else if (level == 4) - { - player.getInventory().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - } - else if (level == 5) - { - player.getInventory().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - } } @Override @@ -116,17 +114,17 @@ public class KitTank extends KitPlayer { if (streak == 2) { - player.sendMessage(C.cRedB + "You have received a Golden Applegate as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received a Golden Applegate as a Kill Streak Reward!"); player.getInventory().addItem(new ItemBuilder(Material.GOLDEN_APPLE).setAmount(1).setTitle(C.cPurple + "Golden Applegate").build()); } else if (streak == 4) { - player.sendMessage(C.cRedB + "You have received a Regeneration II Potion as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received a Regeneration II Potion as a Kill Streak Reward!"); player.getInventory().addItem(new ItemBuilder(Material.POTION).setData((short)8289).build()); } else if (streak == 6) { - player.sendMessage(C.cRedB + "You have received a Resistance I Potion as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received a Resistance I Potion as a Kill Streak Reward!"); ItemStack item = new ItemBuilder(Material.POTION).setData((short)8205).build(); PotionMeta pm = (PotionMeta) item.getItemMeta(); pm.clearCustomEffects(); @@ -136,7 +134,7 @@ public class KitTank extends KitPlayer } else if (streak == 8) { - player.sendMessage(C.cRedB + "You have received a Thorns II book as a Kill Streak Reward!"); + player.sendMessage(C.cRed + "You have received a Thorns II book as a Kill Streak Reward!"); player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.THORNS, 2).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/PerkBloodlust.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/PerkBloodlust.java index 9dc21c017..2fc724eef 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/PerkBloodlust.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/PerkBloodlust.java @@ -27,7 +27,7 @@ public class PerkBloodlust extends Perk public PerkBloodlust(double damageBoost, int duration) { super("Bloodlust", - new String[] + new String[] { C.cGray + "Deal an extra " + (damageBoost / 2) + " hearts of damage for " + duration + " seconds after a kill.", } @@ -92,7 +92,7 @@ public class PerkBloodlust extends Perk Bukkit.getScheduler().cancelTask(id.intValue()); } - player.sendMessage(C.cRed + "You are now channeling bloodlust for 3 seconds!"); + player.sendMessage(C.cRed + "You are now channeling bloodlust for " + _duration + " seconds!"); _lusting.put(player, Bukkit.getScheduler().runTaskLater(UtilServer.getPlugin(), () -> _lusting.remove(player), _duration * 20).getTaskId()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java index a4910c2bd..e35238b84 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java @@ -285,15 +285,18 @@ public class Moba extends TeamGame setKits(_kits); // Store player data - for (Player player : GetPlayers(true)) - { - _playerData.add(new MobaPlayer(player)); - MobaUtil.setTeamEntity(player, GetTeam(player)); - } + GetPlayers(true).forEach(this::setupPlayerData); + // Make sure to cleanup cleanupLobby(); } + public void setupPlayerData(Player player) + { + _playerData.add(new MobaPlayer(player)); + MobaUtil.setTeamEntity(player, GetTeam(player)); + } + @EventHandler public void preventOverfill(PlayerPrepareTeleportEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/MobaClassic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/MobaClassic.java index 1d0cf535b..853488d6d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/MobaClassic.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/MobaClassic.java @@ -10,7 +10,6 @@ import nautilus.game.arcade.game.games.moba.general.HotJoiningManager; import nautilus.game.arcade.game.games.moba.prepare.PrepareManager; import nautilus.game.arcade.game.games.moba.prepare.PrepareSelection; import nautilus.game.arcade.game.modules.CustomScoreboardModule; -import nautilus.game.arcade.game.modules.GameStatisticsModule; import nautilus.game.arcade.scoreboard.GameScoreboard; import org.bukkit.ChatColor; import org.bukkit.entity.LivingEntity; @@ -98,7 +97,7 @@ public class MobaClassic extends Moba { suffix = C.cYellow + " Unknown"; } - else if (mobaPlayer.getKit() == null) + else if (mobaPlayer == null || mobaPlayer.getKit() == null) { suffix = C.cYellow + " Selecting"; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/buff/BuffManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/buff/BuffManager.java index 66ce3aba8..c89e1fe11 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/buff/BuffManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/buff/BuffManager.java @@ -4,6 +4,8 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -36,25 +38,7 @@ public class BuffManager implements Listener _buffs.get(buff.getEntity()).add(buff); buff.apply(); } - - public boolean hasBuff(LivingEntity entity, Class> clazz) - { - if (!_buffs.containsKey(entity)) - { - return false; - } - - for (Buff buff : _buffs.get(entity)) - { - if (buff.getClass().equals(clazz)) - { - return true; - } - } - - return false; - } - + @EventHandler public void update(UpdateEvent event) { @@ -91,4 +75,15 @@ public class BuffManager implements Listener } } } + + @EventHandler + public void end(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + { + return; + } + + _buffs.forEach((livingEntity, buffs) -> buffs.forEach(Buff::expire)); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/general/HotJoiningManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/general/HotJoiningManager.java index cd02401a9..f413cd84b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/general/HotJoiningManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/general/HotJoiningManager.java @@ -1,21 +1,26 @@ package nautilus.game.arcade.game.games.moba.general; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilTime; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.moba.Moba; +import nautilus.game.arcade.game.games.moba.kit.HeroSkill; import nautilus.game.arcade.game.games.moba.progression.MobaExperienceCalculateEvent; import nautilus.game.arcade.game.games.moba.structure.tower.Tower; import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.Perk; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; import java.util.ArrayList; import java.util.List; +import java.util.UUID; public class HotJoiningManager implements Listener { @@ -23,18 +28,22 @@ public class HotJoiningManager implements Listener private static final int HOT_JOIN_EXP_REWARD = 100; private final Moba _host; + private final List _pending; private final List _hotJoined; + private final List _played; public HotJoiningManager(Moba host) { _host = host; + _pending = new ArrayList<>(); _hotJoined = new ArrayList<>(); + _played = new ArrayList<>(8); } - @EventHandler(priority = EventPriority.MONITOR) - public void playerJoin(PlayerJoinEvent event) + @EventHandler(priority = EventPriority.LOWEST) + public void playerLogin(PlayerLoginEvent event) { - if (!_host.IsLive()) + if (!_host.IsLive() || !_host.getArcadeManager().IsRewardStats()) { return; } @@ -42,11 +51,36 @@ public class HotJoiningManager implements Listener Player player = event.getPlayer(); GameTeam team = _host.ChooseTeam(player); - if (team == null || _host.getArcadeManager().isVanished(player)) + if (team == null || team.GetSize() >= 4) { return; } + _pending.add(player); + team.AddPlayer(player, true); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void playerJoin(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + + if (!_pending.remove(player)) + { + return; + } + + GameTeam team = _host.GetTeam(player); + + if (_host.getArcadeManager().isVanished(player)) + { + if (team != null) + { + team.RemovePlayer(player); + } + return; + } + for (Tower tower : _host.getTowerManager().getTowers()) { // If the team's second tower is dead @@ -57,16 +91,34 @@ public class HotJoiningManager implements Listener } } - team.AddPlayer(player, true); + boolean played = _played.contains(player.getUniqueId()); + team.SpawnTeleport(player); - _hotJoined.add(player); + + if (!played) + { + _hotJoined.add(player); + } + + _host.setupPlayerData(player); _host.getArcadeManager().runSyncLater(() -> { Kit kit = _host.getFirstKit(player); - player.sendMessage(F.main("Game", "Thanks for choosing to join a game in progress! If you stay until the end of the game you will earn an additional " + HOT_JOIN_EXP_REWARD + " experience points")); + if (!played) + { + player.sendMessage(F.main("Game", "Thanks for choosing to join a game in progress! If you stay until the end of the game you will were an additional " + F.elem(HOT_JOIN_EXP_REWARD) + " " + F.greenElem("Heroes of GWEN Role") + " experience.")); + } _host.SetKit(player, kit, true); + + Perk perk = kit.GetPerks()[kit.GetPerks().length - 1]; + + // Put Ultimates on cooldown + if (perk instanceof HeroSkill) + { + ((HeroSkill) perk).useSkill(player); + } }, 1); } @@ -74,9 +126,21 @@ public class HotJoiningManager implements Listener public void playerQuit(PlayerQuitEvent event) { Player player = event.getPlayer(); + _pending.remove(player); _hotJoined.remove(player); } + @EventHandler + public void live(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + { + return; + } + + _host.GetPlayers(true).forEach(player -> _played.add(player.getUniqueId())); + } + @EventHandler public void expCalculate(MobaExperienceCalculateEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/devon/SkillInfinity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/devon/SkillInfinity.java index 6097e9a28..753b4d324 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/devon/SkillInfinity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/devon/SkillInfinity.java @@ -50,7 +50,7 @@ public class SkillInfinity extends HeroSkill @EventHandler public void interact(PlayerInteractEvent event) { - if (!isSkillItem(event) || _active.contains(event.getPlayer())) + if (!isSkillItem(event)) { return; } @@ -66,13 +66,11 @@ public class SkillInfinity extends HeroSkill // Give 1 arrow just incase the player didn't have one _kit.giveAmmo(player, 1); bow.addEnchantment(Enchantment.ARROW_INFINITE, 1); - _active.add(player); broadcast(player); useActiveSkill(() -> { bow.removeEnchantment(Enchantment.ARROW_INFINITE); - _active.remove(player); }, player, 7000); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java index 6b8b00e34..224ee61bc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java @@ -26,7 +26,6 @@ import nautilus.game.arcade.game.games.moba.shop.hunter.MobaHunterShop; import nautilus.game.arcade.game.games.moba.shop.mage.MobaMageShop; import nautilus.game.arcade.game.games.moba.shop.warrior.MobaWarriorShop; import nautilus.game.arcade.game.games.moba.util.MobaConstants; -import nautilus.game.arcade.kit.Kit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; @@ -249,6 +248,7 @@ public class MobaShop implements Listener public List getOwnedItems(Player player) { + _upgrades.putIfAbsent(player, new ArrayList<>()); return _upgrades.get(player); } @@ -329,20 +329,6 @@ public class MobaShop implements Listener Handle MobaItem events */ - @EventHandler - public void prepare(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Prepare) - { - return; - } - - for (Player player : _host.GetPlayers(true)) - { - _upgrades.put(player, new ArrayList<>()); - } - } - @EventHandler public void ammoGive(AmmoGiveEvent event) {