More changes
This commit is contained in:
parent
01ae8aafa6
commit
e4695b07f0
@ -11,6 +11,7 @@ import java.util.Set;
|
|||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -67,6 +68,7 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
private final MissionRepository _repository;
|
private final MissionRepository _repository;
|
||||||
private final MissionShop _shop;
|
private final MissionShop _shop;
|
||||||
|
|
||||||
|
private Supplier<Boolean> _canIncrement;
|
||||||
private boolean _debug;
|
private boolean _debug;
|
||||||
|
|
||||||
private MissionManager()
|
private MissionManager()
|
||||||
@ -128,6 +130,7 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
{
|
{
|
||||||
if (removeIf.test(tracker))
|
if (removeIf.test(tracker))
|
||||||
{
|
{
|
||||||
|
tracker.cleanup();
|
||||||
UtilServer.Unregister(tracker);
|
UtilServer.Unregister(tracker);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -247,14 +250,24 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
runAsync(() -> _repository.completeMission(ClientManager.getAccountId(player), mission.getId()));
|
runAsync(() -> _repository.completeMission(ClientManager.getAccountId(player), mission.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public <T> void incrementProgress(Player player, int amount, MissionTrackerType trackerType, GameDisplay game, T data)
|
public <T> void incrementProgress(Player player, int amount, MissionTrackerType trackerType, GameDisplay game, T data)
|
||||||
{
|
{
|
||||||
|
incrementProgress(player, amount, trackerType, game, data, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T> void incrementProgress(Player player, int amount, MissionTrackerType trackerType, GameDisplay game, T data, int y)
|
||||||
|
{
|
||||||
|
if (_canIncrement != null && !_canIncrement.get())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MissionClient client = Get(player);
|
MissionClient client = Get(player);
|
||||||
|
|
||||||
client.getMissions().forEach(mission ->
|
client.getMissions().forEach(mission ->
|
||||||
{
|
{
|
||||||
if (mission.getTrackerType() != trackerType || !mission.canProgress(game) || !mission.validateData(data))
|
if (mission.getTrackerType() != trackerType || !mission.canProgress(game) || !mission.validateData(data) || !mission.validateY(y))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -424,6 +437,11 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCanIncrement(Supplier<Boolean> canIncrement)
|
||||||
|
{
|
||||||
|
_canIncrement = canIncrement;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean toggleDebug()
|
public boolean toggleDebug()
|
||||||
{
|
{
|
||||||
_debug = !_debug;
|
_debug = !_debug;
|
||||||
|
@ -7,6 +7,7 @@ import mineplex.core.achievement.leveling.rewards.LevelExperienceReward;
|
|||||||
import mineplex.core.common.currency.GlobalCurrency;
|
import mineplex.core.common.currency.GlobalCurrency;
|
||||||
import mineplex.core.game.GameDisplay;
|
import mineplex.core.game.GameDisplay;
|
||||||
|
|
||||||
|
import static mineplex.core.game.GameDisplay.*;
|
||||||
import static mineplex.core.mission.MissionTrackerType.*;
|
import static mineplex.core.mission.MissionTrackerType.*;
|
||||||
|
|
||||||
public class MissionPopulator
|
public class MissionPopulator
|
||||||
@ -21,7 +22,7 @@ public class MissionPopulator
|
|||||||
|
|
||||||
// Lobby Missions 0-99
|
// Lobby Missions 0-99
|
||||||
|
|
||||||
MissionContext.<Material>newBuilder(manager, 0)
|
MissionContext.newBuilder(manager, 0)
|
||||||
.name("Parkourist")
|
.name("Parkourist")
|
||||||
.description("Complete any Parkour")
|
.description("Complete any Parkour")
|
||||||
.tracker(LOBBY_PARKOUR)
|
.tracker(LOBBY_PARKOUR)
|
||||||
@ -32,7 +33,7 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.<Material>newBuilder(manager, 1)
|
MissionContext.newBuilder(manager, 1)
|
||||||
.name("Gadget Crazy")
|
.name("Gadget Crazy")
|
||||||
.description("Use %s gadgets")
|
.description("Use %s gadgets")
|
||||||
.xRange(25, 50)
|
.xRange(25, 50)
|
||||||
@ -44,7 +45,7 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.<Material>newBuilder(manager, 2)
|
MissionContext.newBuilder(manager, 2)
|
||||||
.name("Not In The Face!")
|
.name("Not In The Face!")
|
||||||
.description("Flesh Hook %s players")
|
.description("Flesh Hook %s players")
|
||||||
.xRange(25, 50)
|
.xRange(25, 50)
|
||||||
@ -56,7 +57,7 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.<Material>newBuilder(manager, 3)
|
MissionContext.newBuilder(manager, 3)
|
||||||
.name("Jumper")
|
.name("Jumper")
|
||||||
.description("Use a jump pad %s times")
|
.description("Use a jump pad %s times")
|
||||||
.xRange(10, 50)
|
.xRange(10, 50)
|
||||||
@ -68,7 +69,7 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.<Material>newBuilder(manager, 4)
|
MissionContext.newBuilder(manager, 4)
|
||||||
.name("Mini Mini Games")
|
.name("Mini Mini Games")
|
||||||
.description("Play %s Lobby Games")
|
.description("Play %s Lobby Games")
|
||||||
.xRange(2, 4)
|
.xRange(2, 4)
|
||||||
@ -80,7 +81,7 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.<Material>newBuilder(manager, 5)
|
MissionContext.newBuilder(manager, 5)
|
||||||
.name("Quick Killer")
|
.name("Quick Killer")
|
||||||
.description("Kill someone in under %s seconds in GLD")
|
.description("Kill someone in under %s seconds in GLD")
|
||||||
.yRange(45, 60)
|
.yRange(45, 60)
|
||||||
@ -92,7 +93,7 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.<Material>newBuilder(manager, 6)
|
MissionContext.newBuilder(manager, 6)
|
||||||
.name("Skilled")
|
.name("Skilled")
|
||||||
.description("Take no damage in GLD")
|
.description("Take no damage in GLD")
|
||||||
.tracker(LOBBY_GLD_NO_DAMAGE)
|
.tracker(LOBBY_GLD_NO_DAMAGE)
|
||||||
@ -107,7 +108,7 @@ public class MissionPopulator
|
|||||||
|
|
||||||
MissionContext.<Material>newBuilder(manager, 100)
|
MissionContext.<Material>newBuilder(manager, 100)
|
||||||
.name("Enthusiast")
|
.name("Enthusiast")
|
||||||
.description("Play %s games.")
|
.description("Play %s games")
|
||||||
.games(GameDisplay.values())
|
.games(GameDisplay.values())
|
||||||
.xRange(10, 50)
|
.xRange(10, 50)
|
||||||
.tracker(GAME_PLAY)
|
.tracker(GAME_PLAY)
|
||||||
@ -118,9 +119,9 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.<Material>newBuilder(manager, 101)
|
MissionContext.newBuilder(manager, 101)
|
||||||
.name("Winner")
|
.name("Winner")
|
||||||
.description("Win %s games.")
|
.description("Win %s games")
|
||||||
.games(GameDisplay.values())
|
.games(GameDisplay.values())
|
||||||
.xRange(2, 10)
|
.xRange(2, 10)
|
||||||
.tracker(GAME_WIN)
|
.tracker(GAME_WIN)
|
||||||
@ -131,9 +132,9 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.<Material>newBuilder(manager, 102)
|
MissionContext.newBuilder(manager, 102)
|
||||||
.name("Killer")
|
.name("Killer")
|
||||||
.description("Kill %s players in game.")
|
.description("Kill %s players in game")
|
||||||
.games(GameDisplay.values())
|
.games(GameDisplay.values())
|
||||||
.xRange(10, 50)
|
.xRange(10, 50)
|
||||||
.tracker(GAME_KILL)
|
.tracker(GAME_KILL)
|
||||||
@ -144,9 +145,9 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.<Material>newBuilder(manager, 103)
|
MissionContext.newBuilder(manager, 103)
|
||||||
.name("I Shall Taunt You A Second Time")
|
.name("I Shall Taunt You A Second Time")
|
||||||
.description("Taunt %s times in game.")
|
.description("Taunt %s times in game")
|
||||||
.games(GameDisplay.values())
|
.games(GameDisplay.values())
|
||||||
.xRange(2, 20)
|
.xRange(2, 20)
|
||||||
.tracker(GAME_TAUNT)
|
.tracker(GAME_TAUNT)
|
||||||
@ -157,7 +158,211 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Turf Wars
|
// Turf Wars 200-299
|
||||||
|
|
||||||
|
MissionContext.<Boolean>newBuilder(manager, 200)
|
||||||
|
.name("Juggler")
|
||||||
|
.description("Kill %s players while in midair")
|
||||||
|
.games(TurfWars)
|
||||||
|
.xRange(3, 6)
|
||||||
|
.tracker(GAME_KILL_MIDAIR)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(100),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 50),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 50)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.newBuilder(manager, 201)
|
||||||
|
.name("Sneaky")
|
||||||
|
.description("Be on the enemy turf for %s seconds")
|
||||||
|
.games(TurfWars)
|
||||||
|
.xRange(60, 120)
|
||||||
|
.tracker(TURF_WARS_ON_ENEMY)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(4),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 2),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 2)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.newBuilder(manager, 202)
|
||||||
|
.name("Better than explosions")
|
||||||
|
.description("Break %s wool with your bow")
|
||||||
|
.games(TurfWars)
|
||||||
|
.xRange(5, 40)
|
||||||
|
.tracker(TURF_WARS_BOW_BREAK)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(25),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 10),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 10)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Draw My Thing 300-399
|
||||||
|
|
||||||
|
MissionContext.newBuilder(manager, 300)
|
||||||
|
.name("Quick Thinker")
|
||||||
|
.description("Guess %s words in under %s seconds")
|
||||||
|
.games(Draw)
|
||||||
|
.xRange(2, 5)
|
||||||
|
.yRange(10, 20)
|
||||||
|
.tracker(DMT_GUESS)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(200),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 100),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 100)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.newBuilder(manager, 301)
|
||||||
|
.name("Hard To Beat")
|
||||||
|
.description("Guess every word in a game")
|
||||||
|
.games(Draw)
|
||||||
|
.tracker(DMT_GUESS_ALL)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(1250),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 750),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 750)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.newBuilder(manager, 301)
|
||||||
|
.name("Streak!")
|
||||||
|
.description("Guess the word %s times in a row")
|
||||||
|
.games(Draw)
|
||||||
|
.yRange(2, 5)
|
||||||
|
.tracker(DMT_GUESS_STREAK)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(250),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 125),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 125)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Survival Games 400-499
|
||||||
|
|
||||||
|
MissionContext.newBuilder(manager, 400)
|
||||||
|
.name("Tickle Master")
|
||||||
|
.description("Kill %s players with a feather")
|
||||||
|
.games(SurvivalGames, SurvivalGamesTeams)
|
||||||
|
.xRange(1, 5)
|
||||||
|
.tracker(GAME_KILL)
|
||||||
|
.trackerData("Feather")
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(200),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 100),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 100)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.newBuilder(manager, 401)
|
||||||
|
.name("Bojack Takedown")
|
||||||
|
.description("Kill %s players while riding a horse.")
|
||||||
|
.games(SurvivalGames, SurvivalGamesTeams)
|
||||||
|
.xRange(1, 5)
|
||||||
|
.tracker(SG_BOW_HORSE_KILL)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(400),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 200),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 200)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.newBuilder(manager, 402)
|
||||||
|
.name("Not Enough Supply")
|
||||||
|
.description("Open %s supply drops.")
|
||||||
|
.games(SurvivalGames, SurvivalGamesTeams)
|
||||||
|
.xRange(2, 15)
|
||||||
|
.tracker(SG_SUPPLY_DROP_OPEN)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(150),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 75),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 75)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 403)
|
||||||
|
.name("Diamond Weaponsmith")
|
||||||
|
.description("Craft %s diamond swords.")
|
||||||
|
.games(SurvivalGames, SurvivalGamesTeams)
|
||||||
|
.xRange(1, 10)
|
||||||
|
.tracker(GAME_CRAFT_ITEM)
|
||||||
|
.trackerData(Material.DIAMOND_SWORD)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(250),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 125),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 125)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 404)
|
||||||
|
.name("Gold Weaponsmith")
|
||||||
|
.description("Craft %s gold swords.")
|
||||||
|
.games(SurvivalGames, SurvivalGamesTeams)
|
||||||
|
.xRange(1, 10)
|
||||||
|
.tracker(GAME_CRAFT_ITEM)
|
||||||
|
.trackerData(Material.GOLD_SWORD)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(250),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 125),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 125)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 405)
|
||||||
|
.name("Iron Weaponsmith")
|
||||||
|
.description("Craft %s gold swords.")
|
||||||
|
.games(SurvivalGames, SurvivalGamesTeams)
|
||||||
|
.xRange(1, 10)
|
||||||
|
.tracker(GAME_CRAFT_ITEM)
|
||||||
|
.trackerData(Material.IRON_SWORD)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(250),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 125),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 125)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 406)
|
||||||
|
.name("Why Thou")
|
||||||
|
.description("Craft %s gold shovels.")
|
||||||
|
.games(SurvivalGames, SurvivalGamesTeams)
|
||||||
|
.xRange(1, 10)
|
||||||
|
.tracker(GAME_CRAFT_ITEM)
|
||||||
|
.trackerData(Material.GOLD_SPADE)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(250),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 125),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 125)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 407)
|
||||||
|
.name("Looter")
|
||||||
|
.description("Loot %s chests.")
|
||||||
|
.games(SurvivalGames, SurvivalGamesTeams)
|
||||||
|
.xRange(25, 100)
|
||||||
|
.tracker(GAME_CHEST_OPEN)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(4),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 2),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 2)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 407)
|
||||||
|
.name("Steve Walker")
|
||||||
|
.description("Walk %s blocks.")
|
||||||
|
.games(SurvivalGames, SurvivalGamesTeams)
|
||||||
|
.xRange(1000, 5000)
|
||||||
|
.tracker(SG_WALK)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(1),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 1),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 1)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package mineplex.core.mission;
|
package mineplex.core.mission;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
import mineplex.core.game.GameDisplay;
|
public class MissionTracker implements Listener
|
||||||
|
|
||||||
public class MissionTracker<T> implements Listener
|
|
||||||
{
|
{
|
||||||
|
|
||||||
protected final MissionManager _manager;
|
protected final MissionManager _manager;
|
||||||
private final MissionTrackerType _trackerType;
|
protected final MissionTrackerType _trackerType;
|
||||||
|
|
||||||
public MissionTracker(MissionManager manager, MissionTrackerType trackerType)
|
public MissionTracker(MissionManager manager, MissionTrackerType trackerType)
|
||||||
{
|
{
|
||||||
@ -17,8 +14,6 @@ public class MissionTracker<T> implements Listener
|
|||||||
_trackerType = trackerType;
|
_trackerType = trackerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void incrementProgress(Player player, int amount, GameDisplay game, T data)
|
public void cleanup()
|
||||||
{
|
{}
|
||||||
_manager.incrementProgress(player, amount, _trackerType, game, data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,22 @@ public enum MissionTrackerType
|
|||||||
|
|
||||||
GAME_WIN,
|
GAME_WIN,
|
||||||
GAME_PLAY,
|
GAME_PLAY,
|
||||||
GAME_KILL,
|
|
||||||
GAME_TAUNT,
|
GAME_TAUNT,
|
||||||
|
|
||||||
|
GAME_KILL,
|
||||||
|
GAME_KILL_MIDAIR,
|
||||||
|
GAME_CHEST_OPEN,
|
||||||
|
GAME_CRAFT_ITEM,
|
||||||
|
|
||||||
|
TURF_WARS_ON_ENEMY,
|
||||||
|
TURF_WARS_BOW_BREAK,
|
||||||
|
|
||||||
|
DMT_GUESS,
|
||||||
|
DMT_GUESS_ALL,
|
||||||
|
DMT_GUESS_STREAK,
|
||||||
|
|
||||||
|
SG_BOW_HORSE_KILL,
|
||||||
|
SG_SUPPLY_DROP_OPEN,
|
||||||
|
SG_WALK,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,10 @@ public class PlayerMission<T> implements Mission<T>
|
|||||||
{
|
{
|
||||||
_rewards = new LevelReward[_context.getRewards().length];
|
_rewards = new LevelReward[_context.getRewards().length];
|
||||||
|
|
||||||
|
// Reduce the reward scaling if the number is >= 1000
|
||||||
|
// This is only the case for things like the "Walk x blocks" missions.
|
||||||
|
int x = _x >= 1000 ? _x / 100 : _x;
|
||||||
|
|
||||||
for (int i = 0; i < _rewards.length; i++)
|
for (int i = 0; i < _rewards.length; i++)
|
||||||
{
|
{
|
||||||
LevelReward reward = _context.getRewards()[i];
|
LevelReward reward = _context.getRewards()[i];
|
||||||
@ -59,7 +63,7 @@ public class PlayerMission<T> implements Mission<T>
|
|||||||
shardRankBonus += rankBonus;
|
shardRankBonus += rankBonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
_rewards[i] = ((ScalableLevelReward) reward).cloneScalable(_x * shardRankBonus);
|
_rewards[i] = ((ScalableLevelReward) reward).cloneScalable(x * shardRankBonus);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -114,6 +118,11 @@ public class PlayerMission<T> implements Mission<T>
|
|||||||
return _x;
|
return _x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean validateY(int y)
|
||||||
|
{
|
||||||
|
return y <= getY();
|
||||||
|
}
|
||||||
|
|
||||||
public int getY()
|
public int getY()
|
||||||
{
|
{
|
||||||
return _y;
|
return _y;
|
||||||
|
@ -138,7 +138,7 @@ public class Duels extends CycledGame
|
|||||||
|
|
||||||
for (Player player : getAlivePlayers())
|
for (Player player : getAlivePlayers())
|
||||||
{
|
{
|
||||||
manager.incrementProgress(player, 1, MissionTrackerType.LOBBY_GLD_QUICK, null, since);
|
manager.incrementProgress(player, 1, MissionTrackerType.LOBBY_GLD_QUICK, null, null, (int) since);
|
||||||
|
|
||||||
if (_notDamaged.contains(player))
|
if (_notDamaged.contains(player))
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package mineplex.minecraft.game.core.combat;
|
package mineplex.minecraft.game.core.combat;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -411,7 +409,7 @@ public class CombatManager extends MiniPlugin
|
|||||||
// Killed
|
// Killed
|
||||||
String killedColor = log.GetKilledColor();
|
String killedColor = log.GetKilledColor();
|
||||||
String deadPlayer = killedColor + event.getEntity().getName();
|
String deadPlayer = killedColor + event.getEntity().getName();
|
||||||
String message = "";
|
String message;
|
||||||
|
|
||||||
// Killer
|
// Killer
|
||||||
if (log.GetKiller() != null)
|
if (log.GetKiller() != null)
|
||||||
|
@ -104,6 +104,7 @@ import nautilus.game.arcade.kit.LinearUpgradeKit;
|
|||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
import nautilus.game.arcade.managers.chat.ChatStatData;
|
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||||
import nautilus.game.arcade.managers.lobby.LobbyManager;
|
import nautilus.game.arcade.managers.lobby.LobbyManager;
|
||||||
|
import nautilus.game.arcade.missions.CraftItemMissionTracker;
|
||||||
import nautilus.game.arcade.missions.GameMissionTracker;
|
import nautilus.game.arcade.missions.GameMissionTracker;
|
||||||
import nautilus.game.arcade.missions.KillMissionTracker;
|
import nautilus.game.arcade.missions.KillMissionTracker;
|
||||||
import nautilus.game.arcade.missions.PlayGameMissionTracker;
|
import nautilus.game.arcade.missions.PlayGameMissionTracker;
|
||||||
@ -442,8 +443,10 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
registerMissions(
|
registerMissions(
|
||||||
new PlayGameMissionTracker(this),
|
new PlayGameMissionTracker(this),
|
||||||
new WinMissionTracker(this),
|
new WinMissionTracker(this),
|
||||||
new KillMissionTracker(this)
|
new KillMissionTracker(this),
|
||||||
|
new CraftItemMissionTracker(this)
|
||||||
);
|
);
|
||||||
|
manager.getMissionsManager().setCanIncrement(() -> CanAddStats && manager.IsRewardStats());
|
||||||
|
|
||||||
Manager.getResourcePackManager().setResourcePack(gameType.getResourcePackUrls(this), gameType.isEnforceResourcePack(this));
|
Manager.getResourcePackManager().setResourcePack(gameType.getResourcePackUrls(this), gameType.isEnforceResourcePack(this));
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -41,6 +42,7 @@ import mineplex.core.common.util.UtilServer;
|
|||||||
import mineplex.core.common.util.UtilTextBottom;
|
import mineplex.core.common.util.UtilTextBottom;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
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;
|
||||||
@ -52,6 +54,7 @@ import nautilus.game.arcade.game.GameTeam;
|
|||||||
import nautilus.game.arcade.game.SoloGame;
|
import nautilus.game.arcade.game.SoloGame;
|
||||||
import nautilus.game.arcade.game.games.GameScore;
|
import nautilus.game.arcade.game.games.GameScore;
|
||||||
import nautilus.game.arcade.game.games.draw.kits.KitArtist;
|
import nautilus.game.arcade.game.games.draw.kits.KitArtist;
|
||||||
|
import nautilus.game.arcade.game.games.draw.mission.GuessStreakTracker;
|
||||||
import nautilus.game.arcade.game.games.draw.tools.Tool;
|
import nautilus.game.arcade.game.games.draw.tools.Tool;
|
||||||
import nautilus.game.arcade.game.games.draw.tools.ToolCircle;
|
import nautilus.game.arcade.game.games.draw.tools.ToolCircle;
|
||||||
import nautilus.game.arcade.game.games.draw.tools.ToolLine;
|
import nautilus.game.arcade.game.games.draw.tools.ToolLine;
|
||||||
@ -255,6 +258,8 @@ public class Draw extends SoloGame
|
|||||||
new DrawGuessStatTracker(this)
|
new DrawGuessStatTracker(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
registerMissions(new GuessStreakTracker(this));
|
||||||
|
|
||||||
registerChatStats(
|
registerChatStats(
|
||||||
new ChatStatData("TotalGuess", "Total Guesses", true),
|
new ChatStatData("TotalGuess", "Total Guesses", true),
|
||||||
new ChatStatData("PureLuck", "Lucky Guesses", true)
|
new ChatStatData("PureLuck", "Lucky Guesses", true)
|
||||||
@ -537,6 +542,9 @@ public class Draw extends SoloGame
|
|||||||
Announce(C.cYellow + C.Bold + "+" + score + " " + C.cGreen + C.Bold + player.getName()
|
Announce(C.cYellow + C.Bold + "+" + score + " " + C.cGreen + C.Bold + player.getName()
|
||||||
+ " has guessed the word!");
|
+ " has guessed the word!");
|
||||||
|
|
||||||
|
long since = TimeUnit.MILLISECONDS.toSeconds(GetStateTime() - _round.Time);
|
||||||
|
getArcadeManager().getMissionsManager().incrementProgress(player, 1, MissionTrackerType.DMT_GUESS, GetType().getDisplay(), null, (int) since);
|
||||||
|
|
||||||
if (score == 1)
|
if (score == 1)
|
||||||
this.AddGems(player, 1, "Words Guessed", true, true);
|
this.AddGems(player, 1, "Words Guessed", true, true);
|
||||||
else
|
else
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
package nautilus.game.arcade.game.games.draw.mission;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.game.games.draw.Draw;
|
||||||
|
import nautilus.game.arcade.game.games.draw.DrawGuessCorrectlyEvent;
|
||||||
|
import nautilus.game.arcade.game.games.draw.DrawRoundEndEvent;
|
||||||
|
import nautilus.game.arcade.missions.GameMissionTracker;
|
||||||
|
|
||||||
|
public class GuessStreakTracker extends GameMissionTracker<Draw>
|
||||||
|
{
|
||||||
|
|
||||||
|
private final Map<String, Integer> _streaks;
|
||||||
|
|
||||||
|
public GuessStreakTracker(Draw game)
|
||||||
|
{
|
||||||
|
super(MissionTrackerType.DMT_GUESS_STREAK, game);
|
||||||
|
|
||||||
|
_streaks = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cleanup()
|
||||||
|
{
|
||||||
|
_streaks.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void guessCorrect(DrawGuessCorrectlyEvent event)
|
||||||
|
{
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
int streak = _streaks.getOrDefault(player.getName(), 0) + 1;
|
||||||
|
_streaks.put(player.getName(), streak);
|
||||||
|
_manager.incrementProgress(player, 1, MissionTrackerType.DMT_GUESS_STREAK, getGameType(), null, streak);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void round(DrawRoundEndEvent event)
|
||||||
|
{
|
||||||
|
_streaks.keySet().removeIf(player -> !event.getDrawRound().Guessed.contains(player));
|
||||||
|
}
|
||||||
|
}
|
@ -68,6 +68,8 @@ import nautilus.game.arcade.game.games.survivalgames.kit.KitBrawler;
|
|||||||
import nautilus.game.arcade.game.games.survivalgames.kit.KitHorseman;
|
import nautilus.game.arcade.game.games.survivalgames.kit.KitHorseman;
|
||||||
import nautilus.game.arcade.game.games.survivalgames.kit.KitKnight;
|
import nautilus.game.arcade.game.games.survivalgames.kit.KitKnight;
|
||||||
import nautilus.game.arcade.game.games.survivalgames.kit.KitNecromancer;
|
import nautilus.game.arcade.game.games.survivalgames.kit.KitNecromancer;
|
||||||
|
import nautilus.game.arcade.game.games.survivalgames.misison.BowHorseKillTracker;
|
||||||
|
import nautilus.game.arcade.game.games.survivalgames.misison.WalkMissionTracker;
|
||||||
import nautilus.game.arcade.game.games.survivalgames.modules.BorderModule;
|
import nautilus.game.arcade.game.games.survivalgames.modules.BorderModule;
|
||||||
import nautilus.game.arcade.game.games.survivalgames.modules.FurnaceLootModule;
|
import nautilus.game.arcade.game.games.survivalgames.modules.FurnaceLootModule;
|
||||||
import nautilus.game.arcade.game.games.survivalgames.modules.SupplyDropModule;
|
import nautilus.game.arcade.game.games.survivalgames.modules.SupplyDropModule;
|
||||||
@ -197,6 +199,12 @@ public abstract class SurvivalGamesNew extends Game
|
|||||||
new SimultaneousSkeletonStatTracker(this, 5)
|
new SimultaneousSkeletonStatTracker(this, 5)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
registerMissions
|
||||||
|
(
|
||||||
|
new BowHorseKillTracker(this),
|
||||||
|
new WalkMissionTracker(this)
|
||||||
|
);
|
||||||
|
|
||||||
registerChatStats
|
registerChatStats
|
||||||
(
|
(
|
||||||
Kills,
|
Kills,
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
package nautilus.game.arcade.game.games.survivalgames.misison;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Horse;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.game.Game;
|
||||||
|
import nautilus.game.arcade.missions.GameMissionTracker;
|
||||||
|
|
||||||
|
public class BowHorseKillTracker extends GameMissionTracker<Game>
|
||||||
|
{
|
||||||
|
|
||||||
|
public BowHorseKillTracker(Game game)
|
||||||
|
{
|
||||||
|
super(MissionTrackerType.SG_BOW_HORSE_KILL, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void playerDeath(PlayerDeathEvent event)
|
||||||
|
{
|
||||||
|
Player player = event.getEntity();
|
||||||
|
Player killer = player.getKiller();
|
||||||
|
|
||||||
|
if (killer == null || killer.equals(player) || killer.getVehicle() == null || !(killer.getVehicle() instanceof Horse))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_manager.incrementProgress(player, 1, _trackerType, getGameType(), null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package nautilus.game.arcade.game.games.survivalgames.misison;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
|
import nautilus.game.arcade.game.Game;
|
||||||
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
|
import nautilus.game.arcade.missions.GameMissionTracker;
|
||||||
|
|
||||||
|
public class WalkMissionTracker extends GameMissionTracker<Game>
|
||||||
|
{
|
||||||
|
|
||||||
|
private final Map<Player, Location> _last;
|
||||||
|
|
||||||
|
public WalkMissionTracker(Game game)
|
||||||
|
{
|
||||||
|
super(MissionTrackerType.GAME_CRAFT_ITEM, game);
|
||||||
|
|
||||||
|
_last = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cleanup()
|
||||||
|
{
|
||||||
|
_last.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void live(GameStateChangeEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetState() != GameState.Live)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_game.GetPlayers(true).forEach(player -> _last.put(player, player.getLocation()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void update(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SEC || !_game.IsLive())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_last.entrySet().forEach(entry ->
|
||||||
|
{
|
||||||
|
Player player = entry.getKey();
|
||||||
|
Location last = entry.getValue(), now = player.getLocation();
|
||||||
|
double distance = UtilMath.offset(now, last);
|
||||||
|
_manager.incrementProgress(player, (int) distance, _trackerType, getGameType(), null);
|
||||||
|
entry.setValue(now);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void playerQuit(PlayerQuitEvent event)
|
||||||
|
{
|
||||||
|
_last.remove(event.getPlayer());
|
||||||
|
}
|
||||||
|
}
|
@ -46,6 +46,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
|
|||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
import mineplex.core.treasure.util.TreasureUtil;
|
import mineplex.core.treasure.util.TreasureUtil;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
@ -250,6 +251,7 @@ public class SupplyDropModule extends Module
|
|||||||
_supplyDrop = null;
|
_supplyDrop = null;
|
||||||
_firstOpening = false;
|
_firstOpening = false;
|
||||||
getGame().AddStat(player, "SupplyDropsOpened", 1, false, false);
|
getGame().AddStat(player, "SupplyDropsOpened", 1, false, false);
|
||||||
|
getGame().getArcadeManager().getMissionsManager().incrementProgress(player, 1, MissionTrackerType.SG_SUPPLY_DROP_OPEN, getGame().GetType().getDisplay(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
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;
|
||||||
@ -60,6 +61,7 @@ import nautilus.game.arcade.game.TeamGame;
|
|||||||
import nautilus.game.arcade.game.games.turfforts.kits.KitInfiltrator;
|
import nautilus.game.arcade.game.games.turfforts.kits.KitInfiltrator;
|
||||||
import nautilus.game.arcade.game.games.turfforts.kits.KitMarksman;
|
import nautilus.game.arcade.game.games.turfforts.kits.KitMarksman;
|
||||||
import nautilus.game.arcade.game.games.turfforts.kits.KitShredder;
|
import nautilus.game.arcade.game.games.turfforts.kits.KitShredder;
|
||||||
|
import nautilus.game.arcade.game.games.turfforts.mission.KillMidAirMissionTracker;
|
||||||
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.managers.chat.ChatStatData;
|
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||||
@ -164,6 +166,8 @@ public class TurfForts extends TeamGame
|
|||||||
_breakStatTracker
|
_breakStatTracker
|
||||||
);
|
);
|
||||||
|
|
||||||
|
registerMissions(new KillMidAirMissionTracker(this));
|
||||||
|
|
||||||
registerChatStats(
|
registerChatStats(
|
||||||
Kills,
|
Kills,
|
||||||
Deaths,
|
Deaths,
|
||||||
@ -474,6 +478,7 @@ public class TurfForts extends TeamGame
|
|||||||
{
|
{
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, data == 3 ? Material.LAPIS_BLOCK : Material.REDSTONE_BLOCK);
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, data == 3 ? Material.LAPIS_BLOCK : Material.REDSTONE_BLOCK);
|
||||||
_breakStatTracker.addStat(shooter);
|
_breakStatTracker.addStat(shooter);
|
||||||
|
getArcadeManager().getMissionsManager().incrementProgress(shooter, 1, MissionTrackerType.TURF_WARS_BOW_BREAK, GetType().getDisplay(), null);
|
||||||
AddGems(shooter, 0.25, "Blocks Broken", true, true);
|
AddGems(shooter, 0.25, "Blocks Broken", true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -857,6 +862,7 @@ public class TurfForts extends TeamGame
|
|||||||
_enemyTurf.forEach((player, data) ->
|
_enemyTurf.forEach((player, data) ->
|
||||||
{
|
{
|
||||||
data.Seconds++;
|
data.Seconds++;
|
||||||
|
getArcadeManager().getMissionsManager().incrementProgress(player, 1, MissionTrackerType.TURF_WARS_ON_ENEMY, GetType().getDisplay(), null);
|
||||||
|
|
||||||
if (UtilTime.elapsed(data.LastTick, data.HasKilled ? 2500 : 5000))
|
if (UtilTime.elapsed(data.LastTick, data.HasKilled ? 2500 : 5000))
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
package nautilus.game.arcade.game.games.turfforts.mission;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.game.Game;
|
||||||
|
import nautilus.game.arcade.missions.GameMissionTracker;
|
||||||
|
|
||||||
|
public class KillMidAirMissionTracker extends GameMissionTracker<Game>
|
||||||
|
{
|
||||||
|
|
||||||
|
public KillMidAirMissionTracker(Game game)
|
||||||
|
{
|
||||||
|
super(MissionTrackerType.GAME_KILL_MIDAIR, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void playerDeath(PlayerDeathEvent event)
|
||||||
|
{
|
||||||
|
Player player = event.getEntity();
|
||||||
|
Player killer = player.getKiller();
|
||||||
|
|
||||||
|
if (killer == null || killer.equals(player) || UtilEnt.onBlock(killer))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_manager.incrementProgress(player, 1, _trackerType, getGameType(), null);
|
||||||
|
}
|
||||||
|
}
|
@ -31,6 +31,7 @@ import mineplex.core.common.util.UtilEvent;
|
|||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
import mineplex.core.titles.tracks.standard.LuckyTrack;
|
import mineplex.core.titles.tracks.standard.LuckyTrack;
|
||||||
import mineplex.core.titles.tracks.standard.UnluckyTrack;
|
import mineplex.core.titles.tracks.standard.UnluckyTrack;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -231,6 +232,7 @@ public class ChestLootModule extends Module
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
ArcadeManager manager = getGame().getArcadeManager();
|
ArcadeManager manager = getGame().getArcadeManager();
|
||||||
getGame().AddStat(player, "ChestsOpened", 1, false, false);
|
getGame().AddStat(player, "ChestsOpened", 1, false, false);
|
||||||
|
getGame().getArcadeManager().getMissionsManager().incrementProgress(player, 1, MissionTrackerType.GAME_CHEST_OPEN, getGame().GetType().getDisplay(), metadata.Type.Name);
|
||||||
|
|
||||||
if (manager.IsRewardStats())
|
if (manager.IsRewardStats())
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package nautilus.game.arcade.missions;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.inventory.CraftItemEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.game.Game;
|
||||||
|
|
||||||
|
public class CraftItemMissionTracker extends GameMissionTracker<Game>
|
||||||
|
{
|
||||||
|
|
||||||
|
public CraftItemMissionTracker(Game game)
|
||||||
|
{
|
||||||
|
super(MissionTrackerType.GAME_CRAFT_ITEM, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void craftItem(CraftItemEvent event)
|
||||||
|
{
|
||||||
|
ItemStack itemStack = event.getRecipe().getResult();
|
||||||
|
|
||||||
|
if (itemStack == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_manager.incrementProgress((Player) event.getWhoClicked(), itemStack.getAmount(), _trackerType, getGameType(), itemStack.getType());
|
||||||
|
}
|
||||||
|
}
|
@ -1,31 +1,25 @@
|
|||||||
package nautilus.game.arcade.missions;
|
package nautilus.game.arcade.missions;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import mineplex.core.game.GameDisplay;
|
||||||
|
|
||||||
import mineplex.core.mission.MissionTracker;
|
import mineplex.core.mission.MissionTracker;
|
||||||
import mineplex.core.mission.MissionTrackerType;
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
|
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
|
|
||||||
public class GameMissionTracker<T, U extends Game> extends MissionTracker<T>
|
public class GameMissionTracker<U extends Game> extends MissionTracker
|
||||||
{
|
{
|
||||||
|
|
||||||
protected final U _game;
|
protected final U _game;
|
||||||
|
|
||||||
GameMissionTracker(MissionTrackerType trackerType, U game)
|
public GameMissionTracker(MissionTrackerType trackerType, U game)
|
||||||
{
|
{
|
||||||
super(game.getArcadeManager().getMissionsManager(), trackerType);
|
super(game.getArcadeManager().getMissionsManager(), trackerType);
|
||||||
|
|
||||||
_game = game;
|
_game = game;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void incrementProgress(Player player, int amount, T data)
|
protected GameDisplay getGameType()
|
||||||
{
|
{
|
||||||
if (!_game.CanAddStats || !_game.getArcadeManager().IsRewardStats())
|
return _game.GetType().getDisplay();
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
incrementProgress(player, amount, _game.GetType().getDisplay(), data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package nautilus.game.arcade.missions;
|
package nautilus.game.arcade.missions;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.mission.MissionTrackerType;
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
|
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||||
|
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||||
|
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
|
|
||||||
public class KillMissionTracker extends GameMissionTracker<Material, Game>
|
public class KillMissionTracker extends GameMissionTracker<Game>
|
||||||
{
|
{
|
||||||
|
|
||||||
public KillMissionTracker(Game game)
|
public KillMissionTracker(Game game)
|
||||||
@ -20,16 +20,23 @@ public class KillMissionTracker extends GameMissionTracker<Material, Game>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void playerDeath(PlayerDeathEvent event)
|
public void playerDeath(CombatDeathEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getEntity();
|
Player player = event.GetEvent().getEntity();
|
||||||
Player killer = player.getKiller();
|
CombatComponent killer = event.GetLog().GetKiller();
|
||||||
|
|
||||||
if (killer != null && !player.equals(killer))
|
if (killer == null || !killer.IsPlayer())
|
||||||
{
|
{
|
||||||
ItemStack itemStack = killer.getItemInHand();
|
return;
|
||||||
|
|
||||||
incrementProgress(killer, 1, itemStack == null ? null : itemStack.getType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player killerPlayer = UtilPlayer.searchExact(killer.getUniqueIdOfEntity());
|
||||||
|
|
||||||
|
if (killerPlayer == null || player.equals(killerPlayer))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_manager.incrementProgress(killerPlayer, 1, _trackerType, getGameType(), killer.GetLastDamageSource());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
|||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import nautilus.game.arcade.game.Game.GameState;
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
|
|
||||||
public class PlayGameMissionTracker extends GameMissionTracker<GameDisplay, Game>
|
public class PlayGameMissionTracker extends GameMissionTracker<Game>
|
||||||
{
|
{
|
||||||
|
|
||||||
public PlayGameMissionTracker(Game game)
|
public PlayGameMissionTracker(Game game)
|
||||||
@ -37,7 +37,7 @@ public class PlayGameMissionTracker extends GameMissionTracker<GameDisplay, Game
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
incrementProgress(player, 1, null);
|
_manager.incrementProgress(player, 1, _trackerType, getGameType(), null);
|
||||||
}
|
}
|
||||||
}, 600);
|
}, 600);
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,13 @@ 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.game.GameDisplay;
|
|
||||||
import mineplex.core.mission.MissionTrackerType;
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
|
|
||||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import nautilus.game.arcade.game.Game.GameState;
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
|
|
||||||
public class WinMissionTracker extends GameMissionTracker<GameDisplay, Game>
|
public class WinMissionTracker extends GameMissionTracker<Game>
|
||||||
{
|
{
|
||||||
|
|
||||||
public WinMissionTracker(Game game)
|
public WinMissionTracker(Game game)
|
||||||
@ -36,6 +35,6 @@ public class WinMissionTracker extends GameMissionTracker<GameDisplay, Game>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
winners.forEach(player -> incrementProgress(player, 1, null));
|
winners.forEach(player -> _manager.incrementProgress(player, 1, _trackerType, getGameType(), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ 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.mission.MissionTrackerType;
|
||||||
|
|
||||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import nautilus.game.arcade.game.games.draw.Draw;
|
import nautilus.game.arcade.game.games.draw.Draw;
|
||||||
@ -55,7 +57,10 @@ public class KeenEyeStatTracker extends StatTracker<Draw>
|
|||||||
if (event.GetState() == Game.GameState.End)
|
if (event.GetState() == Game.GameState.End)
|
||||||
{
|
{
|
||||||
for (Player player : _guessAll)
|
for (Player player : _guessAll)
|
||||||
|
{
|
||||||
addStat(player, "KeenEye", 1, true, false);
|
addStat(player, "KeenEye", 1, true, false);
|
||||||
|
getGame().getArcadeManager().getMissionsManager().incrementProgress(player, 1, MissionTrackerType.DMT_GUESS_ALL, getGame().GetType().getDisplay(), null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user