Clean up game classes a bit
This commit is contained in:
parent
834c537bc8
commit
f2ff546d47
@ -75,7 +75,6 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.EnchantedBookBuilder;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.leaderboard.Leaderboard;
|
||||
import mineplex.core.leaderboard.LeaderboardManager;
|
||||
@ -125,16 +124,10 @@ public class CastleAssault extends TeamGame
|
||||
|
||||
private List<Block> _chests = new ArrayList<>();
|
||||
|
||||
private ChestLoot _diamondGearCommon = new ChestLoot(true);
|
||||
private ChestLoot _diamondGearRare = new ChestLoot(true);
|
||||
private ChestLoot _weaponGearCommon = new ChestLoot(true);
|
||||
private ChestLoot _weaponGearRare = new ChestLoot(true);
|
||||
private ChestLoot _rangedGear = new ChestLoot(true);
|
||||
private ChestLoot _rodsAndGaps = new ChestLoot(true);
|
||||
private ChestLoot _potionGearCommon = new ChestLoot(true);
|
||||
private ChestLoot _potionGearRare = new ChestLoot(true);
|
||||
private ChestLoot _enchantGearCommon = new ChestLoot(true);
|
||||
private ChestLoot _enchantGearRare = new ChestLoot(true);
|
||||
private ChestLoot _miscGear = new ChestLoot();
|
||||
|
||||
private ObjectiveTNTSpawner _tntSpawner;
|
||||
@ -236,37 +229,6 @@ public class CastleAssault extends TeamGame
|
||||
|
||||
private void generateLoot()
|
||||
{
|
||||
{
|
||||
_diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_HELMET), 2);
|
||||
_diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_CHESTPLATE), 2);
|
||||
_diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_LEGGINGS), 2);
|
||||
_diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_BOOTS), 2);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1);
|
||||
}
|
||||
{
|
||||
_diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1);
|
||||
_diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1);
|
||||
_diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1);
|
||||
_diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1);
|
||||
}
|
||||
{
|
||||
_weaponGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_SWORD).build(), 2);
|
||||
_weaponGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 1).build(), 2);
|
||||
}
|
||||
{
|
||||
_weaponGearRare.addLoot(new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 2).build(), 1);
|
||||
}
|
||||
{
|
||||
_rangedGear.addLoot(new ItemStack(Material.BOW), 3);
|
||||
_rangedGear.addLoot(Material.ARROW, 3, 8, 16);
|
||||
@ -283,15 +245,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);
|
||||
}
|
||||
{
|
||||
_enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 2);
|
||||
_enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.DAMAGE_ALL, 1).build(), 2);
|
||||
_enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_DAMAGE, 1).build(), 2);
|
||||
_enchantGearCommon.addLoot(new ItemStack(Material.EXP_BOTTLE, 64), 1);
|
||||
}
|
||||
{
|
||||
_enchantGearRare.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.FIRE_ASPECT, 1).build(), 1);
|
||||
}
|
||||
{
|
||||
_miscGear.addLoot(new ItemStack(Material.ENDER_PEARL), 2);
|
||||
_miscGear.addLoot(new ItemStack(Material.WATER_BUCKET), 2);
|
||||
@ -602,10 +555,29 @@ public class CastleAssault extends TeamGame
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak();
|
||||
if (streak > 0)
|
||||
{
|
||||
AddGems(player, streak, streak + " Player Kill Streak", false, false);
|
||||
int crowns = 0;
|
||||
for (GemData data : GetGems(player).values())
|
||||
{
|
||||
crowns += data.Gems;
|
||||
}
|
||||
int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak();
|
||||
if (streak >= 2 && streak < 4)
|
||||
{
|
||||
AddGems(player, 0.5 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 4 && streak < 6)
|
||||
{
|
||||
AddGems(player, crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 6 && streak < 8)
|
||||
{
|
||||
AddGems(player, 1.5 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 8)
|
||||
{
|
||||
AddGems(player, 2 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
}
|
||||
|
||||
KitPlayer kit = (KitPlayer) GetKit(player);
|
||||
@ -651,10 +623,29 @@ public class CastleAssault extends TeamGame
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak();
|
||||
if (streak > 0)
|
||||
{
|
||||
AddGems(player, streak, streak + " Player Kill Streak", false, false);
|
||||
int crowns = 0;
|
||||
for (GemData data : GetGems(player).values())
|
||||
{
|
||||
crowns += data.Gems;
|
||||
}
|
||||
int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak();
|
||||
if (streak >= 2 && streak < 4)
|
||||
{
|
||||
AddGems(player, 0.5 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 4 && streak < 6)
|
||||
{
|
||||
AddGems(player, crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 6 && streak < 8)
|
||||
{
|
||||
AddGems(player, 1.5 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 8)
|
||||
{
|
||||
AddGems(player, 2 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
}
|
||||
|
||||
KitPlayer kit = (KitPlayer) GetKit(player);
|
||||
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -15,6 +14,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
@ -26,6 +26,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.block.BlockFormEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
@ -45,6 +46,8 @@ import org.bukkit.material.Dispenser;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
@ -56,8 +59,10 @@ import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.EnchantedBookBuilder;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.leaderboard.Leaderboard;
|
||||
import mineplex.core.leaderboard.LeaderboardManager;
|
||||
import mineplex.core.leaderboard.LeaderboardRepository.LeaderboardSQLType;
|
||||
import mineplex.core.loot.ChestLoot;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -73,9 +78,6 @@ import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.GemData;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.castleassault.data.KillStreakData;
|
||||
import nautilus.game.arcade.game.games.castleassault.data.medals.MedalData;
|
||||
import nautilus.game.arcade.game.games.castleassault.data.medals.MedalData.MedalLevel;
|
||||
import nautilus.game.arcade.game.games.castleassault.data.medals.MedalType;
|
||||
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;
|
||||
@ -83,6 +85,7 @@ import nautilus.game.arcade.game.games.castleassault.kits.KitPlayer;
|
||||
import nautilus.game.arcade.game.games.castleassault.kits.KitTank;
|
||||
import nautilus.game.arcade.game.modules.compass.CompassModule;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.managers.lobby.current.NewGameLobbyManager;
|
||||
|
||||
public class CastleAssaultTDM extends TeamGame
|
||||
{
|
||||
@ -95,22 +98,14 @@ public class CastleAssaultTDM extends TeamGame
|
||||
private ItemBuilder _flintAndSteel;
|
||||
|
||||
private Map<Player, KillStreakData> _streakData = new WeakHashMap<>();
|
||||
private Map<Player, MedalData> _medalData = new WeakHashMap<>();
|
||||
private Map<GameTeam, Integer> _teamKills = new HashMap<>();
|
||||
|
||||
private List<Block> _chests = new ArrayList<>();
|
||||
|
||||
private ChestLoot _diamondGearCommon = new ChestLoot(true);
|
||||
private ChestLoot _diamondGearRare = new ChestLoot(true);
|
||||
private ChestLoot _weaponGearCommon = new ChestLoot(true);
|
||||
private ChestLoot _weaponGearRare = new ChestLoot(true);
|
||||
private ChestLoot _rangedGear = new ChestLoot(true);
|
||||
private ChestLoot _rodsAndGaps = new ChestLoot(true);
|
||||
private ChestLoot _potionGearCommon = new ChestLoot(true);
|
||||
private ChestLoot _potionGearRare = new ChestLoot(true);
|
||||
//private ChestLoot _blockGear = new ChestLoot();
|
||||
private ChestLoot _enchantGearCommon = new ChestLoot(true);
|
||||
private ChestLoot _enchantGearRare = new ChestLoot(true);
|
||||
private ChestLoot _miscGear = new ChestLoot();
|
||||
|
||||
private boolean _writeScoreboard = true;
|
||||
@ -149,7 +144,9 @@ public class CastleAssaultTDM extends TeamGame
|
||||
this.AllowFlintAndSteel = true;
|
||||
this.BlockPlaceAllow.add(Material.FIRE.getId());
|
||||
this.CrownsEnabled = true;
|
||||
this.Leaderboards = true;
|
||||
this.FirstKillReward = 20;
|
||||
this.GemKillDeathRespawn = 1;
|
||||
|
||||
new CompassModule()
|
||||
.setGiveCompass(true)
|
||||
@ -159,95 +156,38 @@ public class CastleAssaultTDM extends TeamGame
|
||||
|
||||
_flintAndSteel = new ItemBuilder(Material.FLINT_AND_STEEL).setData((short) (Material.FLINT_AND_STEEL.getMaxDurability() - MAX_FLINT_AND_STEEL_USES));
|
||||
generateLoot();
|
||||
}
|
||||
|
||||
private Player[] getMedalOwners(MedalType type)
|
||||
{
|
||||
Player gold = null;
|
||||
Double goldScore = 0D;
|
||||
Player silver = null;
|
||||
Double silverScore = 0D;
|
||||
Player bronze = null;
|
||||
Double bronzeScore = 0D;
|
||||
|
||||
//GOLD
|
||||
for (Entry<Player, MedalData> scores : _medalData.entrySet())
|
||||
if (manager.IsRewardStats())
|
||||
{
|
||||
if (scores.getValue().getScore(type) > goldScore)
|
||||
if (manager.GetLobby() instanceof NewGameLobbyManager)
|
||||
{
|
||||
gold = scores.getKey();
|
||||
goldScore = scores.getValue().getScore(type);
|
||||
Map<String, List<Location>> lobbyCustomLocs = ((NewGameLobbyManager)manager.GetLobby()).getCustomLocs();
|
||||
if (lobbyCustomLocs.containsKey("TOP_DAILY_WINS"))
|
||||
{
|
||||
Location loc = lobbyCustomLocs.get("TOP_DAILY_WINS").get(0);
|
||||
Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULT_DAILY_WINS", new Leaderboard("Top Daily Wins", Pair.create("Win", "Wins"), new String[] {"Castle Assault TDM.Wins"}, LeaderboardSQLType.DAILY, loc, 10));
|
||||
}
|
||||
if (lobbyCustomLocs.containsKey("TOP_DAILY_KILLS"))
|
||||
{
|
||||
Location loc = lobbyCustomLocs.get("TOP_DAILY_KILLS").get(0);
|
||||
Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULT_DAILY_KILLS", new Leaderboard("Top Daily Kills", Pair.create("Kill", "Kills"), new String[] {"Castle Assault TDM.Kills"}, LeaderboardSQLType.DAILY, loc, 10));
|
||||
}
|
||||
if (lobbyCustomLocs.containsKey("TOP_WINS"))
|
||||
{
|
||||
Location loc = lobbyCustomLocs.get("TOP_WINS").get(0);
|
||||
Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULT_WINS", new Leaderboard("Top Wins", Pair.create("Win", "Wins"), new String[] {"Castle Assault TDM.Wins"}, LeaderboardSQLType.ALL, loc, 10));
|
||||
}
|
||||
if (lobbyCustomLocs.containsKey("TOP_KILLS"))
|
||||
{
|
||||
Location loc = lobbyCustomLocs.get("TOP_KILLS").get(0);
|
||||
Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULT_KILLS", new Leaderboard("Top Kills", Pair.create("Kill", "Kills"), new String[] {"Castle Assault TDM.Kills"}, LeaderboardSQLType.ALL, loc, 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//SILVER
|
||||
for (Entry<Player, MedalData> scores : _medalData.entrySet())
|
||||
{
|
||||
if (gold != null && gold.getName().equals(scores.getKey().getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (scores.getValue().getScore(type) > silverScore)
|
||||
{
|
||||
silver = scores.getKey();
|
||||
silverScore = scores.getValue().getScore(type);
|
||||
}
|
||||
}
|
||||
|
||||
//BRONZE
|
||||
for (Entry<Player, MedalData> scores : _medalData.entrySet())
|
||||
{
|
||||
if (gold != null && gold.getName().equals(scores.getKey().getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (silver != null && silver.getName().equals(scores.getKey().getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (scores.getValue().getScore(type) > bronzeScore)
|
||||
{
|
||||
bronze = scores.getKey();
|
||||
bronzeScore = scores.getValue().getScore(type);
|
||||
}
|
||||
}
|
||||
|
||||
return new Player[] {gold, silver, bronze};
|
||||
}
|
||||
|
||||
private void generateLoot()
|
||||
{
|
||||
{
|
||||
_diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_HELMET), 2);
|
||||
_diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_CHESTPLATE), 2);
|
||||
_diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_LEGGINGS), 2);
|
||||
_diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_BOOTS), 2);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1);
|
||||
_diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1);
|
||||
}
|
||||
{
|
||||
_diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1);
|
||||
_diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1);
|
||||
_diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1);
|
||||
_diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1);
|
||||
}
|
||||
{
|
||||
_weaponGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_SWORD).build(), 2);
|
||||
_weaponGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 1).build(), 2);
|
||||
}
|
||||
{
|
||||
_weaponGearRare.addLoot(new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 2).build(), 1);
|
||||
}
|
||||
{
|
||||
_rangedGear.addLoot(new ItemStack(Material.BOW), 3);
|
||||
_rangedGear.addLoot(Material.ARROW, 3, 8, 16);
|
||||
@ -264,19 +204,6 @@ public class CastleAssaultTDM extends TeamGame
|
||||
_potionGearRare.addLoot(new ItemBuilder(Material.POTION).setData((short)8193).build(), 2);
|
||||
_potionGearRare.addLoot(new ItemBuilder(Material.POTION).setData((short)8195).build(), 2);
|
||||
}
|
||||
/*{
|
||||
_blockGear.addLoot(new ItemStack(Material.STONE, 64), 2);
|
||||
_blockGear.addLoot(new ItemStack(Material.WOOD, 64), 2);
|
||||
}*/
|
||||
{
|
||||
_enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 2);
|
||||
_enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.DAMAGE_ALL, 1).build(), 2);
|
||||
_enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_DAMAGE, 1).build(), 2);
|
||||
_enchantGearCommon.addLoot(new ItemStack(Material.EXP_BOTTLE, 64), 1);
|
||||
}
|
||||
{
|
||||
_enchantGearRare.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.FIRE_ASPECT, 1).build(), 1);
|
||||
}
|
||||
{
|
||||
_miscGear.addLoot(new ItemStack(Material.ENDER_PEARL), 2);
|
||||
_miscGear.addLoot(new ItemBuilder(Material.TNT, 4).setTitle(F.item("Throwing TNT")).build(), 2);
|
||||
@ -318,23 +245,7 @@ public class CastleAssaultTDM extends TeamGame
|
||||
if (chance <= 0.3)
|
||||
{
|
||||
loot = _rangedGear;
|
||||
}/*
|
||||
if (chance <= 0.4)
|
||||
{
|
||||
loot = _weaponGearCommon;
|
||||
if (subChance <= 0.4)
|
||||
{
|
||||
loot = _weaponGearRare;
|
||||
}
|
||||
}
|
||||
if (chance <= 0.3)
|
||||
{
|
||||
loot = _diamondGearCommon;
|
||||
if (subChance <= 0.3)
|
||||
{
|
||||
loot = _diamondGearRare;
|
||||
}
|
||||
}*/
|
||||
chest.getBlockInventory().setItem(slot, loot.getLoot());
|
||||
}
|
||||
}
|
||||
@ -380,8 +291,8 @@ public class CastleAssaultTDM extends TeamGame
|
||||
_writeScoreboard = false;
|
||||
Scoreboard.reset();
|
||||
Scoreboard.writeNewLine();
|
||||
Scoreboard.write(winner + C.cBlue + " has won");
|
||||
Scoreboard.write(C.cBlue + "with " + C.cGreen + kills + C.cBlue + " kills!");
|
||||
Scoreboard.write(winner + C.cWhite + " has won");
|
||||
Scoreboard.write(C.cWhite + "with " + C.cGreen + kills + C.cWhite + " kills!");
|
||||
Scoreboard.writeNewLine();
|
||||
|
||||
Scoreboard.draw();
|
||||
@ -401,6 +312,19 @@ public class CastleAssaultTDM extends TeamGame
|
||||
_teamKills.put(red, 0);
|
||||
GameTeam blue = GetTeam(ChatColor.AQUA);
|
||||
_teamKills.put(blue, 0);
|
||||
this.CreatureAllowOverride = true;
|
||||
int kitIndex = 0;
|
||||
for (int i = 0; i < WorldData.GetDataLocs("WHITE").size(); i++)
|
||||
{
|
||||
if (kitIndex >= GetKits().length)
|
||||
{
|
||||
kitIndex = 0;
|
||||
}
|
||||
Entity ent = GetKits()[kitIndex].SpawnEntity(WorldData.GetDataLocs("WHITE").get(i));
|
||||
Manager.GetLobby().addKitLocation(ent, GetKits()[kitIndex], WorldData.GetDataLocs("WHITE").get(i));
|
||||
kitIndex++;
|
||||
}
|
||||
this.CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -429,34 +353,6 @@ public class CastleAssaultTDM extends TeamGame
|
||||
GameTeam winner = teamsAlive.get(0);
|
||||
AnnounceEnd(winner);
|
||||
writeFinalScoreboard(winner.GetColor() + winner.GetName(), _teamKills.get(winner));
|
||||
boolean announcedMedalStart = false;
|
||||
for (MedalType type : MedalType.values())
|
||||
{
|
||||
Player[] rewarding = getMedalOwners(type);
|
||||
if (rewarding[0] != null)
|
||||
{
|
||||
if (!announcedMedalStart)
|
||||
{
|
||||
announcedMedalStart = true;
|
||||
Bukkit.broadcastMessage(C.cGoldB + "-==Match Medal Recipients==-");
|
||||
}
|
||||
AddGems(rewarding[0], 50, MedalLevel.GOLD.getName() + " " + type.getName(), false, false);
|
||||
AddStat(rewarding[0], "Medalist", 1, false, false);
|
||||
Bukkit.broadcastMessage(MedalLevel.GOLD.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.GOLD.getColor() + rewarding[0].getName());
|
||||
}
|
||||
if (rewarding[1] != null)
|
||||
{
|
||||
AddGems(rewarding[1], 30, MedalLevel.SILVER.getName() + " " + type.getName(), false, false);
|
||||
AddStat(rewarding[1], "Medalist", 1, false, false);
|
||||
Bukkit.broadcastMessage(MedalLevel.SILVER.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.SILVER.getColor() + rewarding[1].getName());
|
||||
}
|
||||
if (rewarding[2] != null)
|
||||
{
|
||||
AddGems(rewarding[2], 20, MedalLevel.BRONZE.getName() + " " + type.getName(), false, false);
|
||||
AddStat(rewarding[2], "Medalist", 1, false, false);
|
||||
Bukkit.broadcastMessage(MedalLevel.BRONZE.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.BRONZE.getColor() + rewarding[2].getName());
|
||||
}
|
||||
}
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
@ -474,10 +370,29 @@ public class CastleAssaultTDM extends TeamGame
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak();
|
||||
if (streak > 0)
|
||||
{
|
||||
AddGems(player, streak, streak + " Player Kill Streak", false, false);
|
||||
int crowns = 0;
|
||||
for (GemData data : GetGems(player).values())
|
||||
{
|
||||
crowns += data.Gems;
|
||||
}
|
||||
int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak();
|
||||
if (streak >= 2 && streak < 4)
|
||||
{
|
||||
AddGems(player, 0.5 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 4 && streak < 6)
|
||||
{
|
||||
AddGems(player, crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 6 && streak < 8)
|
||||
{
|
||||
AddGems(player, 1.5 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 8)
|
||||
{
|
||||
AddGems(player, 2 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetKit(player) != null)
|
||||
@ -529,34 +444,6 @@ public class CastleAssaultTDM extends TeamGame
|
||||
{
|
||||
AnnounceEnd(blue);
|
||||
writeFinalScoreboard(blue.GetColor() + blue.GetName(), _teamKills.get(blue));
|
||||
boolean announcedMedalStart = false;
|
||||
for (MedalType type : MedalType.values())
|
||||
{
|
||||
Player[] rewarding = getMedalOwners(type);
|
||||
if (rewarding[0] != null)
|
||||
{
|
||||
if (!announcedMedalStart)
|
||||
{
|
||||
announcedMedalStart = true;
|
||||
Bukkit.broadcastMessage(C.cGoldB + "-==Match Medal Recipients==-");
|
||||
}
|
||||
AddGems(rewarding[0], 50, MedalLevel.GOLD.getName() + " " + type.getName(), false, false);
|
||||
AddStat(rewarding[0], "Medalist", 1, false, false);
|
||||
Bukkit.broadcastMessage(MedalLevel.GOLD.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.GOLD.getColor() + rewarding[0].getName());
|
||||
}
|
||||
if (rewarding[1] != null)
|
||||
{
|
||||
AddGems(rewarding[1], 30, MedalLevel.SILVER.getName() + " " + type.getName(), false, false);
|
||||
AddStat(rewarding[1], "Medalist", 1, false, false);
|
||||
Bukkit.broadcastMessage(MedalLevel.SILVER.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.SILVER.getColor() + rewarding[1].getName());
|
||||
}
|
||||
if (rewarding[2] != null)
|
||||
{
|
||||
AddGems(rewarding[2], 20, MedalLevel.BRONZE.getName() + " " + type.getName(), false, false);
|
||||
AddStat(rewarding[2], "Medalist", 1, false, false);
|
||||
Bukkit.broadcastMessage(MedalLevel.BRONZE.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.BRONZE.getColor() + rewarding[2].getName());
|
||||
}
|
||||
}
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
@ -574,10 +461,29 @@ public class CastleAssaultTDM extends TeamGame
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak();
|
||||
if (streak > 0)
|
||||
{
|
||||
AddGems(player, streak, streak + " Player Kill Streak", false, false);
|
||||
int crowns = 0;
|
||||
for (GemData data : GetGems(player).values())
|
||||
{
|
||||
crowns += data.Gems;
|
||||
}
|
||||
int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak();
|
||||
if (streak >= 2 && streak < 4)
|
||||
{
|
||||
AddGems(player, 0.5 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 4 && streak < 6)
|
||||
{
|
||||
AddGems(player, crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 6 && streak < 8)
|
||||
{
|
||||
AddGems(player, 1.5 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 8)
|
||||
{
|
||||
AddGems(player, 2 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
}
|
||||
|
||||
KitPlayer kit = (KitPlayer) GetKit(player);
|
||||
@ -601,34 +507,6 @@ public class CastleAssaultTDM extends TeamGame
|
||||
{
|
||||
AnnounceEnd(red);
|
||||
writeFinalScoreboard(red.GetColor() + red.GetName(), _teamKills.get(red));
|
||||
boolean announcedMedalStart = false;
|
||||
for (MedalType type : MedalType.values())
|
||||
{
|
||||
Player[] rewarding = getMedalOwners(type);
|
||||
if (rewarding[0] != null)
|
||||
{
|
||||
if (!announcedMedalStart)
|
||||
{
|
||||
announcedMedalStart = true;
|
||||
Bukkit.broadcastMessage(C.cGoldB + "-==Match Medal Recipients==-");
|
||||
}
|
||||
AddGems(rewarding[0], 50, MedalLevel.GOLD.getName() + " " + type.getName(), false, false);
|
||||
AddStat(rewarding[0], "Medalist", 1, false, false);
|
||||
Bukkit.broadcastMessage(MedalLevel.GOLD.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.GOLD.getColor() + rewarding[0].getName());
|
||||
}
|
||||
if (rewarding[1] != null)
|
||||
{
|
||||
AddGems(rewarding[1], 30, MedalLevel.SILVER.getName() + " " + type.getName(), false, false);
|
||||
AddStat(rewarding[1], "Medalist", 1, false, false);
|
||||
Bukkit.broadcastMessage(MedalLevel.SILVER.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.SILVER.getColor() + rewarding[1].getName());
|
||||
}
|
||||
if (rewarding[2] != null)
|
||||
{
|
||||
AddGems(rewarding[2], 20, MedalLevel.BRONZE.getName() + " " + type.getName(), false, false);
|
||||
AddStat(rewarding[2], "Medalist", 1, false, false);
|
||||
Bukkit.broadcastMessage(MedalLevel.BRONZE.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.BRONZE.getColor() + rewarding[2].getName());
|
||||
}
|
||||
}
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
@ -646,10 +524,29 @@ public class CastleAssaultTDM extends TeamGame
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak();
|
||||
if (streak > 0)
|
||||
{
|
||||
AddGems(player, streak, streak + " Player Kill Streak", false, false);
|
||||
int crowns = 0;
|
||||
for (GemData data : GetGems(player).values())
|
||||
{
|
||||
crowns += data.Gems;
|
||||
}
|
||||
int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak();
|
||||
if (streak >= 2 && streak < 4)
|
||||
{
|
||||
AddGems(player, 0.5 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 4 && streak < 6)
|
||||
{
|
||||
AddGems(player, crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 6 && streak < 8)
|
||||
{
|
||||
AddGems(player, 1.5 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
else if (streak >= 8)
|
||||
{
|
||||
AddGems(player, 2 * crowns, streak + " Player Kill Streak", false, false);
|
||||
}
|
||||
}
|
||||
|
||||
KitPlayer kit = (KitPlayer) GetKit(player);
|
||||
@ -697,6 +594,10 @@ public class CastleAssaultTDM extends TeamGame
|
||||
Manager.GetDamage().SetEnabled(true);
|
||||
Manager.GetExplosion().setEnabled(true);
|
||||
Manager.GetCreature().SetDisableCustomDrops(false);
|
||||
Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULT_DAILY_WINS");
|
||||
Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULT_DAILY_KILLS");
|
||||
Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULT_WINS");
|
||||
Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULT_KILLS");
|
||||
}
|
||||
}
|
||||
|
||||
@ -757,6 +658,23 @@ public class CastleAssaultTDM extends TeamGame
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
if (event.getToBlock().getType() == Material.ICE)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockChange(BlockFormEvent e)
|
||||
{
|
||||
if (!IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (e.getNewState().getType() == Material.ICE)
|
||||
{
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -871,7 +789,6 @@ public class CastleAssaultTDM extends TeamGame
|
||||
}
|
||||
|
||||
AddStat(player, GetKit(player).GetName() + "KitKills", 1, false, false);
|
||||
_medalData.computeIfAbsent(player, key -> new MedalData()).addScore(MedalType.ELIM, 1D);
|
||||
_teamKills.merge(GetTeam(player), 1, Integer::sum);
|
||||
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
@ -886,7 +803,6 @@ public class CastleAssaultTDM extends TeamGame
|
||||
if (data.addKill(hardLine))
|
||||
{
|
||||
AddStat(player, "KillStreak", 1, false, false);
|
||||
player.sendMessage(C.cRedB + "You have received a Kill Streak Reward!");
|
||||
((KitPlayer)GetKit(player)).awardKillStreak(player, hardLine ? (data.getKills() + 1) : data.getKills());
|
||||
}
|
||||
if (UtilMath.isEven(data.getKills()))
|
||||
@ -1029,6 +945,10 @@ public class CastleAssaultTDM extends TeamGame
|
||||
teleport.setYaw(shooter.getLocation().getYaw());
|
||||
shooter.teleport(teleport);
|
||||
}
|
||||
if (event.getEntity() instanceof Arrow)
|
||||
{
|
||||
Manager.runSyncLater(event.getEntity()::remove, 1L);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
Loading…
Reference in New Issue
Block a user