Make a start on adding actual missions
This commit is contained in:
parent
83733c8793
commit
4d0ac23b45
@ -29,8 +29,8 @@ public class LevelChestReward implements ScalableLevelReward
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScalableLevelReward cloneScalable(int scale)
|
public ScalableLevelReward cloneScalable(double scale)
|
||||||
{
|
{
|
||||||
return new LevelChestReward(_chest, scale * _amount);
|
return new LevelChestReward(_chest, (int) (scale * _amount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,13 @@ public class LevelCurrencyReward implements ScalableLevelReward
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScalableLevelReward cloneScalable(int scale)
|
public ScalableLevelReward cloneScalable(double scale)
|
||||||
{
|
{
|
||||||
return new LevelCurrencyReward(_type, scale * _amount);
|
return new LevelCurrencyReward(_type, (int) (scale * _amount));
|
||||||
|
}
|
||||||
|
|
||||||
|
public GlobalCurrency getType()
|
||||||
|
{
|
||||||
|
return _type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,8 @@ public class LevelExperienceReward implements ScalableLevelReward
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScalableLevelReward cloneScalable(int scale)
|
public ScalableLevelReward cloneScalable(double scale)
|
||||||
{
|
{
|
||||||
return new LevelExperienceReward(scale * _amount);
|
return new LevelExperienceReward((int) (scale * _amount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@ public class LevelGameAmplifierReward implements ScalableLevelReward
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScalableLevelReward cloneScalable(int scale)
|
public ScalableLevelReward cloneScalable(double scale)
|
||||||
{
|
{
|
||||||
return new LevelGameAmplifierReward(scale * _amount);
|
return new LevelGameAmplifierReward((int) (scale * _amount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,6 @@ package mineplex.core.achievement.leveling.rewards;
|
|||||||
public interface ScalableLevelReward extends LevelReward
|
public interface ScalableLevelReward extends LevelReward
|
||||||
{
|
{
|
||||||
|
|
||||||
ScalableLevelReward cloneScalable(int scale);
|
ScalableLevelReward cloneScalable(double scale);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -330,6 +330,7 @@ import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffect
|
|||||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffectRankLegend;
|
import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffectRankLegend;
|
||||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffectRankTitan;
|
import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffectRankTitan;
|
||||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffectRankUltra;
|
import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffectRankUltra;
|
||||||
|
import mineplex.core.gadget.mission.GadgetUseTracker;
|
||||||
import mineplex.core.gadget.persistence.UserGadgetPersistence;
|
import mineplex.core.gadget.persistence.UserGadgetPersistence;
|
||||||
import mineplex.core.gadget.set.SetBalance;
|
import mineplex.core.gadget.set.SetBalance;
|
||||||
import mineplex.core.gadget.set.SetCanadian;
|
import mineplex.core.gadget.set.SetCanadian;
|
||||||
@ -376,6 +377,8 @@ import mineplex.core.incognito.IncognitoManager;
|
|||||||
import mineplex.core.incognito.events.IncognitoStatusChangeEvent;
|
import mineplex.core.incognito.events.IncognitoStatusChangeEvent;
|
||||||
import mineplex.core.inventory.InventoryManager;
|
import mineplex.core.inventory.InventoryManager;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
|
import mineplex.core.mission.MissionManager;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
import mineplex.core.packethandler.PacketHandler;
|
import mineplex.core.packethandler.PacketHandler;
|
||||||
import mineplex.core.pet.PetManager;
|
import mineplex.core.pet.PetManager;
|
||||||
import mineplex.core.preferences.PreferencesManager;
|
import mineplex.core.preferences.PreferencesManager;
|
||||||
@ -422,6 +425,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
private final HologramManager _hologramManager;
|
private final HologramManager _hologramManager;
|
||||||
private final IncognitoManager _incognitoManager;
|
private final IncognitoManager _incognitoManager;
|
||||||
private final GameCosmeticManager _gameCosmeticManager;
|
private final GameCosmeticManager _gameCosmeticManager;
|
||||||
|
private final MissionManager _missionManager;
|
||||||
private SoulManager _soulManager;
|
private SoulManager _soulManager;
|
||||||
private CastleManager _castleManager;
|
private CastleManager _castleManager;
|
||||||
|
|
||||||
@ -460,11 +464,13 @@ public class GadgetManager extends MiniPlugin
|
|||||||
_userGadgetPersistence = new UserGadgetPersistence(this);
|
_userGadgetPersistence = new UserGadgetPersistence(this);
|
||||||
_incognitoManager = require(IncognitoManager.class);
|
_incognitoManager = require(IncognitoManager.class);
|
||||||
_gameCosmeticManager = require(GameCosmeticManager.class);
|
_gameCosmeticManager = require(GameCosmeticManager.class);
|
||||||
|
_missionManager = require(MissionManager.class);
|
||||||
_soulManager = new SoulManager();
|
_soulManager = new SoulManager();
|
||||||
_castleManager = require(CastleManager.class);
|
_castleManager = require(CastleManager.class);
|
||||||
|
|
||||||
createGadgets();
|
createGadgets();
|
||||||
createSets();
|
createSets();
|
||||||
|
registerTrackers();
|
||||||
generatePermissions();
|
generatePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1023,6 +1029,11 @@ public class GadgetManager extends MiniPlugin
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerTrackers()
|
||||||
|
{
|
||||||
|
_missionManager.registerTrackers(new GadgetUseTracker(_missionManager));
|
||||||
|
}
|
||||||
|
|
||||||
public <T extends Gadget> T getGadget(Class<T> c)
|
public <T extends Gadget> T getGadget(Class<T> c)
|
||||||
{
|
{
|
||||||
for (GadgetType type : GadgetType.values())
|
for (GadgetType type : GadgetType.values())
|
||||||
@ -1624,6 +1635,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_missionManager.incrementProgress(player, 1, MissionTrackerType.GAME_TAUNT, null, gadget.getClass());
|
||||||
taunt.start(player);
|
taunt.start(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1688,4 +1700,9 @@ public class GadgetManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
return _achievementManager;
|
return _achievementManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MissionManager getMissionManager()
|
||||||
|
{
|
||||||
|
return _missionManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import mineplex.core.gadget.GadgetManager;
|
|||||||
import mineplex.core.gadget.gadgets.Ammo;
|
import mineplex.core.gadget.gadgets.Ammo;
|
||||||
import mineplex.core.gadget.types.ItemGadget;
|
import mineplex.core.gadget.types.ItemGadget;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
import mineplex.core.projectile.IThrown;
|
import mineplex.core.projectile.IThrown;
|
||||||
import mineplex.core.projectile.ProjectileUser;
|
import mineplex.core.projectile.ProjectileUser;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -81,6 +82,8 @@ public class ItemFleshHook extends ItemGadget implements IThrown
|
|||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(target, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(getName()) + "."));
|
UtilPlayer.message(target, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(getName()) + "."));
|
||||||
|
|
||||||
|
Manager.getMissionManager().incrementProgress(player, 1, MissionTrackerType.LOBBY_FLESH_HOOK, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package mineplex.core.gadget.mission;
|
||||||
|
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
|
import mineplex.core.gadget.event.ItemGadgetUseEvent;
|
||||||
|
import mineplex.core.gadget.types.Gadget;
|
||||||
|
import mineplex.core.mission.MissionManager;
|
||||||
|
import mineplex.core.mission.MissionTracker;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
|
|
||||||
|
public class GadgetUseTracker extends MissionTracker<Class<? extends Gadget>>
|
||||||
|
{
|
||||||
|
|
||||||
|
public GadgetUseTracker(MissionManager manager)
|
||||||
|
{
|
||||||
|
super(manager, MissionTrackerType.LOBBY_GADGET_USE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void gadgetUse(ItemGadgetUseEvent event)
|
||||||
|
{
|
||||||
|
incrementProgress(event.getPlayer(), 1, null, event.getGadget().getClass());
|
||||||
|
}
|
||||||
|
}
|
@ -32,9 +32,9 @@ public enum MissionLength
|
|||||||
_calendarField = calendarField;
|
_calendarField = calendarField;
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> PlayerMission<T> createFromContext(MissionContext<T> context)
|
public <T> PlayerMission<T> createFromContext(MissionContext<T> context, double rankBonus)
|
||||||
{
|
{
|
||||||
return new PlayerMission<>(context, this, context.getRandomX(), context.getRandomY(), 0);
|
return new PlayerMission<>(context, this, context.getRandomX(), context.getRandomY(), 0, rankBonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
|
@ -10,6 +10,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
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.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -116,10 +117,18 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearTrackers()
|
public void clearTrackers(Predicate<MissionTracker> removeIf)
|
||||||
{
|
{
|
||||||
_missionTrackers.forEach(UtilServer::Unregister);
|
_missionTrackers.removeIf(tracker ->
|
||||||
_missionTrackers.clear();
|
{
|
||||||
|
if (removeIf.test(tracker))
|
||||||
|
{
|
||||||
|
UtilServer.Unregister(tracker);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -145,7 +154,7 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
int x = resultSet.getInt("x");
|
int x = resultSet.getInt("x");
|
||||||
int y = resultSet.getInt("y");
|
int y = resultSet.getInt("y");
|
||||||
long startTime = resultSet.getLong("startTime");
|
long startTime = resultSet.getLong("startTime");
|
||||||
PlayerMission mission = new PlayerMission<>(context, MissionLength.values()[length], x, y, progress);
|
PlayerMission mission = new PlayerMission<>(context, MissionLength.values()[length], x, y, progress, getRankBonus(uuid));
|
||||||
|
|
||||||
Calendar start = Calendar.getInstance(utc);
|
Calendar start = Calendar.getInstance(utc);
|
||||||
start.setTimeInMillis(startTime);
|
start.setTimeInMillis(startTime);
|
||||||
@ -262,7 +271,7 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
startMission(player, MissionLength.EVENT.createFromContext(context));
|
startMission(player, MissionLength.EVENT.createFromContext(context, getRankBonus(player)));
|
||||||
started++;
|
started++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +304,7 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
}
|
}
|
||||||
|
|
||||||
missions.remove(context);
|
missions.remove(context);
|
||||||
startMission(player, length.createFromContext(context));
|
startMission(player, length.createFromContext(context, getRankBonus(player)));
|
||||||
started++;
|
started++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,6 +362,30 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double getRankBonus(Player player)
|
||||||
|
{
|
||||||
|
return getRankBonus(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
private double getRankBonus(UUID player)
|
||||||
|
{
|
||||||
|
switch (ClientManager.Get(player).getPrimaryGroup())
|
||||||
|
{
|
||||||
|
case PLAYER:
|
||||||
|
return 0;
|
||||||
|
case ULTRA:
|
||||||
|
return 0.5;
|
||||||
|
case HERO:
|
||||||
|
return 1;
|
||||||
|
case LEGEND:
|
||||||
|
return 1.5;
|
||||||
|
case TITAN:
|
||||||
|
return 2;
|
||||||
|
default:
|
||||||
|
return 2.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void createNPC(Location location)
|
public void createNPC(Location location)
|
||||||
{
|
{
|
||||||
NPC npc = SimpleNPC.of(location, Slime.class, NPC_METADATA, 3);
|
NPC npc = SimpleNPC.of(location, Slime.class, NPC_METADATA, 3);
|
||||||
|
@ -2,13 +2,10 @@ package mineplex.core.mission;
|
|||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
import mineplex.core.achievement.leveling.rewards.LevelChestReward;
|
|
||||||
import mineplex.core.achievement.leveling.rewards.LevelCurrencyReward;
|
import mineplex.core.achievement.leveling.rewards.LevelCurrencyReward;
|
||||||
import mineplex.core.achievement.leveling.rewards.LevelExperienceReward;
|
import mineplex.core.achievement.leveling.rewards.LevelExperienceReward;
|
||||||
import mineplex.core.common.currency.GlobalCurrency;
|
import mineplex.core.common.currency.GlobalCurrency;
|
||||||
import mineplex.core.treasure.types.TreasureType;
|
|
||||||
|
|
||||||
import static mineplex.core.game.GameDisplay.*;
|
|
||||||
import static mineplex.core.mission.MissionTrackerType.*;
|
import static mineplex.core.mission.MissionTrackerType.*;
|
||||||
|
|
||||||
public class MissionPopulator
|
public class MissionPopulator
|
||||||
@ -16,30 +13,146 @@ public class MissionPopulator
|
|||||||
|
|
||||||
public static void populateMissions(MissionManager manager)
|
public static void populateMissions(MissionManager manager)
|
||||||
{
|
{
|
||||||
MissionContext.<Material>newBuilder(manager, 1)
|
/*
|
||||||
.name("Gold Finger")
|
Similar to GameKits, Mission ids should be grouped according to the game. With each group having 100
|
||||||
.description("Get %s kills with a Golden Pickaxe")
|
ids to use.
|
||||||
.xRange(4, 8)
|
*/
|
||||||
.games(CakeWars4, CakeWarsDuos)
|
|
||||||
.tracker(GAME_KILL)
|
// Lobby Missions 0-99
|
||||||
.trackerData(Material.GOLD_PICKAXE)
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 0)
|
||||||
|
.name("Parkourist")
|
||||||
|
.description("Complete any Parkour")
|
||||||
|
.tracker(LOBBY_PARKOUR)
|
||||||
.rewards(
|
.rewards(
|
||||||
new LevelCurrencyReward(GlobalCurrency.GEM, 2000),
|
new LevelExperienceReward(200),
|
||||||
new LevelExperienceReward(100)
|
new LevelCurrencyReward(GlobalCurrency.GEM, 100),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 100)
|
||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.<GameDisplay>newBuilder(manager, 2)
|
MissionContext.<Material>newBuilder(manager, 1)
|
||||||
.name("Cake Winner")
|
.name("Gadget Crazy")
|
||||||
.description("Win %s games of Cake Wars Standard")
|
.description("Use %s gadgets")
|
||||||
.xRange(2, 4)
|
.xRange(25, 50)
|
||||||
.games(CakeWars4)
|
.tracker(LOBBY_GADGET_USE)
|
||||||
.tracker(GAME_WIN)
|
|
||||||
.rewards(
|
.rewards(
|
||||||
new LevelCurrencyReward(GlobalCurrency.GEM, 2000),
|
new LevelExperienceReward(3),
|
||||||
new LevelChestReward(TreasureType.ANCIENT, 1)
|
new LevelCurrencyReward(GlobalCurrency.GEM, 2),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 2)
|
||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 2)
|
||||||
|
.name("Not In The Face!")
|
||||||
|
.description("Flesh Hook %s players")
|
||||||
|
.xRange(25, 50)
|
||||||
|
.tracker(LOBBY_FLESH_HOOK)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(5),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 2),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 2)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 3)
|
||||||
|
.name("Jumper")
|
||||||
|
.description("Use a jump pad %s times")
|
||||||
|
.xRange(10, 50)
|
||||||
|
.tracker(LOBBY_JUMP_PAD)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(5),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 2),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 2)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 4)
|
||||||
|
.name("Mini Mini Games")
|
||||||
|
.description("Play %s Lobby Games")
|
||||||
|
.xRange(2, 4)
|
||||||
|
.tracker(LOBBY_GAMES_PLAYED)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(10),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 5),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 5)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 5)
|
||||||
|
.name("Quick Killer")
|
||||||
|
.description("Kill someone in under %s seconds in GLD")
|
||||||
|
.yRange(45, 60)
|
||||||
|
.tracker(LOBBY_GLD_QUICK)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(1000),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 300),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 300)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 6)
|
||||||
|
.name("Skilled")
|
||||||
|
.description("Take no damage in GLD")
|
||||||
|
.tracker(LOBBY_GLD_NO_DAMAGE)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(1000),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 300),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 300)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Global Game Missions 100-199
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 100)
|
||||||
|
.name("Enthusiast")
|
||||||
|
.description("Play %s games.")
|
||||||
|
.xRange(10, 50)
|
||||||
|
.tracker(GAME_PLAY)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(10),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 5),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 5)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 101)
|
||||||
|
.name("Winner")
|
||||||
|
.description("Win %s games.")
|
||||||
|
.xRange(2, 10)
|
||||||
|
.tracker(GAME_WIN)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(40),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 20),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 20)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 102)
|
||||||
|
.name("Killer")
|
||||||
|
.description("Kill %s players in game.")
|
||||||
|
.xRange(10, 50)
|
||||||
|
.tracker(GAME_KILL)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(10),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 5),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 5)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MissionContext.<Material>newBuilder(manager, 103)
|
||||||
|
.name("I Shall Taunt You A Second Time")
|
||||||
|
.description("Taunt %s times in game.")
|
||||||
|
.xRange(2, 20)
|
||||||
|
.tracker(GAME_TAUNT)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(30),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 10),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 10)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Turf Wars
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,17 @@ package mineplex.core.mission;
|
|||||||
public enum MissionTrackerType
|
public enum MissionTrackerType
|
||||||
{
|
{
|
||||||
|
|
||||||
|
LOBBY_PARKOUR,
|
||||||
|
LOBBY_GADGET_USE,
|
||||||
|
LOBBY_FLESH_HOOK,
|
||||||
|
LOBBY_JUMP_PAD,
|
||||||
|
LOBBY_GAMES_PLAYED,
|
||||||
|
LOBBY_GLD_QUICK,
|
||||||
|
LOBBY_GLD_NO_DAMAGE,
|
||||||
|
|
||||||
GAME_WIN,
|
GAME_WIN,
|
||||||
GAME_KILL
|
GAME_PLAY,
|
||||||
|
GAME_KILL,
|
||||||
|
GAME_TAUNT,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package mineplex.core.mission;
|
package mineplex.core.mission;
|
||||||
|
|
||||||
|
import mineplex.core.achievement.leveling.rewards.LevelCurrencyReward;
|
||||||
import mineplex.core.achievement.leveling.rewards.LevelReward;
|
import mineplex.core.achievement.leveling.rewards.LevelReward;
|
||||||
import mineplex.core.achievement.leveling.rewards.ScalableLevelReward;
|
import mineplex.core.achievement.leveling.rewards.ScalableLevelReward;
|
||||||
|
import mineplex.core.common.currency.GlobalCurrency;
|
||||||
import mineplex.core.game.GameDisplay;
|
import mineplex.core.game.GameDisplay;
|
||||||
|
|
||||||
public class PlayerMission<T> implements Mission<T>
|
public class PlayerMission<T> implements Mission<T>
|
||||||
@ -18,7 +20,7 @@ public class PlayerMission<T> implements Mission<T>
|
|||||||
private int _currentProgress, _unsavedProgress;
|
private int _currentProgress, _unsavedProgress;
|
||||||
private boolean _rewarded;
|
private boolean _rewarded;
|
||||||
|
|
||||||
PlayerMission(MissionContext<T> context, MissionLength length, int x, int y, int currentProgress)
|
PlayerMission(MissionContext<T> context, MissionLength length, int x, int y, int currentProgress, double rankBonus)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_length = length;
|
_length = length;
|
||||||
@ -26,9 +28,16 @@ public class PlayerMission<T> implements Mission<T>
|
|||||||
_x = x * length.getxScale();
|
_x = x * length.getxScale();
|
||||||
_y = y;
|
_y = y;
|
||||||
|
|
||||||
_description = String.format(context.getDescription(), _x, y);
|
if (_x == 0)
|
||||||
|
{
|
||||||
|
_description = String.format(context.getDescription(), _x, y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_description = String.format(context.getDescription(), y);
|
||||||
|
}
|
||||||
|
|
||||||
if (_x != 1)
|
if (_x != 1 || rankBonus > 0)
|
||||||
{
|
{
|
||||||
_rewards = new LevelReward[context.getRewards().length];
|
_rewards = new LevelReward[context.getRewards().length];
|
||||||
|
|
||||||
@ -38,7 +47,14 @@ public class PlayerMission<T> implements Mission<T>
|
|||||||
|
|
||||||
if (reward instanceof ScalableLevelReward)
|
if (reward instanceof ScalableLevelReward)
|
||||||
{
|
{
|
||||||
_rewards[i] = ((ScalableLevelReward) reward).cloneScalable(x);
|
double shardRankBonus = 1;
|
||||||
|
|
||||||
|
if (reward instanceof LevelCurrencyReward && ((LevelCurrencyReward) reward).getType().equals(GlobalCurrency.TREASURE_SHARD))
|
||||||
|
{
|
||||||
|
shardRankBonus += rankBonus;
|
||||||
|
}
|
||||||
|
|
||||||
|
_rewards[i] = ((ScalableLevelReward) reward).cloneScalable(_x * shardRankBonus);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,11 @@ public class MissionMainPage extends ShopPageBase<MissionManager, MissionShop>
|
|||||||
.setTitle((complete ? C.cGreenB : C.cYellowB))
|
.setTitle((complete ? C.cGreenB : C.cYellowB))
|
||||||
.addLore("");
|
.addLore("");
|
||||||
|
|
||||||
if (games.length > 0)
|
if (games.length == GameDisplay.values().length)
|
||||||
|
{
|
||||||
|
builder.addLore("Game: " + C.Reset + "Any");
|
||||||
|
}
|
||||||
|
else if (games.length > 0)
|
||||||
{
|
{
|
||||||
String lore = "Game: " + C.Reset + games[0].getName();
|
String lore = "Game: " + C.Reset + games[0].getName();
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ import mineplex.core.chat.IChatMessageFormatter;
|
|||||||
import mineplex.core.common.generator.VoidGenerator;
|
import mineplex.core.common.generator.VoidGenerator;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
@ -142,6 +143,7 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
|
|||||||
private final HologramManager _hologramManager;
|
private final HologramManager _hologramManager;
|
||||||
private final ParkourManager _parkourManager;
|
private final ParkourManager _parkourManager;
|
||||||
private final HubGameManager _hubGameManager;
|
private final HubGameManager _hubGameManager;
|
||||||
|
private final MissionManager _missionManager;
|
||||||
|
|
||||||
private final HubPlugin _hubPlugin;
|
private final HubPlugin _hubPlugin;
|
||||||
|
|
||||||
@ -207,6 +209,10 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
|
|||||||
new ForcefieldManager(this);
|
new ForcefieldManager(this);
|
||||||
|
|
||||||
_achievementManager = achievementManager;
|
_achievementManager = achievementManager;
|
||||||
|
_missionManager = require(MissionManager.class);
|
||||||
|
Location location = _worldData.getCustomLocation("MISSIONS").get(0);
|
||||||
|
location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, GetSpawn())));
|
||||||
|
_missionManager.createNPC(location);
|
||||||
|
|
||||||
new NotificationManager(getPlugin(), clientManager);
|
new NotificationManager(getPlugin(), clientManager);
|
||||||
new BotSpamManager(_plugin, clientManager, punish);
|
new BotSpamManager(_plugin, clientManager, punish);
|
||||||
@ -572,6 +578,11 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
|
|||||||
return _hubGameManager;
|
return _hubGameManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MissionManager getMissionManager()
|
||||||
|
{
|
||||||
|
return _missionManager;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void ignoreVelocity(PlayerVelocityEvent event)
|
public void ignoreVelocity(PlayerVelocityEvent event)
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,7 @@ import mineplex.core.disguise.disguises.DisguiseChicken;
|
|||||||
import mineplex.core.disguise.disguises.DisguiseEnderman;
|
import mineplex.core.disguise.disguises.DisguiseEnderman;
|
||||||
import mineplex.core.disguise.disguises.DisguiseWither;
|
import mineplex.core.disguise.disguises.DisguiseWither;
|
||||||
import mineplex.core.gadget.event.GadgetBlockEvent;
|
import mineplex.core.gadget.event.GadgetBlockEvent;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
import mineplex.core.preferences.Preference;
|
import mineplex.core.preferences.Preference;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -147,6 +148,7 @@ public class JumpManager extends MiniPlugin
|
|||||||
direction.setY(1.2);
|
direction.setY(1.2);
|
||||||
player.getWorld().playSound(location, Sound.CHICKEN_EGG_POP, 2, 0.5F);
|
player.getWorld().playSound(location, Sound.CHICKEN_EGG_POP, 2, 0.5F);
|
||||||
UtilAction.velocity(player, direction);
|
UtilAction.velocity(player, direction);
|
||||||
|
Manager.getMissionManager().incrementProgress(player, 1, MissionTrackerType.LOBBY_JUMP_PAD, null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public class DamageComponent extends HubGameComponent<HubGame>
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void playerDeath(CombatDeathEvent event)
|
public void playerDeath(CombatDeathEvent event)
|
||||||
{
|
{
|
||||||
Player player = (Player) event.GetEvent().getEntity();
|
Player player = event.GetEvent().getEntity();
|
||||||
|
|
||||||
if (!_game.isAlive(player))
|
if (!_game.isAlive(player))
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package mineplex.hub.hubgame.common.general;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
|
import mineplex.core.mission.MissionManager;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
|
import mineplex.hub.hubgame.CycledGame;
|
||||||
|
import mineplex.hub.hubgame.CycledGame.GameState;
|
||||||
|
import mineplex.hub.hubgame.common.HubGameComponent;
|
||||||
|
import mineplex.hub.hubgame.event.HubGameStateChangeEvent;
|
||||||
|
|
||||||
|
public class MissionsComponent extends HubGameComponent<CycledGame>
|
||||||
|
{
|
||||||
|
|
||||||
|
public MissionsComponent(CycledGame game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void gamesPlayed(HubGameStateChangeEvent event)
|
||||||
|
{
|
||||||
|
if (event.getState() != GameState.End || !event.getGame().equals(_game))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MissionManager manager = _game.getManager().getHubManager().getMissionManager();
|
||||||
|
|
||||||
|
for (Player player : _game.getAllPlayers())
|
||||||
|
{
|
||||||
|
manager.incrementProgress(player, 1, MissionTrackerType.LOBBY_GAMES_PLAYED, null, _game.getGameType().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package mineplex.hub.hubgame.duel;
|
package mineplex.hub.hubgame.duel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -15,6 +16,8 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
|
import mineplex.core.mission.MissionManager;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
import mineplex.hub.hubgame.CycledGame;
|
import mineplex.hub.hubgame.CycledGame;
|
||||||
import mineplex.hub.hubgame.HubGameManager;
|
import mineplex.hub.hubgame.HubGameManager;
|
||||||
import mineplex.hub.hubgame.HubGameType;
|
import mineplex.hub.hubgame.HubGameType;
|
||||||
@ -23,12 +26,14 @@ import mineplex.hub.hubgame.common.general.DoubleJumpComponent;
|
|||||||
import mineplex.hub.hubgame.common.general.GameDescriptionComponent;
|
import mineplex.hub.hubgame.common.general.GameDescriptionComponent;
|
||||||
import mineplex.hub.hubgame.common.general.GameTimeoutComponent;
|
import mineplex.hub.hubgame.common.general.GameTimeoutComponent;
|
||||||
import mineplex.hub.hubgame.common.general.InventoryEditComponent;
|
import mineplex.hub.hubgame.common.general.InventoryEditComponent;
|
||||||
|
import mineplex.hub.hubgame.common.general.MissionsComponent;
|
||||||
import mineplex.hub.hubgame.common.general.PlayerGameModeComponent;
|
import mineplex.hub.hubgame.common.general.PlayerGameModeComponent;
|
||||||
import mineplex.hub.hubgame.common.general.PrepareFreezeComponent;
|
import mineplex.hub.hubgame.common.general.PrepareFreezeComponent;
|
||||||
import mineplex.hub.hubgame.common.general.SingleWinnerComponent;
|
import mineplex.hub.hubgame.common.general.SingleWinnerComponent;
|
||||||
import mineplex.hub.hubgame.common.map.BlockRecorderComponent;
|
import mineplex.hub.hubgame.common.map.BlockRecorderComponent;
|
||||||
import mineplex.hub.hubgame.common.map.PreventNonAlivePlayersComponent;
|
import mineplex.hub.hubgame.common.map.PreventNonAlivePlayersComponent;
|
||||||
import mineplex.hub.hubgame.common.map.TeleportIntoMapComponent;
|
import mineplex.hub.hubgame.common.map.TeleportIntoMapComponent;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class Duels extends CycledGame
|
public class Duels extends CycledGame
|
||||||
{
|
{
|
||||||
@ -71,10 +76,15 @@ public class Duels extends CycledGame
|
|||||||
.build(),
|
.build(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private final List<Player> _notDamaged;
|
||||||
|
private long _lastStart;
|
||||||
|
|
||||||
public Duels(HubGameManager manager)
|
public Duels(HubGameManager manager)
|
||||||
{
|
{
|
||||||
super(manager, HubGameType.DUELS);
|
super(manager, HubGameType.DUELS);
|
||||||
|
|
||||||
|
_notDamaged = new ArrayList<>(getGameType().getMaxPlayers());
|
||||||
|
|
||||||
registerComponent(new DamageComponent(this));
|
registerComponent(new DamageComponent(this));
|
||||||
//registerComponent(new PVPTrackerComponent(this));
|
//registerComponent(new PVPTrackerComponent(this));
|
||||||
registerComponent(new GameDescriptionComponent(this, player ->
|
registerComponent(new GameDescriptionComponent(this, player ->
|
||||||
@ -96,6 +106,7 @@ public class Duels extends CycledGame
|
|||||||
registerComponent(new GameTimeoutComponent(this, TimeUnit.MINUTES.toMillis(2)));
|
registerComponent(new GameTimeoutComponent(this, TimeUnit.MINUTES.toMillis(2)));
|
||||||
registerComponent(new SingleWinnerComponent(this));
|
registerComponent(new SingleWinnerComponent(this));
|
||||||
registerComponent(new PlayerGameModeComponent(this, GameMode.SURVIVAL));
|
registerComponent(new PlayerGameModeComponent(this, GameMode.SURVIVAL));
|
||||||
|
registerComponent(new MissionsComponent(this));
|
||||||
|
|
||||||
List<Location> corners = _worldData.getDataLocation("LIME");
|
List<Location> corners = _worldData.getDataLocation("LIME");
|
||||||
Location a = corners.get(0);
|
Location a = corners.get(0);
|
||||||
@ -108,13 +119,36 @@ public class Duels extends CycledGame
|
|||||||
@Override
|
@Override
|
||||||
public void onPrepare()
|
public void onPrepare()
|
||||||
{
|
{
|
||||||
|
_lastStart = System.currentTimeMillis();
|
||||||
|
_notDamaged.clear();
|
||||||
|
|
||||||
for (Player player : getAlivePlayers())
|
for (Player player : getAlivePlayers())
|
||||||
{
|
{
|
||||||
player.getInventory().addItem(ITEMS);
|
player.getInventory().addItem(ITEMS);
|
||||||
player.getInventory().setArmorContents(ARMOUR);
|
player.getInventory().setArmorContents(ARMOUR);
|
||||||
|
_notDamaged.add(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnd()
|
||||||
|
{
|
||||||
|
MissionManager manager = getManager().getHubManager().getMissionManager();
|
||||||
|
long since = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - _lastStart);
|
||||||
|
|
||||||
|
for (Player player : getAlivePlayers())
|
||||||
|
{
|
||||||
|
manager.incrementProgress(player, 1, MissionTrackerType.LOBBY_GLD_QUICK, null, since);
|
||||||
|
|
||||||
|
if (_notDamaged.contains(player))
|
||||||
|
{
|
||||||
|
manager.incrementProgress(player, 1, MissionTrackerType.LOBBY_GLD_NO_DAMAGE, null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_notDamaged.clear();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean endCheck()
|
public boolean endCheck()
|
||||||
{
|
{
|
||||||
@ -136,4 +170,17 @@ public class Duels extends CycledGame
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void damage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
Player damagee = event.GetDamageePlayer();
|
||||||
|
|
||||||
|
if (damagee == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_notDamaged.remove(damagee);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import mineplex.hub.hubgame.HubGameManager;
|
|||||||
import mineplex.hub.hubgame.HubGameType;
|
import mineplex.hub.hubgame.HubGameType;
|
||||||
import mineplex.hub.hubgame.common.general.GameDescriptionComponent;
|
import mineplex.hub.hubgame.common.general.GameDescriptionComponent;
|
||||||
import mineplex.hub.hubgame.common.general.GameTimeoutComponent;
|
import mineplex.hub.hubgame.common.general.GameTimeoutComponent;
|
||||||
|
import mineplex.hub.hubgame.common.general.MissionsComponent;
|
||||||
import mineplex.hub.hubgame.common.general.PlacesComponent;
|
import mineplex.hub.hubgame.common.general.PlacesComponent;
|
||||||
import mineplex.hub.hubgame.common.map.PreventNonAlivePlayersComponent;
|
import mineplex.hub.hubgame.common.map.PreventNonAlivePlayersComponent;
|
||||||
import mineplex.hub.hubgame.common.map.TeleportIntoMapComponent;
|
import mineplex.hub.hubgame.common.map.TeleportIntoMapComponent;
|
||||||
@ -47,6 +48,7 @@ public class Tron extends CycledGame
|
|||||||
registerComponent(new GameDescriptionComponent(this));
|
registerComponent(new GameDescriptionComponent(this));
|
||||||
registerComponent(new GameTimeoutComponent(this, TimeUnit.MINUTES.toMillis(3)));
|
registerComponent(new GameTimeoutComponent(this, TimeUnit.MINUTES.toMillis(3)));
|
||||||
registerComponent(new PlacesComponent(this));
|
registerComponent(new PlacesComponent(this));
|
||||||
|
registerComponent(new MissionsComponent(this));
|
||||||
|
|
||||||
List<Location> corners = _worldData.getDataLocation("WHITE");
|
List<Location> corners = _worldData.getDataLocation("WHITE");
|
||||||
Location a = corners.get(0);
|
Location a = corners.get(0);
|
||||||
|
@ -14,7 +14,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
|
||||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
@ -32,6 +31,7 @@ import mineplex.core.gadget.event.GadgetBlockEvent;
|
|||||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||||
import mineplex.core.gadget.event.GadgetEnableEvent;
|
import mineplex.core.gadget.event.GadgetEnableEvent;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
import mineplex.core.newnpc.NPC;
|
import mineplex.core.newnpc.NPC;
|
||||||
import mineplex.core.newnpc.NewNPCManager;
|
import mineplex.core.newnpc.NewNPCManager;
|
||||||
import mineplex.core.newnpc.event.NPCInteractEvent;
|
import mineplex.core.newnpc.event.NPCInteractEvent;
|
||||||
@ -251,7 +251,7 @@ public class ParkourManager extends MiniPlugin
|
|||||||
|
|
||||||
private void rewardPlayer(Player player, ParkourData data)
|
private void rewardPlayer(Player player, ParkourData data)
|
||||||
{
|
{
|
||||||
|
_hubManager.getMissionManager().incrementProgress(player, 1, MissionTrackerType.LOBBY_PARKOUR, null, data.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Entry<Player, ParkourAttempt>> getActivePlayers(ParkourData data)
|
public List<Entry<Player, ParkourAttempt>> getActivePlayers(ParkourData data)
|
||||||
|
@ -104,7 +104,9 @@ 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.GameMissionTracker;
|
||||||
import nautilus.game.arcade.missions.KillMissionTracker;
|
import nautilus.game.arcade.missions.KillMissionTracker;
|
||||||
|
import nautilus.game.arcade.missions.PlayGameMissionTracker;
|
||||||
import nautilus.game.arcade.missions.WinMissionTracker;
|
import nautilus.game.arcade.missions.WinMissionTracker;
|
||||||
import nautilus.game.arcade.scoreboard.GameScoreboard;
|
import nautilus.game.arcade.scoreboard.GameScoreboard;
|
||||||
import nautilus.game.arcade.stats.AssistsStatTracker;
|
import nautilus.game.arcade.stats.AssistsStatTracker;
|
||||||
@ -438,6 +440,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
|
|
||||||
// Mission Tracks
|
// Mission Tracks
|
||||||
registerMissions(
|
registerMissions(
|
||||||
|
new PlayGameMissionTracker(this),
|
||||||
new WinMissionTracker(this),
|
new WinMissionTracker(this),
|
||||||
new KillMissionTracker(this)
|
new KillMissionTracker(this)
|
||||||
);
|
);
|
||||||
@ -2109,7 +2112,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
Managers.get(AntiHack.class).setStrict(false);
|
Managers.get(AntiHack.class).setStrict(false);
|
||||||
getLifetime().end();
|
getLifetime().end();
|
||||||
getStatTrackers().forEach(HandlerList::unregisterAll);
|
getStatTrackers().forEach(HandlerList::unregisterAll);
|
||||||
getArcadeManager().getMissionsManager().clearTrackers();
|
getArcadeManager().getMissionsManager().clearTrackers(tracker -> tracker instanceof GameMissionTracker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
package nautilus.game.arcade.missions;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
|
import mineplex.core.game.GameDisplay;
|
||||||
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
|
import nautilus.game.arcade.game.Game;
|
||||||
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
|
|
||||||
|
public class PlayGameMissionTracker extends GameMissionTracker<GameDisplay, Game>
|
||||||
|
{
|
||||||
|
|
||||||
|
public PlayGameMissionTracker(Game game)
|
||||||
|
{
|
||||||
|
super(MissionTrackerType.GAME_PLAY, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void gameStart(GameStateChangeEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetState() != GameState.Live)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run after 30 seconds so that players don't quit immediately
|
||||||
|
_manager.runSyncLater(() ->
|
||||||
|
{
|
||||||
|
for (Player player : _game.GetPlayers(false))
|
||||||
|
{
|
||||||
|
if (!player.isOnline())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
incrementProgress(player, 1, null);
|
||||||
|
}
|
||||||
|
}, 600);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user