Merge remote-tracking branch 'refs/remotes/origin/develop' into bugfix/moba-training

This commit is contained in:
Sam 2017-07-27 12:33:09 +01:00
commit ebd9986542
20 changed files with 317 additions and 142 deletions

View File

@ -1025,14 +1025,15 @@ public class UtilEnt
} }
// Nicer than doing entity.getMetadata(key).get(0); // Nicer than doing entity.getMetadata(key).get(0);
public static Object GetMetadata(Entity entity, String key) @SuppressWarnings("unchecked")
public static <T> T GetMetadata(Entity entity, String key)
{ {
if (!entity.hasMetadata(key)) if (!entity.hasMetadata(key))
{ {
return null; 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) public static void removeMetadata(Entity entity, String key)

View File

@ -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"}, new String[]{"Novice I", "Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"},
AchievementCategory.CASTLE_ASSAULT), 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, CASTLE_ASSAULT_WINNER("Assault", 0,
new String[]{"Castle Assault.Wins", "Castle Assault TDM.Wins"}, new String[]{"Castle Assault.Wins", "Castle Assault TDM.Wins"},
new String[]{"Win games of Castle Assault"}, new String[]{"Win games of Castle Assault"},

View File

@ -268,7 +268,7 @@ public class MountManager extends MiniDbClientPlugin<MountOwnerData>
{ {
if (UtilEnt.GetMetadata(entry.getKey(), "DISMOUNT_TIME") != null) 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)) if (UtilTime.elapsed(dismount.longValue(), MAX_TIME_DISMOUNTED))
{ {
mountIterator.remove(); mountIterator.remove();

View File

@ -123,7 +123,6 @@ public class HubVisibilityManager extends MiniPlugin
if (perspective == null || !perspective.isOnline() || online.length <= index) if (perspective == null || !perspective.isOnline() || online.length <= index)
{ {
Bukkit.broadcastMessage("Done");
iterator.remove(); iterator.remove();
continue; continue;
} }
@ -132,13 +131,8 @@ public class HubVisibilityManager extends MiniPlugin
if (!perspective.equals(subject) && !shouldHide(subject)) if (!perspective.equals(subject) && !shouldHide(subject))
{ {
Bukkit.broadcastMessage("Making visible " + subject.getName() + " for " + perspective.getName());
VisibilityManager.Instance.setVisibility(subject, true, perspective); VisibilityManager.Instance.setVisibility(subject, true, perspective);
} }
else
{
Bukkit.broadcastMessage("Ignoring " + subject.getName() + " for " + perspective.getName());
}
_nextShownPlayer.put(perspective, ++index); _nextShownPlayer.put(perspective, ++index);
} }

View File

@ -16,6 +16,8 @@ public enum GameType
Build("Master Builders"), Build("Master Builders"),
BuildMavericks("Mavericks Master Builders"), BuildMavericks("Mavericks Master Builders"),
CastleSiege("Castle Siege"), CastleSiege("Castle Siege"),
CastleAssault("Castle Assault"),
CastleAssaultTDM("Castle Assault TDM"),
ChampionsTDM("Champions TDM", "Champions"), ChampionsTDM("Champions TDM", "Champions"),
ChampionsDominate("Champions Domination", "Champions"), ChampionsDominate("Champions Domination", "Champions"),
ChampionsCTF("Champions CTF", "Champions"), ChampionsCTF("Champions CTF", "Champions"),

View File

@ -14,6 +14,7 @@ import org.bukkit.ChatColor;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest; import org.bukkit.block.Chest;
@ -56,7 +57,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Dispenser; import org.bukkit.material.Dispenser;
import org.bukkit.material.MaterialData; import org.bukkit.material.MaterialData;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.Managers; 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.ObjectiveTNTSpawner;
import nautilus.game.arcade.game.games.castleassault.data.TeamCrystal; 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.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.KitArcher;
import nautilus.game.arcade.game.games.castleassault.kits.KitDemolitionist; import nautilus.game.arcade.game.games.castleassault.kits.KitDemolitionist;
import nautilus.game.arcade.game.games.castleassault.kits.KitFighter; import nautilus.game.arcade.game.games.castleassault.kits.KitFighter;
@ -143,7 +144,7 @@ public class CastleAssault extends TeamGame
super(manager, GameType.CastleAssault, super(manager, GameType.CastleAssault,
new Kit[] new Kit[]
{ {
//new KitAlchemist(manager), new KitAlchemist(manager),
new KitArcher(manager), new KitArcher(manager),
new KitDemolitionist(manager), new KitDemolitionist(manager),
//new KitEnchanter(manager), //new KitEnchanter(manager),
@ -233,7 +234,7 @@ public class CastleAssault extends TeamGame
private void generateLoot() 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); _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)8193).build(), 2);
_potionGearRare.addLoot(new ItemBuilder(Material.POTION).setData((short)8195).build(), 2);
} }
{ {
_miscGear.addLoot(new ItemStack(Material.ENDER_PEARL), 2); _miscGear.addLoot(new ItemStack(Material.ENDER_PEARL), 2);
@ -956,7 +956,8 @@ public class CastleAssault extends TeamGame
float radius = event.getRadius(); float radius = event.getRadius();
event.setRadius(0f); 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) if (player == null)
{ {
return; return;
@ -1003,7 +1004,7 @@ public class CastleAssault extends TeamGame
} }
blastProtEPF = Math.min(blastProtEPF, 20); blastProtEPF = Math.min(blastProtEPF, 20);
double damage = 8 * mult; double damage = 10 * mult;
damage = damage * (1 - (blastProtEPF / 25)); damage = damage * (1 - (blastProtEPF / 25));
double knockbackReduction = 1 - (highestBlastProt * 0.15); double knockbackReduction = 1 - (highestBlastProt * 0.15);
@ -1194,6 +1195,7 @@ public class CastleAssault extends TeamGame
{ {
if (Recharge.Instance.use(alert, "KingDamageAlert", 5000, false, false)) 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!"); alert.sendMessage(king.getName(true) + " is under attack!");
} }
} }

View File

@ -46,7 +46,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Dispenser; import org.bukkit.material.Dispenser;
import org.bukkit.material.MaterialData; import org.bukkit.material.MaterialData;
import org.bukkit.metadata.MetadataValue;
import mineplex.core.Managers; import mineplex.core.Managers;
import mineplex.core.common.Pair; import mineplex.core.common.Pair;
@ -807,7 +806,8 @@ public class CastleAssaultTDM extends TeamGame
float radius = event.getRadius(); float radius = event.getRadius();
event.setRadius(0f); 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) if (player == null)
{ {
return; return;

View File

@ -2,7 +2,12 @@ package nautilus.game.arcade.game.games.castleassault.kits;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; 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 mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
@ -12,21 +17,130 @@ public class KitAlchemist extends KitPlayer
{ {
public KitAlchemist(ArcadeManager manager) 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 @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().setItem(0, new ItemBuilder(Material.IRON_SWORD).setUnbreakable(true).build()); giveRegeneration(player);
player.getInventory().setItem(1, new ItemBuilder(Material.POTION).setData((short)8194).build()); player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 100000, 0));
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().setItem(0, new ItemBuilder(Material.DIAMOND_SWORD).setLore(C.cGold + "Kit Item").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()); int level = getUpgradeLevel(player.getUniqueId());
player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).setUnbreakable(true).build()); 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 @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);
}
}
} }

View File

@ -20,21 +20,22 @@ public class KitArcher extends KitPlayer
super(manager, "Archer", KitAvailability.Free, super(manager, "Archer", KitAvailability.Free,
new String[] new String[]
{ {
C.cGrayB + "Starting Kit:", C.cWhiteB + "Starting Kit:",
C.cGray + "Diamond Sword", C.cGray + "Diamond Sword",
C.cGray + "Bow",
C.cGray + "Diamond Helmet, Iron Chestplate, Iron Leggings, Diamond Boots", C.cGray + "Diamond Helmet, Iron Chestplate, Iron Leggings, Diamond Boots",
C.cGray + "10 Fletched Arrows", C.cGray + "10 Fletched Arrows",
C.cGreenB + "Starting Ability:", 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 Perk[] {new PerkFletcher(7, 10, true, false)}, new Perk[] {new PerkFletcher(6, 10, true, false)},
new Perk[] {new PerkFletcher(7, 16, true, false)}, new Perk[] {new PerkFletcher(6, 16, true, false)},
new Perk[] {new PerkFletcher(7, 24, true, false)}, new Perk[] {new PerkFletcher(6, 24, true, false)},
new Perk[] {new PerkFletcher(7, 32, true, false)}, new Perk[] {new PerkFletcher(6, 32, true, false)},
new Perk[] {new PerkFletcher(7, 32, true, false)}, new Perk[] {new PerkFletcher(6, 32, true, false)},
new Perk[] {new PerkFletcher(7, 32, true, false)} new Perk[] {new PerkFletcher(6, 32, true, false)}
}, },
new String[][] 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 + "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", 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().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().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().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()); 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 else
{ {
player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_FALL, 4).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); 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) 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()); player.getInventory().addItem(new ItemBuilder(Material.ARROW).setAmount(8).setTitle(F.item("Fletched Arrow")).build());
} }
else if (streak == 4) 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()); player.getInventory().addItem(new ItemBuilder(Material.ARROW).setAmount(12).setTitle(F.item("Fletched Arrow")).build());
} }
else if (streak == 6) 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()); player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_KNOCKBACK, 1).build());
} }
else if (streak == 8) 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 ItemBuilder(Material.ARROW).setAmount(32).setTitle(F.item("Fletched Arrow")).build());
player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_FIRE, 1).build());
} }
} }
} }

View File

@ -19,7 +19,7 @@ public class KitDemolitionist extends KitPlayer
super(manager, "Demolitionist", KitAvailability.Free, super(manager, "Demolitionist", KitAvailability.Free,
new String[] new String[]
{ {
C.cGrayB + "Starting Kit:", C.cWhiteB + "Starting Kit:",
C.cGray + "Diamond Sword, Flint and Steel", C.cGray + "Diamond Sword, Flint and Steel",
C.cGray + "Diamond Helmet, Iron Chestplate, Iron Leggings, Diamond Boots", C.cGray + "Diamond Helmet, Iron Chestplate, Iron Leggings, Diamond Boots",
C.cGray + "Blast Protection IV on all Armor", C.cGray + "Blast Protection IV on all Armor",
@ -130,23 +130,24 @@ public class KitDemolitionist extends KitPlayer
{ {
if (streak == 2) 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()); player.getInventory().addItem(new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).setAmount(2).build());
} }
else if (streak == 4) 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()); player.getInventory().addItem(new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).setAmount(3).build());
} }
else if (streak == 6) 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()); player.getInventory().addItem(new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).setAmount(4).build());
} }
else if (streak == 8) 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.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());
} }
} }
} }

View File

@ -18,11 +18,11 @@ public class KitFighter extends KitPlayer
super(manager, "Fighter", KitAvailability.Free, super(manager, "Fighter", KitAvailability.Free,
new String[] new String[]
{ {
C.cGrayB + "Starting Kit:", C.cWhiteB + "Starting Kit:",
C.cGray + "Diamond Sword", C.cGray + "Diamond Sword",
C.cGray + "1 Golden Applegate", C.cGray + "1 Golden Applegate",
C.cGray + "Diamond Helmet, Iron Chestplate, Iron Leggings, Diamond Boots", 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" C.cGreen + "Bloodlust: Deal half a heart more damage for 3 seconds after killing an enemy"
}, },
new Perk[][] 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, 3)}, new Perk[] {new PerkBloodlust(1, 3)},
new Perk[] {new PerkBloodlust(1, 3)} new Perk[] {new PerkBloodlust(1, 5)}
}, },
new String[][] new String[][]
{ {
@ -50,7 +50,7 @@ public class KitFighter extends KitPlayer
C.cGray + "Increase starting amount of Golden Applegates to 3" 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); Material.DIAMOND_SWORD);
@ -92,7 +92,7 @@ public class KitFighter extends KitPlayer
} }
else if (level == 5) 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(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()); 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) 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()); player.getInventory().addItem(new ItemBuilder(Material.GOLDEN_APPLE).setAmount(1).setTitle(C.cPurple + "Golden Applegate").build());
} }
else if (streak == 4) 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()); player.getInventory().addItem(new ItemBuilder(Material.POTION).setData((short)16421).build());
} }
else if (streak == 6) else if (streak == 6)
{ {
player.sendMessage(C.cRedB + "You have received a Speed II Potion as a Kill Streak Reward!"); 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)8290).build()); player.getInventory().addItem(new ItemBuilder(Material.POTION).setData((short)8226).build());
} }
else if (streak == 8) 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()); player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.FIRE_ASPECT, 1).build());
} }
} }

View File

@ -39,7 +39,9 @@ public abstract class KitPlayer extends ProgressingKit
protected void giveRegeneration(Player player) 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 @Override

View File

@ -22,10 +22,10 @@ public class KitTank extends KitPlayer
super(manager, "Tank", KitAvailability.Free, super(manager, "Tank", KitAvailability.Free,
new String[] new String[]
{ {
C.cGrayB + "Starting Kit:", C.cWhiteB + "Starting Kit:",
C.cGray + "Diamond Sword", C.cGray + "Diamond Sword",
C.cGray + "Diamond Helmet, Iron Chestplate, Iron Leggings, Diamond Boots", 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[][] new Perk[][]
{ {
@ -39,21 +39,19 @@ public class KitTank extends KitPlayer
new String[][] 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 Helmet"
}, },
{ {
C.cGray + "Obtain a Protection I Enchantment on your Diamond Boots" 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); 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().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().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()); player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setLore(C.cGold + "Kit Item").setUnbreakable(true).build());
} }
else if (level == 1) 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().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().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().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()); 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().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().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().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()); 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().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().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().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()); 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 @Override
@ -116,17 +114,17 @@ public class KitTank extends KitPlayer
{ {
if (streak == 2) 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()); player.getInventory().addItem(new ItemBuilder(Material.GOLDEN_APPLE).setAmount(1).setTitle(C.cPurple + "Golden Applegate").build());
} }
else if (streak == 4) 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()); player.getInventory().addItem(new ItemBuilder(Material.POTION).setData((short)8289).build());
} }
else if (streak == 6) 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(); ItemStack item = new ItemBuilder(Material.POTION).setData((short)8205).build();
PotionMeta pm = (PotionMeta) item.getItemMeta(); PotionMeta pm = (PotionMeta) item.getItemMeta();
pm.clearCustomEffects(); pm.clearCustomEffects();
@ -136,7 +134,7 @@ public class KitTank extends KitPlayer
} }
else if (streak == 8) 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()); player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.THORNS, 2).build());
} }
} }

View File

@ -27,7 +27,7 @@ public class PerkBloodlust extends Perk
public PerkBloodlust(double damageBoost, int duration) public PerkBloodlust(double damageBoost, int duration)
{ {
super("Bloodlust", super("Bloodlust",
new String[] new String[]
{ {
C.cGray + "Deal an extra " + (damageBoost / 2) + " hearts of damage for " + duration + " seconds after a kill.", 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()); 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()); _lusting.put(player, Bukkit.getScheduler().runTaskLater(UtilServer.getPlugin(), () -> _lusting.remove(player), _duration * 20).getTaskId());
} }

View File

@ -285,15 +285,18 @@ public class Moba extends TeamGame
setKits(_kits); setKits(_kits);
// Store player data // Store player data
for (Player player : GetPlayers(true)) GetPlayers(true).forEach(this::setupPlayerData);
{
_playerData.add(new MobaPlayer(player));
MobaUtil.setTeamEntity(player, GetTeam(player));
}
// Make sure to cleanup
cleanupLobby(); cleanupLobby();
} }
public void setupPlayerData(Player player)
{
_playerData.add(new MobaPlayer(player));
MobaUtil.setTeamEntity(player, GetTeam(player));
}
@EventHandler @EventHandler
public void preventOverfill(PlayerPrepareTeleportEvent event) public void preventOverfill(PlayerPrepareTeleportEvent event)
{ {

View File

@ -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.PrepareManager;
import nautilus.game.arcade.game.games.moba.prepare.PrepareSelection; import nautilus.game.arcade.game.games.moba.prepare.PrepareSelection;
import nautilus.game.arcade.game.modules.CustomScoreboardModule; import nautilus.game.arcade.game.modules.CustomScoreboardModule;
import nautilus.game.arcade.game.modules.GameStatisticsModule;
import nautilus.game.arcade.scoreboard.GameScoreboard; import nautilus.game.arcade.scoreboard.GameScoreboard;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -98,7 +97,7 @@ public class MobaClassic extends Moba
{ {
suffix = C.cYellow + " Unknown"; suffix = C.cYellow + " Unknown";
} }
else if (mobaPlayer.getKit() == null) else if (mobaPlayer == null || mobaPlayer.getKit() == null)
{ {
suffix = C.cYellow + " Selecting"; suffix = C.cYellow + " Selecting";
} }

View File

@ -4,6 +4,8 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; 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.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -36,25 +38,7 @@ public class BuffManager implements Listener
_buffs.get(buff.getEntity()).add(buff); _buffs.get(buff.getEntity()).add(buff);
buff.apply(); buff.apply();
} }
public boolean hasBuff(LivingEntity entity, Class<? extends Buff<? extends LivingEntity>> clazz)
{
if (!_buffs.containsKey(entity))
{
return false;
}
for (Buff<? extends LivingEntity> buff : _buffs.get(entity))
{
if (buff.getClass().equals(clazz))
{
return true;
}
}
return false;
}
@EventHandler @EventHandler
public void update(UpdateEvent event) 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));
}
} }

View File

@ -1,21 +1,26 @@
package nautilus.game.arcade.game.games.moba.general; package nautilus.game.arcade.game.games.moba.general;
import mineplex.core.common.util.F; 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.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba; 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.progression.MobaExperienceCalculateEvent;
import nautilus.game.arcade.game.games.moba.structure.tower.Tower; import nautilus.game.arcade.game.games.moba.structure.tower.Tower;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID;
public class HotJoiningManager implements Listener public class HotJoiningManager implements Listener
{ {
@ -23,18 +28,22 @@ public class HotJoiningManager implements Listener
private static final int HOT_JOIN_EXP_REWARD = 100; private static final int HOT_JOIN_EXP_REWARD = 100;
private final Moba _host; private final Moba _host;
private final List<Player> _pending;
private final List<Player> _hotJoined; private final List<Player> _hotJoined;
private final List<UUID> _played;
public HotJoiningManager(Moba host) public HotJoiningManager(Moba host)
{ {
_host = host; _host = host;
_pending = new ArrayList<>();
_hotJoined = new ArrayList<>(); _hotJoined = new ArrayList<>();
_played = new ArrayList<>(8);
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.LOWEST)
public void playerJoin(PlayerJoinEvent event) public void playerLogin(PlayerLoginEvent event)
{ {
if (!_host.IsLive()) if (!_host.IsLive() || !_host.getArcadeManager().IsRewardStats())
{ {
return; return;
} }
@ -42,11 +51,36 @@ public class HotJoiningManager implements Listener
Player player = event.getPlayer(); Player player = event.getPlayer();
GameTeam team = _host.ChooseTeam(player); GameTeam team = _host.ChooseTeam(player);
if (team == null || _host.getArcadeManager().isVanished(player)) if (team == null || team.GetSize() >= 4)
{ {
return; 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()) for (Tower tower : _host.getTowerManager().getTowers())
{ {
// If the team's second tower is dead // 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); team.SpawnTeleport(player);
_hotJoined.add(player);
if (!played)
{
_hotJoined.add(player);
}
_host.setupPlayerData(player);
_host.getArcadeManager().runSyncLater(() -> _host.getArcadeManager().runSyncLater(() ->
{ {
Kit kit = _host.getFirstKit(player); 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); _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); }, 1);
} }
@ -74,9 +126,21 @@ public class HotJoiningManager implements Listener
public void playerQuit(PlayerQuitEvent event) public void playerQuit(PlayerQuitEvent event)
{ {
Player player = event.getPlayer(); Player player = event.getPlayer();
_pending.remove(player);
_hotJoined.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 @EventHandler
public void expCalculate(MobaExperienceCalculateEvent event) public void expCalculate(MobaExperienceCalculateEvent event)
{ {

View File

@ -50,7 +50,7 @@ public class SkillInfinity extends HeroSkill
@EventHandler @EventHandler
public void interact(PlayerInteractEvent event) public void interact(PlayerInteractEvent event)
{ {
if (!isSkillItem(event) || _active.contains(event.getPlayer())) if (!isSkillItem(event))
{ {
return; return;
} }
@ -66,13 +66,11 @@ public class SkillInfinity extends HeroSkill
// Give 1 arrow just incase the player didn't have one // Give 1 arrow just incase the player didn't have one
_kit.giveAmmo(player, 1); _kit.giveAmmo(player, 1);
bow.addEnchantment(Enchantment.ARROW_INFINITE, 1); bow.addEnchantment(Enchantment.ARROW_INFINITE, 1);
_active.add(player);
broadcast(player); broadcast(player);
useActiveSkill(() -> useActiveSkill(() ->
{ {
bow.removeEnchantment(Enchantment.ARROW_INFINITE); bow.removeEnchantment(Enchantment.ARROW_INFINITE);
_active.remove(player);
}, player, 7000); }, player, 7000);
} }

View File

@ -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.mage.MobaMageShop;
import nautilus.game.arcade.game.games.moba.shop.warrior.MobaWarriorShop; import nautilus.game.arcade.game.games.moba.shop.warrior.MobaWarriorShop;
import nautilus.game.arcade.game.games.moba.util.MobaConstants; import nautilus.game.arcade.game.games.moba.util.MobaConstants;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
@ -249,6 +248,7 @@ public class MobaShop implements Listener
public List<MobaItem> getOwnedItems(Player player) public List<MobaItem> getOwnedItems(Player player)
{ {
_upgrades.putIfAbsent(player, new ArrayList<>());
return _upgrades.get(player); return _upgrades.get(player);
} }
@ -329,20 +329,6 @@ public class MobaShop implements Listener
Handle MobaItem events 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 @EventHandler
public void ammoGive(AmmoGiveEvent event) public void ammoGive(AmmoGiveEvent event)
{ {