Mission fixes from personal testing
This commit is contained in:
parent
637a17fbee
commit
2d2333ec38
@ -24,6 +24,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
|||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
import org.bukkit.inventory.AnvilInventory;
|
import org.bukkit.inventory.AnvilInventory;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
@ -383,6 +384,7 @@ 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;
|
||||||
import mineplex.core.projectile.ProjectileManager;
|
import mineplex.core.projectile.ProjectileManager;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.stats.event.PlayerStatsLoadedEvent;
|
import mineplex.core.stats.event.PlayerStatsLoadedEvent;
|
||||||
|
|
||||||
@ReflectivelyCreateMiniPlugin
|
@ReflectivelyCreateMiniPlugin
|
||||||
@ -1306,13 +1308,24 @@ public class GadgetManager extends MiniPlugin
|
|||||||
player.sendMessage(F.main(getName(), "You cannot use that cosmetic in this area."));
|
player.sendMessage(F.main(getName(), "You cannot use that cosmetic in this area."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void doubleJump(PlayerToggleFlightEvent event)
|
||||||
|
{
|
||||||
|
playLeapEffect(event.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
public void playLeapEffect(Player player)
|
public void playLeapEffect(Player player)
|
||||||
{
|
{
|
||||||
if (hideParticles())
|
if (UtilPlayer.isSpectator(player) || hideParticles() || player.isFlying())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!UtilServer.isHubServer())
|
||||||
|
{
|
||||||
|
_missionManager.incrementProgress(player, 1, MissionTrackerType.GAME_LEAP, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
Gadget gadget = getActive(player, GadgetType.DOUBLE_JUMP);
|
Gadget gadget = getActive(player, GadgetType.DOUBLE_JUMP);
|
||||||
|
|
||||||
if (gadget != null)
|
if (gadget != null)
|
||||||
@ -1635,7 +1648,13 @@ public class GadgetManager extends MiniPlugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_missionManager.incrementProgress(player, 1, MissionTrackerType.GAME_TAUNT, null, gadget.getClass());
|
// TODO FIX ME
|
||||||
|
// LCastr0 is an idiot so this is the only solution
|
||||||
|
if (Recharge.Instance.use(player, "Taunt Mission", 30000, false, false))
|
||||||
|
{
|
||||||
|
_missionManager.incrementProgress(player, 1, MissionTrackerType.GAME_TAUNT, null, gadget.getClass());
|
||||||
|
}
|
||||||
|
|
||||||
taunt.start(player);
|
taunt.start(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,7 @@ package mineplex.core.gadget.types;
|
|||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
|
||||||
public abstract class DoubleJumpEffectGadget extends Gadget
|
public abstract class DoubleJumpEffectGadget extends Gadget
|
||||||
@ -16,23 +13,5 @@ public abstract class DoubleJumpEffectGadget extends Gadget
|
|||||||
super(manager, GadgetType.DOUBLE_JUMP, name, desc, cost, mat, data, 1, altNames);
|
super(manager, GadgetType.DOUBLE_JUMP, name, desc, cost, mat, data, 1, altNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldDisplay(Player player)
|
|
||||||
{
|
|
||||||
return !UtilPlayer.isSpectator(player) && !Manager.hideParticles() && !player.isFlying() && isActive(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void jump(PlayerToggleFlightEvent event)
|
|
||||||
{
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
|
|
||||||
if (!shouldDisplay(player))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
doEffect(event.getPlayer());
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void doEffect(Player player);
|
public abstract void doEffect(Player player);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public interface Mission<T>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return getGames().length == 0;
|
return getGames().length == 0 || getGames().length == GameDisplay.values().length;
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean validateData(T data)
|
default boolean validateData(T data)
|
||||||
|
@ -11,7 +11,7 @@ import mineplex.core.common.util.UtilText;
|
|||||||
public enum MissionLength
|
public enum MissionLength
|
||||||
{
|
{
|
||||||
|
|
||||||
DAY("Daily", UtilText.splitLineToArray(C.cGray + "Here you will find missions that you can only participate in only for today. Each day you get a handful of brand new missions.", LineFormat.LORE), ChatColor.WHITE, 0, 1, Calendar.DAY_OF_WEEK),
|
DAY("Daily", UtilText.splitLineToArray(C.cGray + "Here you will find missions that you can participate in only for today. Each day you get a handful of brand new missions.", LineFormat.LORE), ChatColor.WHITE, 0, 1, Calendar.DAY_OF_WEEK),
|
||||||
WEEK("Weekly", UtilText.splitLineToArray(C.cGray + "These missions wil rotate out every Monday. They will be daily missions that have an increased objective and rewards.", LineFormat.LORE), ChatColor.GREEN, 7, 7, Calendar.WEEK_OF_YEAR),
|
WEEK("Weekly", UtilText.splitLineToArray(C.cGray + "These missions wil rotate out every Monday. They will be daily missions that have an increased objective and rewards.", LineFormat.LORE), ChatColor.GREEN, 7, 7, Calendar.WEEK_OF_YEAR),
|
||||||
EVENT("Event", UtilText.splitLineToArray(C.cGray + "These super special missions will only show up every once in a while and come with a super special reward!", LineFormat.LORE), ChatColor.LIGHT_PURPLE, 10, 1, -1);
|
EVENT("Event", UtilText.splitLineToArray(C.cGray + "These super special missions will only show up every once in a while and come with a super special reward!", LineFormat.LORE), ChatColor.LIGHT_PURPLE, 10, 1, -1);
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
@ -35,6 +36,7 @@ import mineplex.core.common.util.UtilServer;
|
|||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.game.GameDisplay;
|
import mineplex.core.game.GameDisplay;
|
||||||
import mineplex.core.mission.commands.DebugMissionCommand;
|
import mineplex.core.mission.commands.DebugMissionCommand;
|
||||||
|
import mineplex.core.mission.commands.SetMissionsCommand;
|
||||||
import mineplex.core.mission.commands.ViewMissionsCommand;
|
import mineplex.core.mission.commands.ViewMissionsCommand;
|
||||||
import mineplex.core.mission.ui.MissionShop;
|
import mineplex.core.mission.ui.MissionShop;
|
||||||
import mineplex.core.newnpc.NPC;
|
import mineplex.core.newnpc.NPC;
|
||||||
@ -50,7 +52,7 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
public enum Perm implements Permission
|
public enum Perm implements Permission
|
||||||
{
|
{
|
||||||
VIEW_MISSION_COMMAND,
|
VIEW_MISSION_COMMAND,
|
||||||
START_MISSION_COMMAND,
|
SET_MISSIONS_COMMAND,
|
||||||
DEBUG_MISSION_COMMAND
|
DEBUG_MISSION_COMMAND
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,14 +99,21 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
private void generatePermissions()
|
private void generatePermissions()
|
||||||
{
|
{
|
||||||
PermissionGroup.PLAYER.setPermission(Perm.VIEW_MISSION_COMMAND, true, true);
|
PermissionGroup.PLAYER.setPermission(Perm.VIEW_MISSION_COMMAND, true, true);
|
||||||
PermissionGroup.ADMIN.setPermission(Perm.START_MISSION_COMMAND, true, true);
|
PermissionGroup.ADMIN.setPermission(Perm.SET_MISSIONS_COMMAND, true, true);
|
||||||
PermissionGroup.ADMIN.setPermission(Perm.DEBUG_MISSION_COMMAND, true, true);
|
PermissionGroup.ADMIN.setPermission(Perm.DEBUG_MISSION_COMMAND, true, true);
|
||||||
|
|
||||||
|
if (UtilServer.isTestServer())
|
||||||
|
{
|
||||||
|
PermissionGroup.QA.setPermission(Perm.SET_MISSIONS_COMMAND, true, true);
|
||||||
|
PermissionGroup.QA.setPermission(Perm.DEBUG_MISSION_COMMAND, true, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCommands()
|
public void addCommands()
|
||||||
{
|
{
|
||||||
addCommand(new ViewMissionsCommand(this));
|
addCommand(new ViewMissionsCommand(this));
|
||||||
|
addCommand(new SetMissionsCommand(this));
|
||||||
addCommand(new DebugMissionCommand(this));
|
addCommand(new DebugMissionCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +156,9 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
{
|
{
|
||||||
MissionClient client = Get(uuid);
|
MissionClient client = Get(uuid);
|
||||||
TimeZone utc = TimeZone.getTimeZone("UTC");
|
TimeZone utc = TimeZone.getTimeZone("UTC");
|
||||||
Calendar now = Calendar.getInstance(utc);
|
// Why UK? because we want Monday to be the first day of the week
|
||||||
|
Locale uk = Locale.UK;
|
||||||
|
Calendar now = Calendar.getInstance(utc, uk);
|
||||||
int nonEventMissions = 0;
|
int nonEventMissions = 0;
|
||||||
|
|
||||||
while (resultSet.next())
|
while (resultSet.next())
|
||||||
@ -179,10 +190,11 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
long startTime = resultSet.getLong("startTime");
|
long startTime = resultSet.getLong("startTime");
|
||||||
PlayerMission mission = new PlayerMission<>(context, MissionLength.values()[length], x, y, progress, false);
|
PlayerMission mission = new PlayerMission<>(context, MissionLength.values()[length], x, y, progress, false);
|
||||||
|
|
||||||
Calendar start = Calendar.getInstance(utc);
|
Calendar start = Calendar.getInstance(utc, uk);
|
||||||
start.setTimeInMillis(startTime);
|
start.setTimeInMillis(startTime);
|
||||||
int lengthField = mission.getLength().getCalendarField();
|
int lengthField = mission.getLength().getCalendarField();
|
||||||
|
|
||||||
|
System.out.println(mission.getName() + " - " + now.get(lengthField) + " " + start.get(lengthField));
|
||||||
if (lengthField != -1 && now.get(lengthField) != start.get(lengthField))
|
if (lengthField != -1 && now.get(lengthField) != start.get(lengthField))
|
||||||
{
|
{
|
||||||
runAsync(() -> _repository.clearMission(accountId, missionId));
|
runAsync(() -> _repository.clearMission(accountId, missionId));
|
||||||
@ -296,6 +308,31 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
|||||||
runAsync(_repository::bulkProcess);
|
runAsync(_repository::bulkProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMissions(Player player, Map<MissionLength, List<MissionContext<?>>> missions)
|
||||||
|
{
|
||||||
|
int accountId = ClientManager.getAccountId(player);
|
||||||
|
double rankBonus = getRankBonus(player);
|
||||||
|
MissionClient client = Get(player);
|
||||||
|
|
||||||
|
player.sendMessage(F.main(getName(), "Clearing old missions..."));
|
||||||
|
client.getMissions().forEach(mission -> runAsync(() -> _repository.clearMission(accountId, mission.getId())));
|
||||||
|
client.getMissions().clear();
|
||||||
|
|
||||||
|
missions.forEach((length, contexts) ->
|
||||||
|
{
|
||||||
|
contexts.forEach(context ->
|
||||||
|
{
|
||||||
|
player.sendMessage(F.main(getName(), "Starting " + F.name(context.getName()) + "..."));
|
||||||
|
PlayerMission<?> mission = length.createFromContext(context);
|
||||||
|
_repository.addQueryToQueue(MissionRepository.startMission(accountId, () ->
|
||||||
|
{
|
||||||
|
mission.createRewards(rankBonus);
|
||||||
|
client.startMission(mission);
|
||||||
|
}, mission));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void selectNewMissions(Player player)
|
private void selectNewMissions(Player player)
|
||||||
{
|
{
|
||||||
MissionClient client = Get(player);
|
MissionClient client = Get(player);
|
||||||
|
@ -160,6 +160,19 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
MissionContext.newBuilder(manager, 104)
|
||||||
|
.name("Leap Higher!")
|
||||||
|
.description("Leap or Double Jump %s times in game")
|
||||||
|
.games(GameDisplay.values())
|
||||||
|
.xRange(20, 40)
|
||||||
|
.tracker(GAME_LEAP)
|
||||||
|
.rewards(
|
||||||
|
new LevelExperienceReward(6),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.GEM, 3),
|
||||||
|
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 3)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Turf Wars 200-299
|
// Turf Wars 200-299
|
||||||
|
|
||||||
MissionContext.newBuilder(manager, 200)
|
MissionContext.newBuilder(manager, 200)
|
||||||
@ -229,19 +242,6 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.newBuilder(manager, 302)
|
|
||||||
.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
|
// Survival Games 400-499
|
||||||
|
|
||||||
MissionContext.<String>newBuilder(manager, 400)
|
MissionContext.<String>newBuilder(manager, 400)
|
||||||
@ -314,7 +314,7 @@ public class MissionPopulator
|
|||||||
|
|
||||||
MissionContext.<Material>newBuilder(manager, 405)
|
MissionContext.<Material>newBuilder(manager, 405)
|
||||||
.name("Iron Weaponsmith")
|
.name("Iron Weaponsmith")
|
||||||
.description("Craft %s gold swords")
|
.description("Craft %s iron swords")
|
||||||
.games(SurvivalGames, SurvivalGamesTeams)
|
.games(SurvivalGames, SurvivalGamesTeams)
|
||||||
.xRange(1, 10)
|
.xRange(1, 10)
|
||||||
.tracker(GAME_CRAFT_ITEM)
|
.tracker(GAME_CRAFT_ITEM)
|
||||||
@ -661,21 +661,7 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.<String>newBuilder(manager, 703)
|
MissionContext.newBuilder(manager, 703)
|
||||||
.name("They Stick The Landing!")
|
|
||||||
.description("Catch %s players with Spin Web")
|
|
||||||
.games(Smash, SmashTeams)
|
|
||||||
.xRange(1, 5)
|
|
||||||
.tracker(GAME_DAMAGE_REASON)
|
|
||||||
.trackerData("Spin Web")
|
|
||||||
.rewards(
|
|
||||||
new LevelExperienceReward(500),
|
|
||||||
new LevelCurrencyReward(GlobalCurrency.GEM, 250),
|
|
||||||
new LevelCurrencyReward(GlobalCurrency.TREASURE_SHARD, 250)
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
MissionContext.newBuilder(manager, 704)
|
|
||||||
.name("Balancing Trick")
|
.name("Balancing Trick")
|
||||||
.description("Be airborne for %s seconds")
|
.description("Be airborne for %s seconds")
|
||||||
.games(Smash, SmashTeams)
|
.games(Smash, SmashTeams)
|
||||||
@ -868,7 +854,7 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.newBuilder(manager, 1003)
|
MissionContext.newBuilder(manager, 1004)
|
||||||
.name("EXPLOSION")
|
.name("EXPLOSION")
|
||||||
.description("Pickup %s Throwable TNT")
|
.description("Pickup %s Throwable TNT")
|
||||||
.games(Skywars, SkywarsTeams)
|
.games(Skywars, SkywarsTeams)
|
||||||
@ -881,7 +867,7 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.newBuilder(manager, 1004)
|
MissionContext.newBuilder(manager, 1005)
|
||||||
.name("Megimin Approved")
|
.name("Megimin Approved")
|
||||||
.description("Throw %s Throwable TNT")
|
.description("Throw %s Throwable TNT")
|
||||||
.games(Skywars, SkywarsTeams)
|
.games(Skywars, SkywarsTeams)
|
||||||
@ -894,7 +880,7 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.newBuilder(manager, 1005)
|
MissionContext.newBuilder(manager, 1006)
|
||||||
.name("Destructor")
|
.name("Destructor")
|
||||||
.description("Break %s blocks")
|
.description("Break %s blocks")
|
||||||
.games(Skywars, SkywarsTeams)
|
.games(Skywars, SkywarsTeams)
|
||||||
@ -907,7 +893,7 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.newBuilder(manager, 1006)
|
MissionContext.newBuilder(manager, 1007)
|
||||||
.name("Skilled In The Craft")
|
.name("Skilled In The Craft")
|
||||||
.description("Craft %s items")
|
.description("Craft %s items")
|
||||||
.games(Skywars, SkywarsTeams)
|
.games(Skywars, SkywarsTeams)
|
||||||
@ -920,7 +906,7 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.newBuilder(manager, 1007)
|
MissionContext.newBuilder(manager, 1008)
|
||||||
.name("Ella Was Enchanted")
|
.name("Ella Was Enchanted")
|
||||||
.description("Enchant %s items")
|
.description("Enchant %s items")
|
||||||
.games(Skywars, SkywarsTeams)
|
.games(Skywars, SkywarsTeams)
|
||||||
@ -933,7 +919,7 @@ public class MissionPopulator
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MissionContext.newBuilder(manager, 1008)
|
MissionContext.newBuilder(manager, 1009)
|
||||||
.name("Who Needs A Hammer?")
|
.name("Who Needs A Hammer?")
|
||||||
.description("Smelt %s items in a furnace")
|
.description("Smelt %s items in a furnace")
|
||||||
.games(Skywars, SkywarsTeams)
|
.games(Skywars, SkywarsTeams)
|
||||||
@ -1034,7 +1020,7 @@ public class MissionPopulator
|
|||||||
|
|
||||||
MissionContext.newBuilder(manager, 1301)
|
MissionContext.newBuilder(manager, 1301)
|
||||||
.name("Da Bomb")
|
.name("Da Bomb")
|
||||||
.description("Rate %s other players")
|
.description("Rate %s other builds")
|
||||||
.games(Build)
|
.games(Build)
|
||||||
.xRange(4, 20)
|
.xRange(4, 20)
|
||||||
.tracker(BUILD_RATE)
|
.tracker(BUILD_RATE)
|
||||||
|
@ -30,13 +30,13 @@ public enum MissionTrackerType
|
|||||||
GAME_FURNACE_SMELT,
|
GAME_FURNACE_SMELT,
|
||||||
GAME_GENERATOR_COLLECT,
|
GAME_GENERATOR_COLLECT,
|
||||||
GAME_THROW_TNT,
|
GAME_THROW_TNT,
|
||||||
|
GAME_LEAP,
|
||||||
|
|
||||||
TURF_WARS_ON_ENEMY,
|
TURF_WARS_ON_ENEMY,
|
||||||
TURF_WARS_BOW_BREAK,
|
TURF_WARS_BOW_BREAK,
|
||||||
|
|
||||||
DMT_GUESS,
|
DMT_GUESS,
|
||||||
DMT_GUESS_ALL,
|
DMT_GUESS_ALL,
|
||||||
DMT_GUESS_STREAK,
|
|
||||||
|
|
||||||
SG_BOW_HORSE_KILL,
|
SG_BOW_HORSE_KILL,
|
||||||
SG_SUPPLY_DROP_OPEN,
|
SG_SUPPLY_DROP_OPEN,
|
||||||
|
@ -28,7 +28,7 @@ public class PlayerMission<T> implements Mission<T>
|
|||||||
_x = fromContext && x > 1 ? x * length.getxScale() : x;
|
_x = fromContext && x > 1 ? x * length.getxScale() : x;
|
||||||
_y = y;
|
_y = y;
|
||||||
|
|
||||||
if (x == 1)
|
if (x == 1 && y > 0)
|
||||||
{
|
{
|
||||||
_description = String.format(context.getDescription(), y);
|
_description = String.format(context.getDescription(), y);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
package mineplex.core.mission.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.mission.MissionContext;
|
||||||
|
import mineplex.core.mission.MissionLength;
|
||||||
|
import mineplex.core.mission.MissionManager;
|
||||||
|
import mineplex.core.mission.MissionManager.Perm;
|
||||||
|
|
||||||
|
public class SetMissionsCommand extends CommandBase<MissionManager>
|
||||||
|
{
|
||||||
|
|
||||||
|
public SetMissionsCommand(MissionManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Perm.SET_MISSIONS_COMMAND, "setmissions");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(Player caller, String[] args)
|
||||||
|
{
|
||||||
|
if (args.length < 2)
|
||||||
|
{
|
||||||
|
caller.sendMessage(F.main(Plugin.getName(), "/" + _aliasUsed + " <daily> <weekly>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<MissionLength, List<MissionContext<?>>> missions = new HashMap<>();
|
||||||
|
|
||||||
|
missions.put(MissionLength.DAY, getFromArg(args[0], caller));
|
||||||
|
missions.put(MissionLength.WEEK, getFromArg(args[1], caller));
|
||||||
|
|
||||||
|
Plugin.setMissions(caller, missions);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<MissionContext<?>> getFromArg(String arg, Player caller)
|
||||||
|
{
|
||||||
|
String[] split = arg.split(",");
|
||||||
|
List<MissionContext<?>> missions = new ArrayList<>(split.length);
|
||||||
|
|
||||||
|
for (String idString : split)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int id = Integer.parseInt(idString);
|
||||||
|
MissionContext<?> context = Plugin.getMission(id);
|
||||||
|
|
||||||
|
if (context == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
missions.add(context);
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ex)
|
||||||
|
{
|
||||||
|
caller.sendMessage(F.main(Plugin.getName(), F.elem(idString) + " is not a number."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return missions;
|
||||||
|
}
|
||||||
|
}
|
@ -56,6 +56,11 @@ public class MissionMainPage extends ShopPageBase<MissionManager, MissionShop>
|
|||||||
|
|
||||||
for (PlayerMission<?> mission : missions)
|
for (PlayerMission<?> mission : missions)
|
||||||
{
|
{
|
||||||
|
if (mission.getRewards() == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int row = mission.getLength().ordinal();
|
int row = mission.getLength().ordinal();
|
||||||
int progress = mission.getCurrentProgress();
|
int progress = mission.getCurrentProgress();
|
||||||
int requiredProgress = mission.getRequiredProgress();
|
int requiredProgress = mission.getRequiredProgress();
|
||||||
|
@ -25,7 +25,7 @@ public class KillLastTracker extends GameMissionTracker<Game>
|
|||||||
Player player = event.getEntity();
|
Player player = event.getEntity();
|
||||||
Player killer = player.getKiller();
|
Player killer = player.getKiller();
|
||||||
|
|
||||||
if (killer == null || killer.equals(player))
|
if (player.equals(killer))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -37,6 +37,6 @@ public class KillLastTracker extends GameMissionTracker<Game>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_manager.incrementProgress(player, 1, _trackerType, getGameType(), null);
|
_manager.incrementProgress(killer, 1, _trackerType, getGameType(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,9 +376,6 @@ public class Domination extends TeamGame
|
|||||||
AddGems(player, 10, "Participation", false, false);
|
AddGems(player, 10, "Participation", false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean red = team.GetColor() == ChatColor.RED;
|
|
||||||
team.GetPlayers(false).forEach(player -> getArcadeManager().getMissionsManager().incrementProgress(player, red ? _redScore : _blueScore, MissionTrackerType.DOM_POINT, GetType().getDisplay(), null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
endElo();
|
endElo();
|
||||||
@ -500,4 +497,19 @@ public class Domination extends TeamGame
|
|||||||
{
|
{
|
||||||
event.getPlayers().forEach(player -> getArcadeManager().getMissionsManager().incrementProgress(player, 1, MissionTrackerType.GAME_CAPTURE_POINT, GetType().getDisplay(), null));
|
event.getPlayers().forEach(player -> getArcadeManager().getMissionsManager().incrementProgress(player, 1, MissionTrackerType.GAME_CAPTURE_POINT, GetType().getDisplay(), null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void end(GameStateChangeEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetState() != GameState.End)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetTeamList().forEach(team ->
|
||||||
|
{
|
||||||
|
boolean red = team.GetColor() == ChatColor.RED;
|
||||||
|
team.GetPlayers(false).forEach(player -> getArcadeManager().getMissionsManager().incrementProgress(player, red ? _redScore : _blueScore, MissionTrackerType.DOM_POINT, GetType().getDisplay(), null));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
@ -54,7 +54,6 @@ 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;
|
||||||
@ -258,8 +257,6 @@ 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)
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
@ -39,7 +39,7 @@ public class Last2Tracker extends GameMissionTracker<Game>
|
|||||||
|
|
||||||
for (Player player : _game.GetPlayers(true))
|
for (Player player : _game.GetPlayers(true))
|
||||||
{
|
{
|
||||||
_manager.incrementProgress(player, 1, MissionTrackerType.MICRO_LAST_TWO, getGameType(), null);
|
_manager.incrementProgress(player, 1, _trackerType, getGameType(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package nautilus.game.arcade.game.games.survivalgames.misison;
|
|||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
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.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
|
||||||
import mineplex.core.mission.MissionTrackerType;
|
import mineplex.core.mission.MissionTrackerType;
|
||||||
@ -19,7 +18,7 @@ public class BowHorseKillTracker extends GameMissionTracker<Game>
|
|||||||
super(MissionTrackerType.SG_BOW_HORSE_KILL, game);
|
super(MissionTrackerType.SG_BOW_HORSE_KILL, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler
|
||||||
public void playerDeath(PlayerDeathEvent event)
|
public void playerDeath(PlayerDeathEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getEntity();
|
Player player = event.getEntity();
|
||||||
@ -30,6 +29,6 @@ public class BowHorseKillTracker extends GameMissionTracker<Game>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_manager.incrementProgress(player, 1, _trackerType, getGameType(), null);
|
_manager.incrementProgress(killer, 1, _trackerType, getGameType(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,6 @@ public class KillMidAirMissionTracker extends GameMissionTracker<Game>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_manager.incrementProgress(player, 1, _trackerType, getGameType(), null);
|
_manager.incrementProgress(killer, 1, _trackerType, getGameType(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,6 +435,7 @@ public abstract class LobbyManager implements Listener
|
|||||||
{
|
{
|
||||||
writeGameLine("Voting for the next", 0, Material.STAINED_CLAY.getId(), (byte) 14);
|
writeGameLine("Voting for the next", 0, Material.STAINED_CLAY.getId(), (byte) 14);
|
||||||
writeGameLine(vote.getName(), 1, Material.STAINED_CLAY.getId(), (byte) 4);
|
writeGameLine(vote.getName(), 1, Material.STAINED_CLAY.getId(), (byte) 4);
|
||||||
|
writeGameLine("", 2, Material.AIR.getId(), (byte) 0);
|
||||||
|
|
||||||
displayVotingTime(vote);
|
displayVotingTime(vote);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user