Implementation of achievements
This commit is contained in:
parent
e8eb364d99
commit
abf51064b3
@ -382,28 +382,103 @@ public enum Achievement
|
||||
AchievementCategory.MASTER_BUILDERS),
|
||||
|
||||
//Castle Siege
|
||||
CASTLE_SIEGE_WINS("FOR THE KING!", 600,
|
||||
CASTLE_SIEGE_WINS("FOR THE KING!", 0,
|
||||
new String[]{"Castle Siege.ForTheKing"},
|
||||
new String[]{"Win as Defenders 50 times"},
|
||||
new int[][]{ new int[]{0,0,10000}},
|
||||
new int[]{50},
|
||||
"",
|
||||
new String[0],
|
||||
AchievementCategory.CASTLE_SIEGE),
|
||||
|
||||
CASTLE_SIEGE_KINGSLAYER("Kingslayer", 800,
|
||||
CASTLE_SIEGE_KINGSLAYER("Kingslayer", 0,
|
||||
new String[]{"Castle Siege.KingSlayer"},
|
||||
new String[]{"Get the killing blow on the King"},
|
||||
new int[][]{ new int[]{0,0,4000}},
|
||||
new int[]{1},
|
||||
"",
|
||||
new String[0],
|
||||
AchievementCategory.CASTLE_SIEGE),
|
||||
|
||||
CASTLE_SIEGE_BLOOD_THIRSTY("Blood Thirsty", 1200,
|
||||
CASTLE_SIEGE_BLOOD_THIRSTY("Blood Thirsty", 0,
|
||||
new String[]{"Castle Siege.BloodThirsty"},
|
||||
new String[]{"Kill 50 Undead in a single game"},
|
||||
new int[][]{ new int[]{0,0,8000}},
|
||||
new int[]{1},
|
||||
"",
|
||||
new String[0],
|
||||
AchievementCategory.CASTLE_SIEGE),
|
||||
|
||||
CASTLE_SIEGE_ASSASSIN("Assassin", 1000,
|
||||
CASTLE_SIEGE_ASSASSIN("Assassin", 0,
|
||||
new String[]{"Castle Siege.Assassin"},
|
||||
new String[]{"Do 50% or more of the damage to the king"},
|
||||
new int[][]{ new int[]{0,0,8000}},
|
||||
new int[]{1},
|
||||
"",
|
||||
new String[0],
|
||||
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
|
||||
|
@ -90,9 +90,31 @@ public enum AchievementCategory
|
||||
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleAssault.getGameId(), GameDisplay.CastleAssaultTDM.getGameId()),
|
||||
|
||||
CASTLE_SIEGE("Castle Siege", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"),
|
||||
new StatDisplay("Kills as Undead"), new StatDisplay("Deaths as Undead"), StatDisplay.GEMS_EARNED },
|
||||
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleSiege.getGameId()),
|
||||
new StatDisplay[]
|
||||
{
|
||||
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,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
|
||||
|
@ -57,14 +57,15 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
||||
@Override
|
||||
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;
|
||||
int achievementCount = 0;
|
||||
boolean overflow = false;
|
||||
|
||||
ArrayList<String> masterAchievementLore = new ArrayList<String>();
|
||||
ArrayList<String> masterAchievementLore = new ArrayList<>();
|
||||
masterAchievementLore.add(" ");
|
||||
|
||||
List<Achievement> achievements = getAchievements();
|
||||
for (Achievement achievement : achievements)
|
||||
{
|
||||
AchievementData data = getPlugin().get(_targetStats, achievement);
|
||||
@ -93,26 +94,78 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(" ");
|
||||
for (String descLine : achievement.getDesc())
|
||||
{
|
||||
lore.add(ChatColor.RESET + descLine);
|
||||
}
|
||||
|
||||
|
||||
if (!hasUnlocked && achievement.isOngoing())
|
||||
{
|
||||
lore.add(" ");
|
||||
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(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())
|
||||
{
|
||||
lore.add(" ");
|
||||
@ -126,23 +179,28 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
||||
masterAchievementLore.add((hasUnlocked ? C.cGreen : C.cRed) + achievement.getName());
|
||||
|
||||
currentIndex++;
|
||||
achievementCount++;
|
||||
|
||||
if (achievementCount++ == 9)
|
||||
{
|
||||
currentIndex = ACHIEVEMENT_MIDDLE_INDEX + 9 - (achievements.size() - 9) / 2;
|
||||
overflow = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Master Achievement
|
||||
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(" ");
|
||||
if (getPlayer().getName().equalsIgnoreCase(_targetName))
|
||||
{
|
||||
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
|
||||
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();
|
||||
@ -161,7 +219,6 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
||||
page = new ArcadeMainPage(getPlugin(), _statsManager, getShop(), getClientManager(), getDonationManager(), "Arcade Games", player, _targetName, _targetStats);
|
||||
else
|
||||
page = new AchievementMainPage(getPlugin(), _statsManager, getShop(), getClientManager(), getDonationManager(), _targetName + "'s Stats", player, _targetName, _targetStats);
|
||||
;
|
||||
|
||||
getShop().openPageForPlayer(getPlayer(), page);
|
||||
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
|
||||
@ -231,4 +288,19 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
||||
|
||||
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(
|
||||
new KingSlayerStatTracker(this),
|
||||
new BloodThirstyStatTracker(this),
|
||||
new BloodThirstyStatTracker(this, null, 0, null, null),
|
||||
new KingDamageStatTracker(this),
|
||||
|
||||
new TeamDeathsStatTracker(this),
|
||||
|
@ -7,6 +7,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -14,6 +15,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -107,6 +109,25 @@ public class CastleSiegeHorseManager implements Listener
|
||||
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
|
||||
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)
|
||||
{
|
||||
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.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
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 nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.FirstBloodEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
||||
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.kit.Kit;
|
||||
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 org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -81,7 +86,7 @@ public class CastleSiegeNew extends TeamGame
|
||||
};
|
||||
private static final int START_TIME = 14000;
|
||||
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 long FENCE_NO_CLIP_TIME = TimeUnit.SECONDS.toMillis(2);
|
||||
|
||||
@ -126,6 +131,14 @@ public class CastleSiegeNew extends TeamGame
|
||||
|
||||
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(
|
||||
Kills,
|
||||
Deaths,
|
||||
@ -356,6 +369,12 @@ public class CastleSiegeNew extends TeamGame
|
||||
|
||||
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!");
|
||||
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!";
|
||||
}
|
||||
|
||||
// 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);
|
||||
@ -478,10 +511,13 @@ public class CastleSiegeNew extends TeamGame
|
||||
|
||||
Kit kit = GetKit(event.getPlayer());
|
||||
|
||||
if (kit == null || !(kit instanceof KitUndeadArcher))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.setCancelled(kit == null || !(kit instanceof KitUndeadArcher));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void firstBlood(FirstBloodEvent event)
|
||||
{
|
||||
AddStat(event.getPlayer(), "FirstBlood", 1, true, false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -508,6 +544,11 @@ public class CastleSiegeNew extends TeamGame
|
||||
return _wolves.contains(player);
|
||||
}
|
||||
|
||||
public CastleSiegeKing getKing()
|
||||
{
|
||||
return _king;
|
||||
}
|
||||
|
||||
public GameTeam getDefenders()
|
||||
{
|
||||
return _defenders;
|
||||
|
@ -35,8 +35,10 @@ import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -148,7 +150,7 @@ public class CastleSiegeTNTManager implements Listener
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
@ -211,7 +213,15 @@ public class CastleSiegeTNTManager implements Listener
|
||||
@EventHandler
|
||||
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
|
||||
@ -240,6 +250,7 @@ public class CastleSiegeTNTManager implements Listener
|
||||
else
|
||||
{
|
||||
_tntCarrier.remove(player);
|
||||
player.getInventory().setHelmet(null);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@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 nautilus.game.arcade.ArcadeManager;
|
||||
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.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -32,44 +32,46 @@ public class KitHumanKnight extends KitCastleSiege
|
||||
},
|
||||
{
|
||||
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 PerkConstructor("Constructor", 40, 2, Material.FENCE, "Castle Barricade", true)
|
||||
new PerkConstructor("Constructor", 36, 2, Material.FENCE, "Castle Barricade", true)
|
||||
},
|
||||
{
|
||||
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 PerkConstructor("Constructor", 40, 3, Material.FENCE, "Castle Barricade", true)
|
||||
new PerkConstructor("Constructor", 30, 3, Material.FENCE, "Castle Barricade", true)
|
||||
},
|
||||
{
|
||||
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 = {
|
||||
{
|
||||
REDUCE_COOLDOWN
|
||||
REDUCE_COOLDOWN_2
|
||||
},
|
||||
{
|
||||
REDUCE_COOLDOWN
|
||||
REDUCE_COOLDOWN_2
|
||||
},
|
||||
{
|
||||
REDUCE_COOLDOWN,
|
||||
REDUCE_COOLDOWN_2,
|
||||
increaseNumber("Constructor", "Maximum Fences", 1, "Fences")
|
||||
},
|
||||
{
|
||||
REDUCE_COOLDOWN,
|
||||
REDUCE_COOLDOWN_4,
|
||||
receiveItem("Diamond Helmet", 1)
|
||||
},
|
||||
{
|
||||
REDUCE_COOLDOWN,
|
||||
REDUCE_COOLDOWN_5,
|
||||
receiveItem("Diamond Chestplate", 1)
|
||||
}
|
||||
};
|
||||
|
@ -32,40 +32,41 @@ public class KitHumanMarksman extends KitCastleSiege
|
||||
new PerkBarrage(5, 250, true, 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 PerkFletcher(2, 4, false),
|
||||
new PerkFletcher(1, 4, 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),
|
||||
}
|
||||
};
|
||||
|
||||
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 = {
|
||||
{
|
||||
receiveItem("2 Extra Mushroom Stews", 1)
|
||||
},
|
||||
{
|
||||
MORE_BARRAGE_ARROWS
|
||||
},
|
||||
{
|
||||
MORE_BARRAGE_ARROWS
|
||||
},
|
||||
{
|
||||
MORE_BARRAGE_ARROWS
|
||||
},
|
||||
{
|
||||
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",
|
||||
"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 int EIGHT_TICKS = 8 * 20;
|
||||
private static final int TEN_TICKS = 8 * 20;
|
||||
private static final int TWELEVE_TICKS = 8 * 20;
|
||||
private static final int NINE_TICKS = 9 * 20;
|
||||
private static final int TEN_TICKS = 10 * 20;
|
||||
private static final Perk[][] PERKS = {
|
||||
{
|
||||
new PerkIronSkin(0.2, true),
|
||||
new PerkIronSkin(0.1, true),
|
||||
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(28),
|
||||
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 PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TEN_TICKS, 0, false, false),
|
||||
new PotionEffect(PotionEffectType.REGENERATION, TEN_TICKS, 0, false, false)
|
||||
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, NINE_TICKS, 0, false, false),
|
||||
new PotionEffect(PotionEffectType.REGENERATION, NINE_TICKS, 0, false, false)
|
||||
)
|
||||
},
|
||||
{
|
||||
new PerkIronSkin(0.2, true),
|
||||
new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(26),
|
||||
new PerkIronSkin(0.1, true),
|
||||
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.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 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 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, 0, 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)
|
||||
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, 1, false, false)
|
||||
)
|
||||
}
|
||||
};
|
||||
@ -85,8 +85,8 @@ public class KitHumanPaladin extends KitCastleSiege
|
||||
return BOOST + " gives " + C.cGreen + effect;
|
||||
}
|
||||
|
||||
private static final String REDUCE_COOLDOWN = reduceCooldown(BOOST, 2);
|
||||
private static final String INCREASE_LENGTH = increaseNumber(BOOST, "Buff Length", 2, "seconds");
|
||||
private static final String REDUCE_COOLDOWN = reduceCooldown(BOOST, 1);
|
||||
private static final String INCREASE_LENGTH = increaseNumber(BOOST, "Buff Length", 1, "seconds");
|
||||
|
||||
private static final String[][] UPGRADES = {
|
||||
{
|
||||
@ -106,7 +106,7 @@ public class KitHumanPaladin extends KitCastleSiege
|
||||
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")
|
||||
}
|
||||
};
|
||||
@ -114,7 +114,7 @@ public class KitHumanPaladin extends KitCastleSiege
|
||||
private static final ItemStack[] PLAYER_ITEMS = {
|
||||
ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD),
|
||||
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),
|
||||
@ -122,9 +122,9 @@ public class KitHumanPaladin extends KitCastleSiege
|
||||
};
|
||||
|
||||
private static final ItemStack[] ARMOR = {
|
||||
ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS),
|
||||
ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS),
|
||||
ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE),
|
||||
ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS),
|
||||
ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS),
|
||||
ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE),
|
||||
ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET)
|
||||
};
|
||||
|
||||
|
@ -106,7 +106,7 @@ public class KitHumanWolf extends KitCastleSiege
|
||||
disguise(player, DisguiseWolf.class);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void damage(CustomDamageEvent event)
|
||||
{
|
||||
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.disguise.disguises.DisguiseSkeleton;
|
||||
import mineplex.core.gadget.gadgets.particle.king.CastleManager;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
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 org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
@ -9,6 +9,7 @@ import nautilus.game.arcade.kit.perks.PerkLeap;
|
||||
import nautilus.game.arcade.kit.perks.PerkSpeed;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
@ -10,6 +10,7 @@ import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
@ -8,7 +8,9 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.castlesiegenew.CastleSiegeNew;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import org.bukkit.ChatColor;
|
||||
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;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!Recharge.Instance.use(player, ChatColor.stripColor(clickedPotion.getItemStack().getItemMeta().getDisplayName()), _cooldown, true, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Manager.GetGame().CreatureAllowOverride = true;
|
||||
|
||||
Location location = player.getEyeLocation();
|
||||
@ -97,15 +104,6 @@ public class PerkMobPotions extends Perk
|
||||
|
||||
_thrownPotions.put(potion, Pair.create(player, clickedPotion));
|
||||
|
||||
// if (itemStack.getAmount() > 1)
|
||||
// {
|
||||
// itemStack.setAmount(itemStack.getAmount() - 1);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// player.setItemInHand(null);
|
||||
// }
|
||||
|
||||
Manager.GetGame().CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
@ -180,7 +178,7 @@ public class PerkMobPotions extends Perk
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void entityTarget(EntityDeathEvent event)
|
||||
public void entityDeath(EntityDeathEvent event)
|
||||
{
|
||||
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()
|
||||
{
|
||||
return _mobPotions;
|
||||
|
@ -55,7 +55,7 @@ public class PerkPaladinBoost extends Perk
|
||||
CastleSiegeNew game = (CastleSiegeNew) Manager.GetGame();
|
||||
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))
|
||||
{
|
||||
@ -64,7 +64,7 @@ public class PerkPaladinBoost extends Perk
|
||||
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.sendMessage(F.main("Game", "Paladin " + F.name(player.getName()) + " has given you buffs!"));
|
||||
|
||||
|
@ -1,64 +1,74 @@
|
||||
package nautilus.game.arcade.stats;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.castlesiege.kits.KitUndead;
|
||||
import nautilus.game.arcade.game.games.hideseek.kits.KitSeeker;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
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);
|
||||
|
||||
_stat = stat;
|
||||
_amount = amount;
|
||||
_validKiller = validKiller;
|
||||
_validKilled = validKilled;
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
CombatComponent player = event.GetLog().GetPlayer();
|
||||
CombatComponent killer = event.GetLog().GetKiller();
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
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)
|
||||
if (!getGame().IsLive() || player == null || killer == null || !player.IsPlayer() || !killer.IsPlayer())
|
||||
{
|
||||
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)
|
||||
addStat(killer, "BloodThirsty", 1, true, false);
|
||||
Player killedPlayer = UtilPlayer.searchExact(player.GetName());
|
||||
|
||||
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;
|
||||
|
||||
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -16,28 +17,26 @@ public class TeamDeathsStatTracker extends StatTracker<Game>
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
CombatComponent component = event.GetLog().GetPlayer();
|
||||
|
||||
if (getGame().GetTeamList().size() < 2)
|
||||
if (!getGame().IsLive() || getGame().GetTeamList().size() < 2 || component == null || !component.IsPlayer())
|
||||
{
|
||||
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;
|
||||
Player player = UtilPlayer.searchExact(component.GetName());
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
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;
|
||||
|
||||
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -11,33 +12,54 @@ import nautilus.game.arcade.game.GameTeam;
|
||||
|
||||
public class TeamKillsStatTracker extends StatTracker<Game>
|
||||
{
|
||||
|
||||
public TeamKillsStatTracker(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
CombatComponent killer = event.GetLog().GetKiller();
|
||||
|
||||
if (getGame().GetTeamList().size() < 2)
|
||||
if (!getGame().IsLive() || getGame().GetTeamList().size() < 2 || killer == null || !killer.IsPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
if (!event.GetLog().GetKiller().IsPlayer())
|
||||
return;
|
||||
|
||||
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||
if (player == null)
|
||||
return;
|
||||
Player player = UtilPlayer.searchExact(killer.GetName());
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
GameTeam team = getGame().GetTeam(player);
|
||||
|
||||
if (team != null && team.GetName() != null)
|
||||
{
|
||||
addStat(player, team.GetName() + " Kills", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
for (CombatComponent attacker : event.GetLog().GetAttackers())
|
||||
{
|
||||
if (!attacker.IsPlayer() || killer.equals(attacker))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Player assist = UtilPlayer.searchExact(attacker.GetName());
|
||||
|
||||
if (assist == null)
|
||||
{
|
||||
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