Implementation of achievements
This commit is contained in:
parent
e8eb364d99
commit
abf51064b3
@ -382,30 +382,105 @@ public enum Achievement
|
|||||||
AchievementCategory.MASTER_BUILDERS),
|
AchievementCategory.MASTER_BUILDERS),
|
||||||
|
|
||||||
//Castle Siege
|
//Castle Siege
|
||||||
CASTLE_SIEGE_WINS("FOR THE KING!", 600,
|
CASTLE_SIEGE_WINS("FOR THE KING!", 0,
|
||||||
new String[]{"Castle Siege.ForTheKing"},
|
new String[]{"Castle Siege.ForTheKing"},
|
||||||
new String[]{"Win as Defenders 50 times"},
|
new String[]{"Win as Defenders 50 times"},
|
||||||
|
new int[][]{ new int[]{0,0,10000}},
|
||||||
new int[]{50},
|
new int[]{50},
|
||||||
|
"",
|
||||||
|
new String[0],
|
||||||
AchievementCategory.CASTLE_SIEGE),
|
AchievementCategory.CASTLE_SIEGE),
|
||||||
|
|
||||||
CASTLE_SIEGE_KINGSLAYER("Kingslayer", 800,
|
CASTLE_SIEGE_KINGSLAYER("Kingslayer", 0,
|
||||||
new String[]{"Castle Siege.KingSlayer"},
|
new String[]{"Castle Siege.KingSlayer"},
|
||||||
new String[]{"Get the killing blow on the King"},
|
new String[]{"Get the killing blow on the King"},
|
||||||
|
new int[][]{ new int[]{0,0,4000}},
|
||||||
new int[]{1},
|
new int[]{1},
|
||||||
|
"",
|
||||||
|
new String[0],
|
||||||
AchievementCategory.CASTLE_SIEGE),
|
AchievementCategory.CASTLE_SIEGE),
|
||||||
|
|
||||||
CASTLE_SIEGE_BLOOD_THIRSTY("Blood Thirsty", 1200,
|
CASTLE_SIEGE_BLOOD_THIRSTY("Blood Thirsty", 0,
|
||||||
new String[]{"Castle Siege.BloodThirsty"},
|
new String[]{"Castle Siege.BloodThirsty"},
|
||||||
new String[]{"Kill 50 Undead in a single game"},
|
new String[]{"Kill 50 Undead in a single game"},
|
||||||
|
new int[][]{ new int[]{0,0,8000}},
|
||||||
new int[]{1},
|
new int[]{1},
|
||||||
|
"",
|
||||||
|
new String[0],
|
||||||
AchievementCategory.CASTLE_SIEGE),
|
AchievementCategory.CASTLE_SIEGE),
|
||||||
|
|
||||||
CASTLE_SIEGE_ASSASSIN("Assassin", 1000,
|
CASTLE_SIEGE_ASSASSIN("Assassin", 0,
|
||||||
new String[]{"Castle Siege.Assassin"},
|
new String[]{"Castle Siege.Assassin"},
|
||||||
new String[]{"Do 50% or more of the damage to the king"},
|
new String[]{"Do 50% or more of the damage to the king"},
|
||||||
|
new int[][]{ new int[]{0,0,8000}},
|
||||||
new int[]{1},
|
new int[]{1},
|
||||||
|
"",
|
||||||
|
new String[0],
|
||||||
AchievementCategory.CASTLE_SIEGE),
|
AchievementCategory.CASTLE_SIEGE),
|
||||||
|
|
||||||
|
CASTLE_SIEGE_CLOSE_CALL("Slash or Burn", 0,
|
||||||
|
new String[]{"Castle Siege.CloseCall"},
|
||||||
|
new String[]{"Win the Game as Undead within the last 70 seconds of the game"},
|
||||||
|
new int[][]{ new int[]{0,0,8000}},
|
||||||
|
new int[]{1},
|
||||||
|
"",
|
||||||
|
new String[0],
|
||||||
|
AchievementCategory.CASTLE_SIEGE),
|
||||||
|
|
||||||
|
CASTLE_SIEGE_WOLF_KILL("Canine Revenge", 0,
|
||||||
|
new String[]{"Castle Siege.WolfKill"},
|
||||||
|
new String[]{"As a Castle Wolf, Kill 12 Undead in One Game"},
|
||||||
|
new int[][]{ new int[]{0,0,7000}},
|
||||||
|
new int[]{1},
|
||||||
|
"",
|
||||||
|
new String[0],
|
||||||
|
AchievementCategory.CASTLE_SIEGE),
|
||||||
|
|
||||||
|
CASTLE_SIEGE_KING_GUARD("Royal Guard", 0,
|
||||||
|
new String[]{"Castle Siege.KingGuard"},
|
||||||
|
new String[]{"Kill 5 Undead within 8 blocks of the King in One Game"},
|
||||||
|
new int[][]{ new int[]{0,0,8000}},
|
||||||
|
new int[]{1},
|
||||||
|
"",
|
||||||
|
new String[0],
|
||||||
|
AchievementCategory.CASTLE_SIEGE),
|
||||||
|
|
||||||
|
CASTLE_SIEGE_KING_FULL("Not Even a Scratch", 0,
|
||||||
|
new String[]{"Castle Siege.KingFull"},
|
||||||
|
new String[]{"Win the Game as Defense with the King at Full Health"},
|
||||||
|
new int[][]{ new int[]{0,0,8000}},
|
||||||
|
new int[]{1},
|
||||||
|
"",
|
||||||
|
new String[0],
|
||||||
|
AchievementCategory.CASTLE_SIEGE),
|
||||||
|
|
||||||
|
CASTLE_SIEGE_FIRST_BLOOD("Vigilante", 0,
|
||||||
|
new String[]{"Castle Siege.FirstBlood"},
|
||||||
|
new String[]{"Get 5 First Bloods"},
|
||||||
|
new int[][]{ new int[]{0,0,6000}},
|
||||||
|
new int[]{5},
|
||||||
|
"",
|
||||||
|
new String[0],
|
||||||
|
AchievementCategory.CASTLE_SIEGE),
|
||||||
|
|
||||||
|
CASTLE_SIEGE_TNT_KILLER("Defusal Squadron", 0,
|
||||||
|
new String[]{"Castle Siege.TNTKiller"},
|
||||||
|
new String[]{"Kill 5 TNT Carriers in One Game as Defense"},
|
||||||
|
new int[][]{ new int[]{0,0,7000}},
|
||||||
|
new int[]{1},
|
||||||
|
"",
|
||||||
|
new String[0],
|
||||||
|
AchievementCategory.CASTLE_SIEGE),
|
||||||
|
|
||||||
|
CASTLE_SIEGE_HORSE_KILLER("Equestrian Elimination", 0,
|
||||||
|
new String[]{"Castle Siege.HorseKiller"},
|
||||||
|
new String[]{"Kill 25 Horses"},
|
||||||
|
new int[][]{ new int[]{0,0,6000}},
|
||||||
|
new int[]{25},
|
||||||
|
"",
|
||||||
|
new String[0],
|
||||||
|
AchievementCategory.CASTLE_SIEGE),
|
||||||
|
|
||||||
//Castle Assault
|
//Castle Assault
|
||||||
CASTLE_ASSAULT_KILL_STREAK("Kill Streak", 0,
|
CASTLE_ASSAULT_KILL_STREAK("Kill Streak", 0,
|
||||||
new String[]{"Castle Assault.KillStreak", "Castle Assault TDM.KillStreak"},
|
new String[]{"Castle Assault.KillStreak", "Castle Assault TDM.KillStreak"},
|
||||||
|
@ -90,9 +90,31 @@ public enum AchievementCategory
|
|||||||
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleAssault.getGameId(), GameDisplay.CastleAssaultTDM.getGameId()),
|
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleAssault.getGameId(), GameDisplay.CastleAssaultTDM.getGameId()),
|
||||||
|
|
||||||
CASTLE_SIEGE("Castle Siege", null,
|
CASTLE_SIEGE("Castle Siege", null,
|
||||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"),
|
new StatDisplay[]
|
||||||
new StatDisplay("Kills as Undead"), new StatDisplay("Deaths as Undead"), StatDisplay.GEMS_EARNED },
|
{
|
||||||
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleSiege.getGameId()),
|
StatDisplay.WINS,
|
||||||
|
StatDisplay.GAMES_PLAYED,
|
||||||
|
null,
|
||||||
|
new StatDisplay(C.Bold + "Total", true),
|
||||||
|
StatDisplay.KILLS,
|
||||||
|
new StatDisplay("Assists", "Defender Assists", "Undead Assists"),
|
||||||
|
StatDisplay.DEATHS,
|
||||||
|
null,
|
||||||
|
new StatDisplay(C.Bold + "Defenders", true),
|
||||||
|
null,
|
||||||
|
StatDisplay.fromGame("Kills", GameDisplay.CastleSiege, "Defenders Kills"),
|
||||||
|
StatDisplay.fromGame("Assists", GameDisplay.CastleSiege, "Defenders Assists"),
|
||||||
|
StatDisplay.fromGame("Deaths", GameDisplay.CastleSiege, "Defenders Deaths"),
|
||||||
|
null,
|
||||||
|
new StatDisplay(C.Bold + "Undead", true),
|
||||||
|
null,
|
||||||
|
StatDisplay.fromGame("Kills", GameDisplay.CastleSiege, "Undead Kills"),
|
||||||
|
StatDisplay.fromGame("Assists", GameDisplay.CastleSiege, "Undead Assists"),
|
||||||
|
StatDisplay.fromGame("Deaths", GameDisplay.CastleSiege, "Undead Deaths"),
|
||||||
|
null,
|
||||||
|
StatDisplay.GEMS_EARNED,
|
||||||
|
},
|
||||||
|
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, "Undead Summoner & Castle Paladin Kit", false, GameDisplay.CastleSiege.getGameId()),
|
||||||
|
|
||||||
BAWK_BAWK_BATTLES("Bawk Bawk Battles", null,
|
BAWK_BAWK_BATTLES("Bawk Bawk Battles", null,
|
||||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
|
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
|
||||||
|
@ -57,14 +57,15 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
|||||||
@Override
|
@Override
|
||||||
protected void buildPage()
|
protected void buildPage()
|
||||||
{
|
{
|
||||||
int currentIndex = ACHIEVEMENT_MIDDLE_INDEX - (getAchievements().size() / 2);
|
List<Achievement> achievements = getAchievements();
|
||||||
|
int currentIndex = ACHIEVEMENT_MIDDLE_INDEX - (achievements.size() / 2);
|
||||||
boolean hasAllAchievements = true;
|
boolean hasAllAchievements = true;
|
||||||
int achievementCount = 0;
|
int achievementCount = 0;
|
||||||
|
boolean overflow = false;
|
||||||
|
|
||||||
ArrayList<String> masterAchievementLore = new ArrayList<String>();
|
ArrayList<String> masterAchievementLore = new ArrayList<>();
|
||||||
masterAchievementLore.add(" ");
|
masterAchievementLore.add(" ");
|
||||||
|
|
||||||
List<Achievement> achievements = getAchievements();
|
|
||||||
for (Achievement achievement : achievements)
|
for (Achievement achievement : achievements)
|
||||||
{
|
{
|
||||||
AchievementData data = getPlugin().get(_targetStats, achievement);
|
AchievementData data = getPlugin().get(_targetStats, achievement);
|
||||||
@ -93,13 +94,12 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> lore = new ArrayList<String>();
|
ArrayList<String> lore = new ArrayList<>();
|
||||||
lore.add(" ");
|
lore.add(" ");
|
||||||
for (String descLine : achievement.getDesc())
|
for (String descLine : achievement.getDesc())
|
||||||
{
|
{
|
||||||
lore.add(ChatColor.RESET + descLine);
|
lore.add(ChatColor.RESET + descLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!hasUnlocked && achievement.isOngoing())
|
if (!hasUnlocked && achievement.isOngoing())
|
||||||
{
|
{
|
||||||
@ -107,11 +107,64 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
|||||||
lore.add(C.cYellow + (singleLevel ? "Progress: " : "Next Level: ") + C.cWhite + data.getExpRemainder() + "/" + data.getExpNextLevel());
|
lore.add(C.cYellow + (singleLevel ? "Progress: " : "Next Level: ") + C.cWhite + data.getExpRemainder() + "/" + data.getExpNextLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasUnlocked && singleLevel)
|
if (!hasUnlocked && singleLevel && achievement.getGemReward() > 0)
|
||||||
{
|
{
|
||||||
lore.add(" ");
|
lore.add(" ");
|
||||||
lore.add(C.cYellow + "Reward: " + C.cGreen + achievement.getGemReward() + " Gems");
|
lore.add(C.cYellow + "Reward: " + C.cGreen + achievement.getGemReward() + " Gems");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasUnlocked && achievement.getLevelUpRewards().length > 0)
|
||||||
|
{
|
||||||
|
int[][] rewards = achievement.getLevelUpRewards();
|
||||||
|
|
||||||
|
if (data.getLevel() < rewards.length)
|
||||||
|
{
|
||||||
|
int[] thisRewards = rewards[data.getLevel()];
|
||||||
|
int greaterThanZero = 0;
|
||||||
|
|
||||||
|
for (int reward : thisRewards)
|
||||||
|
{
|
||||||
|
if (reward > 0)
|
||||||
|
{
|
||||||
|
greaterThanZero++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lore.add(" ");
|
||||||
|
|
||||||
|
if (greaterThanZero == 1)
|
||||||
|
{
|
||||||
|
String rewardString = C.cYellow + "Reward: ";
|
||||||
|
|
||||||
|
for (int i = 0; i < thisRewards.length; i++)
|
||||||
|
{
|
||||||
|
int reward = thisRewards[i];
|
||||||
|
|
||||||
|
if (reward > 0)
|
||||||
|
{
|
||||||
|
rewardString += getFormattedReward(reward, i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lore.add(rewardString);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lore.add(C.cYellow + "Rewards:");
|
||||||
|
|
||||||
|
for (int i = 0; i < thisRewards.length; i++)
|
||||||
|
{
|
||||||
|
int reward = thisRewards[i];
|
||||||
|
|
||||||
|
if (reward > 0)
|
||||||
|
{
|
||||||
|
lore.add(C.cWhite + " - " + getFormattedReward(reward, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (hasUnlocked && data.getLevel() == achievement.getMaxLevel())
|
if (hasUnlocked && data.getLevel() == achievement.getMaxLevel())
|
||||||
{
|
{
|
||||||
@ -126,23 +179,28 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
|||||||
masterAchievementLore.add((hasUnlocked ? C.cGreen : C.cRed) + achievement.getName());
|
masterAchievementLore.add((hasUnlocked ? C.cGreen : C.cRed) + achievement.getName());
|
||||||
|
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
achievementCount++;
|
|
||||||
|
if (achievementCount++ == 9)
|
||||||
|
{
|
||||||
|
currentIndex = ACHIEVEMENT_MIDDLE_INDEX + 9 - (achievements.size() - 9) / 2;
|
||||||
|
overflow = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Master Achievement
|
// Master Achievement
|
||||||
if (!_category.getFriendlyName().startsWith("Global") && achievementCount > 0)
|
if (!_category.getFriendlyName().startsWith("Global") && achievementCount > 0)
|
||||||
{
|
{
|
||||||
String itemName = ChatColor.RESET + _category.getFriendlyName() + " Master Achievement";
|
String itemName = C.Bold + _category.getFriendlyName() + " Master Achievement";
|
||||||
masterAchievementLore.add(" ");
|
masterAchievementLore.add(" ");
|
||||||
if (getPlayer().getName().equalsIgnoreCase(_targetName))
|
if (getPlayer().getName().equalsIgnoreCase(_targetName))
|
||||||
{
|
{
|
||||||
if (_category.getReward() != null)
|
if (_category.getReward() != null)
|
||||||
masterAchievementLore.add(C.cYellow + C.Bold + "Reward: " + ChatColor.RESET + _category.getReward());
|
masterAchievementLore.add(C.cYellow + "Reward: " + ChatColor.RESET + _category.getReward());
|
||||||
else
|
else
|
||||||
masterAchievementLore.add(C.cYellow + C.Bold + "Reward: " + ChatColor.RESET + "Coming Soon...");
|
masterAchievementLore.add(C.cYellow + "Reward: " + ChatColor.RESET + "Coming Soon...");
|
||||||
}
|
}
|
||||||
|
|
||||||
addItem(40, new ShopItem(hasAllAchievements ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, (byte) 0, itemName, masterAchievementLore.toArray(new String[0]), 1, false, true));
|
addItem(overflow ? 49 : 40, new ShopItem(hasAllAchievements ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, (byte) 0, itemName, masterAchievementLore.toArray(new String[0]), 1, false, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
addBackButton();
|
addBackButton();
|
||||||
@ -161,7 +219,6 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
|||||||
page = new ArcadeMainPage(getPlugin(), _statsManager, getShop(), getClientManager(), getDonationManager(), "Arcade Games", player, _targetName, _targetStats);
|
page = new ArcadeMainPage(getPlugin(), _statsManager, getShop(), getClientManager(), getDonationManager(), "Arcade Games", player, _targetName, _targetStats);
|
||||||
else
|
else
|
||||||
page = new AchievementMainPage(getPlugin(), _statsManager, getShop(), getClientManager(), getDonationManager(), _targetName + "'s Stats", player, _targetName, _targetStats);
|
page = new AchievementMainPage(getPlugin(), _statsManager, getShop(), getClientManager(), getDonationManager(), _targetName + "'s Stats", player, _targetName, _targetStats);
|
||||||
;
|
|
||||||
|
|
||||||
getShop().openPageForPlayer(getPlayer(), page);
|
getShop().openPageForPlayer(getPlayer(), page);
|
||||||
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
|
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
|
||||||
@ -231,4 +288,19 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
|||||||
|
|
||||||
return achievements;
|
return achievements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getFormattedReward(int reward, int type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return C.cGreen + reward + " Gems";
|
||||||
|
case 1:
|
||||||
|
return C.cGold + reward + " Crowns";
|
||||||
|
case 2:
|
||||||
|
return C.cAqua + reward + " Mineplex XP";
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ public class CastleSiege extends TeamGame
|
|||||||
|
|
||||||
registerStatTrackers(
|
registerStatTrackers(
|
||||||
new KingSlayerStatTracker(this),
|
new KingSlayerStatTracker(this),
|
||||||
new BloodThirstyStatTracker(this),
|
new BloodThirstyStatTracker(this, null, 0, null, null),
|
||||||
new KingDamageStatTracker(this),
|
new KingDamageStatTracker(this),
|
||||||
|
|
||||||
new TeamDeathsStatTracker(this),
|
new TeamDeathsStatTracker(this),
|
||||||
|
@ -7,6 +7,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
|||||||
import nautilus.game.arcade.game.Game.GameState;
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
import org.bukkit.entity.Horse.Style;
|
import org.bukkit.entity.Horse.Style;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -14,6 +15,7 @@ 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.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -107,6 +109,25 @@ public class CastleSiegeHorseManager implements Listener
|
|||||||
event.SetCancelled("Horse Team Damage");
|
event.SetCancelled("Horse Team Damage");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void horseDeath(EntityDeathEvent event)
|
||||||
|
{
|
||||||
|
Entity entity = event.getEntity();
|
||||||
|
|
||||||
|
if (entity instanceof Horse)
|
||||||
|
{
|
||||||
|
Player killer = ((Horse) entity).getKiller();
|
||||||
|
|
||||||
|
if (killer != null)
|
||||||
|
{
|
||||||
|
_host.AddStat(killer, "HorseKiller", 1, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setDroppedExp(0);
|
||||||
|
event.getDrops().clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void playerDeath(PlayerDeathEvent event)
|
public void playerDeath(PlayerDeathEvent event)
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ public class CastleSiegeKing implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void entityDamage(CustomDamageEvent event)
|
public void entityDamage(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || _entity == null || !_entity.equals(event.GetDamageeEntity()))
|
if (event.isCancelled() || _entity == null || !_entity.equals(event.GetDamageeEntity()))
|
||||||
|
@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.castlesiegenew;
|
|||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
import mineplex.core.common.util.UtilParticle;
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
@ -15,6 +16,7 @@ import mineplex.minecraft.game.core.condition.ConditionFactory;
|
|||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.GameType;
|
import nautilus.game.arcade.GameType;
|
||||||
|
import nautilus.game.arcade.events.FirstBloodEvent;
|
||||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
@ -31,6 +33,9 @@ import nautilus.game.arcade.game.modules.SpawnShieldModule;
|
|||||||
import nautilus.game.arcade.game.modules.compass.CompassModule;
|
import nautilus.game.arcade.game.modules.compass.CompassModule;
|
||||||
import nautilus.game.arcade.kit.Kit;
|
import nautilus.game.arcade.kit.Kit;
|
||||||
import nautilus.game.arcade.kit.NullKit;
|
import nautilus.game.arcade.kit.NullKit;
|
||||||
|
import nautilus.game.arcade.stats.BloodThirstyStatTracker;
|
||||||
|
import nautilus.game.arcade.stats.TeamDeathsStatTracker;
|
||||||
|
import nautilus.game.arcade.stats.TeamKillsStatTracker;
|
||||||
import nautilus.game.arcade.stats.WinAsTeamStatTracker;
|
import nautilus.game.arcade.stats.WinAsTeamStatTracker;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -81,7 +86,7 @@ public class CastleSiegeNew extends TeamGame
|
|||||||
};
|
};
|
||||||
private static final int START_TIME = 14000;
|
private static final int START_TIME = 14000;
|
||||||
private static final int UNDEAD_BURN_TIME = 24000;
|
private static final int UNDEAD_BURN_TIME = 24000;
|
||||||
private static final int DEFENDER_WIN_TIME = UNDEAD_BURN_TIME + 100;
|
private static final int DEFENDER_WIN_TIME = UNDEAD_BURN_TIME + 200;
|
||||||
private static final int WOLF_RESPAWN_TIME = 6;
|
private static final int WOLF_RESPAWN_TIME = 6;
|
||||||
private static final long FENCE_NO_CLIP_TIME = TimeUnit.SECONDS.toMillis(2);
|
private static final long FENCE_NO_CLIP_TIME = TimeUnit.SECONDS.toMillis(2);
|
||||||
|
|
||||||
@ -126,6 +131,14 @@ public class CastleSiegeNew extends TeamGame
|
|||||||
|
|
||||||
manager.GetCreature().SetDisableCustomDrops(true);
|
manager.GetCreature().SetDisableCustomDrops(true);
|
||||||
|
|
||||||
|
registerStatTrackers(
|
||||||
|
new BloodThirstyStatTracker(this, "KingGuard", 5, player -> getDefenders().HasPlayer(player), player -> UtilMath.offsetSquared(player, getKing().getEntity()) < 8 * 8),
|
||||||
|
new BloodThirstyStatTracker(this, "WolfKill", 12, this::isWolf, player -> true),
|
||||||
|
new BloodThirstyStatTracker(this, "BloodThirsty", 50, player -> true, player -> GetTeam(player).equals(getUndead())),
|
||||||
|
new TeamKillsStatTracker(this),
|
||||||
|
new TeamDeathsStatTracker(this)
|
||||||
|
);
|
||||||
|
|
||||||
registerChatStats(
|
registerChatStats(
|
||||||
Kills,
|
Kills,
|
||||||
Deaths,
|
Deaths,
|
||||||
@ -356,6 +369,12 @@ public class CastleSiegeNew extends TeamGame
|
|||||||
|
|
||||||
if (WorldTimeSet > DEFENDER_WIN_TIME || _undead.GetPlayers(true).isEmpty())
|
if (WorldTimeSet > DEFENDER_WIN_TIME || _undead.GetPlayers(true).isEmpty())
|
||||||
{
|
{
|
||||||
|
// King at full health
|
||||||
|
if (king.getHealth() == king.getMaxHealth())
|
||||||
|
{
|
||||||
|
_defenders.GetPlayers(true).forEach(player -> AddStat(player, "KingFull", 1, true, false));
|
||||||
|
}
|
||||||
|
|
||||||
SetCustomWinLine(king.getCustomName() + C.Reset + " has survived the siege!");
|
SetCustomWinLine(king.getCustomName() + C.Reset + " has survived the siege!");
|
||||||
AnnounceEnd(_defenders);
|
AnnounceEnd(_defenders);
|
||||||
}
|
}
|
||||||
@ -396,6 +415,20 @@ public class CastleSiegeNew extends TeamGame
|
|||||||
{
|
{
|
||||||
winLine += "was killed by " + _undead.GetColor() + _king.getLastDamager().getName() + C.Reset + " while " + _undead.GetColor() + mostDamager.getName() + C.Reset + " dealt most of the damage!";
|
winLine += "was killed by " + _undead.GetColor() + _king.getLastDamager().getName() + C.Reset + " while " + _undead.GetColor() + mostDamager.getName() + C.Reset + " dealt most of the damage!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 50%+ damage to the king
|
||||||
|
if (mostDamage >= (king.getMaxHealth() - king.getHealth()) * 0.5)
|
||||||
|
{
|
||||||
|
AddStat(mostDamager, "Assassin", 1, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Player who killed the king
|
||||||
|
AddStat(_king.getLastDamager(), "KingSlayer", 1, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WorldTimeSet > UNDEAD_BURN_TIME - 60 * 20)
|
||||||
|
{
|
||||||
|
_undead.GetPlayers(true).forEach(player -> AddStat(player, "CloseCall", 1, true, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCustomWinLine(winLine);
|
SetCustomWinLine(winLine);
|
||||||
@ -478,10 +511,13 @@ public class CastleSiegeNew extends TeamGame
|
|||||||
|
|
||||||
Kit kit = GetKit(event.getPlayer());
|
Kit kit = GetKit(event.getPlayer());
|
||||||
|
|
||||||
if (kit == null || !(kit instanceof KitUndeadArcher))
|
event.setCancelled(kit == null || !(kit instanceof KitUndeadArcher));
|
||||||
{
|
}
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
@EventHandler
|
||||||
|
public void firstBlood(FirstBloodEvent event)
|
||||||
|
{
|
||||||
|
AddStat(event.getPlayer(), "FirstBlood", 1, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -508,6 +544,11 @@ public class CastleSiegeNew extends TeamGame
|
|||||||
return _wolves.contains(player);
|
return _wolves.contains(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CastleSiegeKing getKing()
|
||||||
|
{
|
||||||
|
return _king;
|
||||||
|
}
|
||||||
|
|
||||||
public GameTeam getDefenders()
|
public GameTeam getDefenders()
|
||||||
{
|
{
|
||||||
return _defenders;
|
return _defenders;
|
||||||
|
@ -35,8 +35,10 @@ import org.bukkit.event.block.Action;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -148,7 +150,7 @@ public class CastleSiegeTNTManager implements Listener
|
|||||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||||
|
|
||||||
player.sendMessage(F.main("Game", "You picked up " + F.skill("TNT") + "."));
|
player.sendMessage(F.main("Game", "You picked up " + F.skill("TNT") + "."));
|
||||||
player.sendMessage(F.main("Game", "Clicking will detonate yourself."));
|
player.sendMessage(F.main("Game", F.elem("Click") + " to " + F.skill("Detonate") + " yourself."));
|
||||||
_tntCarrier.put(player, System.currentTimeMillis());
|
_tntCarrier.put(player, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +213,15 @@ public class CastleSiegeTNTManager implements Listener
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void playerDeath(PlayerDeathEvent event)
|
public void playerDeath(PlayerDeathEvent event)
|
||||||
{
|
{
|
||||||
detonate(event.getEntity(), false);
|
Player killed = event.getEntity();
|
||||||
|
Player killer = killed.getKiller();
|
||||||
|
|
||||||
|
if (killer != null && _tntCarrier.containsKey(killed))
|
||||||
|
{
|
||||||
|
_host.AddStat(killer, "TNTKiller", 1, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
detonate(killed, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -240,6 +250,7 @@ public class CastleSiegeTNTManager implements Listener
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_tntCarrier.remove(player);
|
_tntCarrier.remove(player);
|
||||||
|
player.getInventory().setHelmet(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -302,4 +313,16 @@ public class CastleSiegeTNTManager implements Listener
|
|||||||
restore.add(block, Material.AIR.getId(), (byte) 0, (long) (REGENERATION_TIME + (block.getLocation().getBlockY() - lowestY) * 2000 + Math.random() * 1750));
|
restore.add(block, Material.AIR.getId(), (byte) 0, (long) (REGENERATION_TIME + (block.getLocation().getBlockY() - lowestY) * 2000 + Math.random() * 1750));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void tntClick(InventoryClickEvent event)
|
||||||
|
{
|
||||||
|
Inventory inventory = event.getClickedInventory();
|
||||||
|
ItemStack itemStack = event.getCurrentItem();
|
||||||
|
|
||||||
|
if (inventory != null && itemStack != null && itemStack.getType() == Material.TNT)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,14 @@ import mineplex.core.disguise.disguises.DisguiseInsentient;
|
|||||||
import mineplex.core.disguise.disguises.DisguiseSkeleton;
|
import mineplex.core.disguise.disguises.DisguiseSkeleton;
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
|
import nautilus.game.arcade.game.games.castlesiegenew.CastleSiegeNew;
|
||||||
import nautilus.game.arcade.kit.KitAvailability;
|
import nautilus.game.arcade.kit.KitAvailability;
|
||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
import nautilus.game.arcade.kit.ProgressingKit;
|
import nautilus.game.arcade.kit.ProgressingKit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
@ -32,44 +32,46 @@ public class KitHumanKnight extends KitCastleSiege
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
new PerkMammoth(),
|
new PerkMammoth(),
|
||||||
new PerkConstructor("Constructor", 40, 2, Material.FENCE, "Castle Barricade", true)
|
new PerkConstructor("Constructor", 38, 2, Material.FENCE, "Castle Barricade", true)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
new PerkMammoth(),
|
new PerkMammoth(),
|
||||||
new PerkConstructor("Constructor", 40, 2, Material.FENCE, "Castle Barricade", true)
|
new PerkConstructor("Constructor", 36, 2, Material.FENCE, "Castle Barricade", true)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
new PerkMammoth(),
|
new PerkMammoth(),
|
||||||
new PerkConstructor("Constructor", 40, 3, Material.FENCE, "Castle Barricade", true)
|
new PerkConstructor("Constructor", 34, 3, Material.FENCE, "Castle Barricade", true)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
new PerkMammoth(),
|
new PerkMammoth(),
|
||||||
new PerkConstructor("Constructor", 40, 3, Material.FENCE, "Castle Barricade", true)
|
new PerkConstructor("Constructor", 30, 3, Material.FENCE, "Castle Barricade", true)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
new PerkMammoth(),
|
new PerkMammoth(),
|
||||||
new PerkConstructor("Constructor", 40, 3, Material.FENCE, "Castle Barricade", true)
|
new PerkConstructor("Constructor", 25, 3, Material.FENCE, "Castle Barricade", true)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final String REDUCE_COOLDOWN = reduceCooldown("Constructor", 4);
|
private static final String REDUCE_COOLDOWN_2 = reduceCooldown("Constructor", 2);
|
||||||
|
private static final String REDUCE_COOLDOWN_4 = reduceCooldown("Constructor", 4);
|
||||||
|
private static final String REDUCE_COOLDOWN_5 = reduceCooldown("Constructor", 5);
|
||||||
private static final String[][] UPGRADES = {
|
private static final String[][] UPGRADES = {
|
||||||
{
|
{
|
||||||
REDUCE_COOLDOWN
|
REDUCE_COOLDOWN_2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
REDUCE_COOLDOWN
|
REDUCE_COOLDOWN_2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
REDUCE_COOLDOWN,
|
REDUCE_COOLDOWN_2,
|
||||||
increaseNumber("Constructor", "Maximum Fences", 1, "Fences")
|
increaseNumber("Constructor", "Maximum Fences", 1, "Fences")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
REDUCE_COOLDOWN,
|
REDUCE_COOLDOWN_4,
|
||||||
receiveItem("Diamond Helmet", 1)
|
receiveItem("Diamond Helmet", 1)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
REDUCE_COOLDOWN,
|
REDUCE_COOLDOWN_5,
|
||||||
receiveItem("Diamond Chestplate", 1)
|
receiveItem("Diamond Chestplate", 1)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -32,40 +32,41 @@ public class KitHumanMarksman extends KitCastleSiege
|
|||||||
new PerkBarrage(5, 250, true, false),
|
new PerkBarrage(5, 250, true, false),
|
||||||
new PerkFletcher(2, 4, false),
|
new PerkFletcher(2, 4, false),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
new PerkBarrage(5, 250, true, false),
|
||||||
|
new PerkFletcher(1, 4, false),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
new PerkBarrage(6, 250, true, false),
|
||||||
|
new PerkFletcher(1, 4, false),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
new PerkBarrage(7, 250, true, false),
|
new PerkBarrage(7, 250, true, false),
|
||||||
new PerkFletcher(2, 4, false),
|
new PerkFletcher(1, 4, false),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
new PerkBarrage(9, 250, true, false),
|
new PerkBarrage(9, 250, true, false),
|
||||||
new PerkFletcher(2, 4, false),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
new PerkBarrage(11, 250, true, false),
|
|
||||||
new PerkFletcher(2, 4, false),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
new PerkBarrage(11, 250, true, false),
|
|
||||||
new PerkFletcher(1, 4, false),
|
new PerkFletcher(1, 4, false),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final String MORE_BARRAGE_ARROWS = increaseNumber("Barrage", "Arrows Fired", 2, "Arrows");
|
private static final String MORE_BARRAGE_ARROWS_1 = increaseNumber("Barrage", "Arrows Fired", 2, "Arrows");
|
||||||
|
private static final String MORE_BARRAGE_ARROWS_2 = increaseNumber("Barrage", "Arrows Fired", 2, "Arrows");
|
||||||
private static final String[][] UPGRADES = {
|
private static final String[][] UPGRADES = {
|
||||||
{
|
{
|
||||||
receiveItem("2 Extra Mushroom Stews", 1)
|
receiveItem("2 Extra Mushroom Stews", 1)
|
||||||
},
|
},
|
||||||
{
|
|
||||||
MORE_BARRAGE_ARROWS
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MORE_BARRAGE_ARROWS
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MORE_BARRAGE_ARROWS
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
reduceCooldown("Fletched Arrows", 1)
|
reduceCooldown("Fletched Arrows", 1)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MORE_BARRAGE_ARROWS_1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MORE_BARRAGE_ARROWS_1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MORE_BARRAGE_ARROWS_2
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,57 +25,57 @@ public class KitHumanPaladin extends KitCastleSiege
|
|||||||
"",
|
"",
|
||||||
click(false, "your sword") + " to give buffs to nearby humans and wolves",
|
click(false, "your sword") + " to give buffs to nearby humans and wolves",
|
||||||
"Wolves receive " + C.cGreen + "Speed I" + C.cWhite + " and Humans receive " + C.cGreen + "Resistance I",
|
"Wolves receive " + C.cGreen + "Speed I" + C.cWhite + " and Humans receive " + C.cGreen + "Resistance I",
|
||||||
"Take " + C.cGreen + "20%" + C.cWhite + " less damage from attacks",
|
"Take " + C.cGreen + "10%" + C.cWhite + " less damage from attacks",
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final String BOOST = C.cGreen + "Morale Royale" + C.cWhite;
|
private static final String BOOST = C.cGreen + "Morale Royale" + C.cWhite;
|
||||||
private static final int EIGHT_TICKS = 8 * 20;
|
private static final int EIGHT_TICKS = 8 * 20;
|
||||||
private static final int TEN_TICKS = 8 * 20;
|
private static final int NINE_TICKS = 9 * 20;
|
||||||
private static final int TWELEVE_TICKS = 8 * 20;
|
private static final int TEN_TICKS = 10 * 20;
|
||||||
private static final Perk[][] PERKS = {
|
private static final Perk[][] PERKS = {
|
||||||
{
|
{
|
||||||
new PerkIronSkin(0.2, true),
|
new PerkIronSkin(0.1, true),
|
||||||
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(28),
|
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(28),
|
||||||
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, EIGHT_TICKS, 0, false, false)
|
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, EIGHT_TICKS, 0, false, false)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
new PerkIronSkin(0.2, true),
|
new PerkIronSkin(0.1, true),
|
||||||
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(28),
|
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(28),
|
||||||
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TEN_TICKS, 0, false, false),
|
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, NINE_TICKS, 0, false, false),
|
||||||
new PotionEffect(PotionEffectType.REGENERATION, TEN_TICKS, 0, false, false)
|
new PotionEffect(PotionEffectType.REGENERATION, NINE_TICKS, 0, false, false)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
new PerkIronSkin(0.2, true),
|
new PerkIronSkin(0.1, true),
|
||||||
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(26),
|
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(27),
|
||||||
|
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, NINE_TICKS, 0, false, false),
|
||||||
|
new PotionEffect(PotionEffectType.REGENERATION, NINE_TICKS, 0, false, false),
|
||||||
|
new PotionEffect(PotionEffectType.HEALTH_BOOST, NINE_TICKS, 0, false, false)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
new PerkIronSkin(0.1, true),
|
||||||
|
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(27),
|
||||||
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TEN_TICKS, 0, false, false),
|
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TEN_TICKS, 0, false, false),
|
||||||
new PotionEffect(PotionEffectType.REGENERATION, TEN_TICKS, 0, false, false),
|
new PotionEffect(PotionEffectType.REGENERATION, TEN_TICKS, 1, false, false),
|
||||||
|
new PotionEffect(PotionEffectType.HEALTH_BOOST, TEN_TICKS, 0, false, false)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
new PerkIronSkin(0.1, true),
|
||||||
|
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(26),
|
||||||
|
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TEN_TICKS, 1, false, false),
|
||||||
|
new PotionEffect(PotionEffectType.REGENERATION, TEN_TICKS, 1, false, false),
|
||||||
new PotionEffect(PotionEffectType.HEALTH_BOOST, TEN_TICKS, 0, false, false)
|
new PotionEffect(PotionEffectType.HEALTH_BOOST, TEN_TICKS, 0, false, false)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
|
||||||
new PerkIronSkin(0.2, true),
|
|
||||||
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(26),
|
|
||||||
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TWELEVE_TICKS, 0, false, false),
|
|
||||||
new PotionEffect(PotionEffectType.REGENERATION, TWELEVE_TICKS, 1, false, false),
|
|
||||||
new PotionEffect(PotionEffectType.HEALTH_BOOST, TWELEVE_TICKS, 0, false, false)
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
new PerkIronSkin(0.2, true),
|
new PerkIronSkin(0.2, true),
|
||||||
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(24),
|
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(24),
|
||||||
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TWELEVE_TICKS, 1, false, false),
|
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TEN_TICKS, 1, false, false),
|
||||||
new PotionEffect(PotionEffectType.REGENERATION, TWELEVE_TICKS, 1, false, false),
|
new PotionEffect(PotionEffectType.REGENERATION, TEN_TICKS, 1, false, false),
|
||||||
new PotionEffect(PotionEffectType.HEALTH_BOOST, TWELEVE_TICKS, 0, false, false)
|
new PotionEffect(PotionEffectType.HEALTH_BOOST, TEN_TICKS, 1, false, false)
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
new PerkIronSkin(0.4, true),
|
|
||||||
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(24),
|
|
||||||
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TWELEVE_TICKS, 1, false, false),
|
|
||||||
new PotionEffect(PotionEffectType.REGENERATION, TWELEVE_TICKS, 1, false, false),
|
|
||||||
new PotionEffect(PotionEffectType.HEALTH_BOOST, TWELEVE_TICKS, 1, false, false)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -85,8 +85,8 @@ public class KitHumanPaladin extends KitCastleSiege
|
|||||||
return BOOST + " gives " + C.cGreen + effect;
|
return BOOST + " gives " + C.cGreen + effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String REDUCE_COOLDOWN = reduceCooldown(BOOST, 2);
|
private static final String REDUCE_COOLDOWN = reduceCooldown(BOOST, 1);
|
||||||
private static final String INCREASE_LENGTH = increaseNumber(BOOST, "Buff Length", 2, "seconds");
|
private static final String INCREASE_LENGTH = increaseNumber(BOOST, "Buff Length", 1, "seconds");
|
||||||
|
|
||||||
private static final String[][] UPGRADES = {
|
private static final String[][] UPGRADES = {
|
||||||
{
|
{
|
||||||
@ -106,7 +106,7 @@ public class KitHumanPaladin extends KitCastleSiege
|
|||||||
giveEffect("Resistance II")
|
giveEffect("Resistance II")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
C.cWhite + "Take " + C.cGreen + "40%" + C.cWhite + " less damage from attacks",
|
C.cWhite + "Take " + C.cGreen + "20%" + C.cWhite + " less damage from attacks",
|
||||||
giveEffect("Health Boost II")
|
giveEffect("Health Boost II")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -114,7 +114,7 @@ public class KitHumanPaladin extends KitCastleSiege
|
|||||||
private static final ItemStack[] PLAYER_ITEMS = {
|
private static final ItemStack[] PLAYER_ITEMS = {
|
||||||
ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD),
|
ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.BOW),
|
ItemStackFactory.Instance.CreateStack(Material.BOW),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.ARROW, 64),
|
ItemStackFactory.Instance.CreateStack(Material.ARROW, 48),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP),
|
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP),
|
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP),
|
ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP),
|
||||||
@ -122,9 +122,9 @@ public class KitHumanPaladin extends KitCastleSiege
|
|||||||
};
|
};
|
||||||
|
|
||||||
private static final ItemStack[] ARMOR = {
|
private static final ItemStack[] ARMOR = {
|
||||||
ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS),
|
ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS),
|
ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE),
|
ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET)
|
ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public class KitHumanWolf extends KitCastleSiege
|
|||||||
disguise(player, DisguiseWolf.class);
|
disguise(player, DisguiseWolf.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void damage(CustomDamageEvent event)
|
public void damage(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || !Manager.GetGame().IsLive())
|
if (event.isCancelled() || !Manager.GetGame().IsLive())
|
||||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.castlesiegenew.kits;
|
|||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.disguise.disguises.DisguiseSkeleton;
|
import mineplex.core.disguise.disguises.DisguiseSkeleton;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.king.CastleManager;
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.kit.KitAvailability;
|
import nautilus.game.arcade.kit.KitAvailability;
|
||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
@ -9,6 +10,7 @@ import nautilus.game.arcade.kit.perks.PerkFletcher;
|
|||||||
import nautilus.game.arcade.kit.perks.PerkIronSkin;
|
import nautilus.game.arcade.kit.perks.PerkIronSkin;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import nautilus.game.arcade.kit.perks.PerkLeap;
|
|||||||
import nautilus.game.arcade.kit.perks.PerkSpeed;
|
import nautilus.game.arcade.kit.perks.PerkSpeed;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import nautilus.game.arcade.kit.KitAvailability;
|
|||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
@ -8,7 +8,9 @@ import mineplex.core.common.util.UtilTime;
|
|||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
|
import nautilus.game.arcade.game.games.castlesiegenew.CastleSiegeNew;
|
||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -82,13 +84,18 @@ public class PerkMobPotions extends Perk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clickedPotion == null || !Recharge.Instance.use(player, ChatColor.stripColor(clickedPotion.getItemStack().getItemMeta().getDisplayName()), _cooldown, true, true))
|
if (clickedPotion == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
if (!Recharge.Instance.use(player, ChatColor.stripColor(clickedPotion.getItemStack().getItemMeta().getDisplayName()), _cooldown, true, true))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Manager.GetGame().CreatureAllowOverride = true;
|
Manager.GetGame().CreatureAllowOverride = true;
|
||||||
|
|
||||||
Location location = player.getEyeLocation();
|
Location location = player.getEyeLocation();
|
||||||
@ -97,15 +104,6 @@ public class PerkMobPotions extends Perk
|
|||||||
|
|
||||||
_thrownPotions.put(potion, Pair.create(player, clickedPotion));
|
_thrownPotions.put(potion, Pair.create(player, clickedPotion));
|
||||||
|
|
||||||
// if (itemStack.getAmount() > 1)
|
|
||||||
// {
|
|
||||||
// itemStack.setAmount(itemStack.getAmount() - 1);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// player.setItemInHand(null);
|
|
||||||
// }
|
|
||||||
|
|
||||||
Manager.GetGame().CreatureAllowOverride = false;
|
Manager.GetGame().CreatureAllowOverride = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +178,7 @@ public class PerkMobPotions extends Perk
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void entityTarget(EntityDeathEvent event)
|
public void entityDeath(EntityDeathEvent event)
|
||||||
{
|
{
|
||||||
for (SummonedEntity entity : _entities)
|
for (SummonedEntity entity : _entities)
|
||||||
{
|
{
|
||||||
@ -195,6 +193,27 @@ public class PerkMobPotions extends Perk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void entityDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
for (SummonedEntity entity : _entities)
|
||||||
|
{
|
||||||
|
if (entity.Summoned.equals(event.GetDamageeEntity()))
|
||||||
|
{
|
||||||
|
Player damager = event.GetDamagerPlayer(true);
|
||||||
|
CastleSiegeNew game = (CastleSiegeNew) Manager.GetGame();
|
||||||
|
|
||||||
|
if (damager == null || !game.getUndead().HasPlayer(damager))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.SetCancelled("Team Mob");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public MobPotion[] getMobPotions()
|
public MobPotion[] getMobPotions()
|
||||||
{
|
{
|
||||||
return _mobPotions;
|
return _mobPotions;
|
||||||
|
@ -55,7 +55,7 @@ public class PerkPaladinBoost extends Perk
|
|||||||
CastleSiegeNew game = (CastleSiegeNew) Manager.GetGame();
|
CastleSiegeNew game = (CastleSiegeNew) Manager.GetGame();
|
||||||
GameTeam team = game.GetTeam(player);
|
GameTeam team = game.GetTeam(player);
|
||||||
|
|
||||||
player.sendMessage(F.main("Game", "You used " + F.name(GetName()) + "."));
|
player.sendMessage(F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||||
|
|
||||||
for (Player nearby : UtilPlayer.getNearby(player.getLocation(), RADIUS))
|
for (Player nearby : UtilPlayer.getNearby(player.getLocation(), RADIUS))
|
||||||
{
|
{
|
||||||
@ -64,7 +64,7 @@ public class PerkPaladinBoost extends Perk
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilParticle.PlayParticleToAll(ParticleType.HEART, nearby.getLocation().add(0, 1, 0), 1, 1, 1, 0.01F, 8, ViewDist.LONG);
|
UtilParticle.PlayParticleToAll(ParticleType.HEART, nearby.getLocation().add(0, 1.2, 0), 0.5F, 0.5F, 0.5F, 0.01F, 8, ViewDist.LONG);
|
||||||
nearby.playSound(nearby.getLocation(), Sound.ZOMBIE_REMEDY, 1, 0.6F);
|
nearby.playSound(nearby.getLocation(), Sound.ZOMBIE_REMEDY, 1, 0.6F);
|
||||||
nearby.sendMessage(F.main("Game", "Paladin " + F.name(player.getName()) + " has given you buffs!"));
|
nearby.sendMessage(F.main("Game", "Paladin " + F.name(player.getName()) + " has given you buffs!"));
|
||||||
|
|
||||||
|
@ -1,64 +1,74 @@
|
|||||||
package nautilus.game.arcade.stats;
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import java.util.Map;
|
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||||
import java.util.UUID;
|
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||||
|
import nautilus.game.arcade.game.Game;
|
||||||
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 mineplex.core.common.util.UtilPlayer;
|
import java.util.HashMap;
|
||||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
import java.util.Map;
|
||||||
import nautilus.game.arcade.game.Game;
|
import java.util.UUID;
|
||||||
import nautilus.game.arcade.game.games.castlesiege.kits.KitUndead;
|
import java.util.function.Predicate;
|
||||||
import nautilus.game.arcade.game.games.hideseek.kits.KitSeeker;
|
|
||||||
|
|
||||||
public class BloodThirstyStatTracker extends StatTracker<Game>
|
public class BloodThirstyStatTracker extends StatTracker<Game>
|
||||||
{
|
{
|
||||||
private final Map<UUID, Integer> _kills = new HashMap<>();
|
|
||||||
|
|
||||||
public BloodThirstyStatTracker(Game game)
|
private final Map<UUID, Integer> _kills = new HashMap<>();
|
||||||
|
private final String _stat;
|
||||||
|
private final int _amount;
|
||||||
|
private final Predicate<Player> _validKiller;
|
||||||
|
private final Predicate<Player> _validKilled;
|
||||||
|
|
||||||
|
public BloodThirstyStatTracker(Game game, String stat, int amount, Predicate<Player> validKiller, Predicate<Player> validKilled)
|
||||||
{
|
{
|
||||||
super(game);
|
super(game);
|
||||||
|
|
||||||
|
_stat = stat;
|
||||||
|
_amount = amount;
|
||||||
|
_validKiller = validKiller;
|
||||||
|
_validKilled = validKilled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onCombatDeath(CombatDeathEvent event)
|
public void onCombatDeath(CombatDeathEvent event)
|
||||||
{
|
{
|
||||||
if (getGame().GetState() != Game.GameState.Live)
|
CombatComponent player = event.GetLog().GetPlayer();
|
||||||
return;
|
CombatComponent killer = event.GetLog().GetKiller();
|
||||||
|
|
||||||
if (event.GetLog().GetKiller() == null)
|
if (!getGame().IsLive() || player == null || killer == null || !player.IsPlayer() || !killer.IsPlayer())
|
||||||
return;
|
|
||||||
|
|
||||||
if (!event.GetLog().GetKiller().IsPlayer())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
|
||||||
if (killer == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.GetLog().GetPlayer() == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!event.GetLog().GetPlayer().IsPlayer())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
|
|
||||||
if (player == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (getGame().GetKit(player) instanceof KitUndead)
|
|
||||||
{
|
{
|
||||||
Integer kills = _kills.get(killer.getUniqueId());
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
kills = (kills == null ? 0 : kills) + 1;
|
Player killerPlayer = UtilPlayer.searchExact(killer.GetName());
|
||||||
|
|
||||||
_kills.put(killer.getUniqueId(), kills);
|
if (killerPlayer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (kills >= 50)
|
Player killedPlayer = UtilPlayer.searchExact(player.GetName());
|
||||||
addStat(killer, "BloodThirsty", 1, true, false);
|
|
||||||
|
if (killedPlayer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_validKiller != null && !_validKiller.test(killerPlayer) || _validKilled != null && !_validKilled.test(killedPlayer))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int newKills = _kills.getOrDefault(killerPlayer.getUniqueId(), 0) + 1;
|
||||||
|
|
||||||
|
_kills.put(killerPlayer.getUniqueId(), newKills);
|
||||||
|
|
||||||
|
if (newKills >= _amount)
|
||||||
|
{
|
||||||
|
addStat(killerPlayer, _stat, 1, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package nautilus.game.arcade.stats;
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||||
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;
|
||||||
@ -16,28 +17,26 @@ public class TeamDeathsStatTracker extends StatTracker<Game>
|
|||||||
super(game);
|
super(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onCombatDeath(CombatDeathEvent event)
|
public void onCombatDeath(CombatDeathEvent event)
|
||||||
{
|
{
|
||||||
if (getGame().GetState() != Game.GameState.Live)
|
CombatComponent component = event.GetLog().GetPlayer();
|
||||||
|
|
||||||
|
if (!getGame().IsLive() || getGame().GetTeamList().size() < 2 || component == null || !component.IsPlayer())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (getGame().GetTeamList().size() < 2)
|
Player player = UtilPlayer.searchExact(component.GetName());
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.GetLog().GetPlayer() == null)
|
if (player != null)
|
||||||
return;
|
{
|
||||||
|
GameTeam team = getGame().GetTeam(player);
|
||||||
|
|
||||||
if (!event.GetLog().GetPlayer().IsPlayer())
|
if (team != null && team.GetName() != null)
|
||||||
return;
|
{
|
||||||
|
addStat(player, team.GetName() + " Deaths", 1, false, false);
|
||||||
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
|
}
|
||||||
if (player == null)
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
GameTeam team = getGame().GetTeam(player);
|
|
||||||
|
|
||||||
if (team != null && team.GetName() != null)
|
|
||||||
addStat(player, team.GetName() + " Deaths", 1, false, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package nautilus.game.arcade.stats;
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||||
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;
|
||||||
@ -11,33 +12,54 @@ import nautilus.game.arcade.game.GameTeam;
|
|||||||
|
|
||||||
public class TeamKillsStatTracker extends StatTracker<Game>
|
public class TeamKillsStatTracker extends StatTracker<Game>
|
||||||
{
|
{
|
||||||
|
|
||||||
public TeamKillsStatTracker(Game game)
|
public TeamKillsStatTracker(Game game)
|
||||||
{
|
{
|
||||||
super(game);
|
super(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onCombatDeath(CombatDeathEvent event)
|
public void onCombatDeath(CombatDeathEvent event)
|
||||||
{
|
{
|
||||||
if (getGame().GetState() != Game.GameState.Live)
|
CombatComponent killer = event.GetLog().GetKiller();
|
||||||
|
|
||||||
|
if (!getGame().IsLive() || getGame().GetTeamList().size() < 2 || killer == null || !killer.IsPlayer())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (getGame().GetTeamList().size() < 2)
|
Player player = UtilPlayer.searchExact(killer.GetName());
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.GetLog().GetKiller() == null)
|
if (player != null)
|
||||||
return;
|
{
|
||||||
|
GameTeam team = getGame().GetTeam(player);
|
||||||
|
|
||||||
if (!event.GetLog().GetKiller().IsPlayer())
|
if (team != null && team.GetName() != null)
|
||||||
return;
|
{
|
||||||
|
addStat(player, team.GetName() + " Kills", 1, false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
for (CombatComponent attacker : event.GetLog().GetAttackers())
|
||||||
if (player == null)
|
{
|
||||||
return;
|
if (!attacker.IsPlayer() || killer.equals(attacker))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
GameTeam team = getGame().GetTeam(player);
|
Player assist = UtilPlayer.searchExact(attacker.GetName());
|
||||||
|
|
||||||
if (team != null && team.GetName() != null)
|
if (assist == null)
|
||||||
addStat(player, team.GetName() + " Kills", 1, false, false);
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameTeam team = getGame().GetTeam(assist);
|
||||||
|
|
||||||
|
if (team != null && team.GetName() != null)
|
||||||
|
{
|
||||||
|
addStat(assist, team.GetName() + " Assists", 1, false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user