use of gg.projecteden.nexus.features.events.y2020.pugmas20.models.AdventChest in project Nexus by ProjectEdenGG.
the class AdventChests method onAdventChestOpen.
// Advent Methods & Listeners
@EventHandler
public void onAdventChestOpen(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND)
return;
if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK))
return;
if (isNullOrAir(event.getClickedBlock()))
return;
Player player = event.getPlayer();
if (!Pugmas20.isAtPugmas(player))
return;
Block block = event.getClickedBlock();
if (!block.getType().equals(Material.CHEST))
return;
AdventChest adventChest = getAdventChest(block.getLocation());
if (adventChest == null)
return;
event.setCancelled(true);
if (!Quests.hasRoomFor(player, 1)) {
PlayerUtils.send(player, Quests.fullInvError_open);
return;
}
Pugmas20UserService service = new Pugmas20UserService();
Pugmas20User user = service.get(player);
int chestDay = adventChest.getDay();
LocalDate now = LocalDate.now();
int today = LocalDate.now().getDayOfMonth();
if (isBeforePugmas(now))
return;
if (isPastPugmas(now))
return;
boolean waypoint = !user.getLocatedDays().contains(chestDay);
user.getLocatedDays().add(chestDay);
service.save(user);
boolean openChest = false;
String reason = "";
if (user.getFoundDays().contains(chestDay))
reason = alreadyFound;
else {
if (isSecondChance(now))
if (chestDay != 25 || user.getFoundDays().size() == 24)
openChest = true;
else
reason = openPrevious;
else if (chestDay == today)
openChest = true;
else {
reason = wrongDay + " (" + AdventChests.getAdventChest(today).getDistrict().getName() + " District)";
}
}
if (!openChest) {
reason = reason.replaceAll("<day>", String.valueOf(today));
user.sendMessage(reason);
if (waypoint)
user.sendMessage(PREFIX + "Chest &e#" + chestDay + " &3saved as a waypoint");
return;
}
user.getFoundDays().add(chestDay);
service.save(user);
giveAdventHead(player, chestDay);
}
use of gg.projecteden.nexus.features.events.y2020.pugmas20.models.AdventChest in project Nexus by ProjectEdenGG.
the class AdventChests method loadlocationations.
private void loadlocationations() {
// @formatter:off
// Plaza
adventChestList.add(new AdventChest(1, location(913, 50, 411)));
// Harbor
adventChestList.add(new AdventChest(2, location(900, 45, 580)));
// Frozen
adventChestList.add(new AdventChest(3, location(997, 50, 497)));
// Plaza
adventChestList.add(new AdventChest(4, location(966, 51, 400)));
// Gardens
adventChestList.add(new AdventChest(5, location(987, 74, 346)));
// Plaza
adventChestList.add(new AdventChest(6, location(860, 50, 441)));
// Frozen
adventChestList.add(new AdventChest(7, location(1001, 58, 534)));
// Harbor
adventChestList.add(new AdventChest(8, location(847, 54, 583)));
// Plaza
adventChestList.add(new AdventChest(9, location(986, 61, 415)));
// Harbor
adventChestList.add(new AdventChest(10, location(840, 60, 606)));
// Frozen
adventChestList.add(new AdventChest(11, location(1051, 49, 569)));
// Harbor
adventChestList.add(new AdventChest(12, location(839, 52, 542)));
// Plaza
adventChestList.add(new AdventChest(13, location(898, 58, 352)));
// Gardens
adventChestList.add(new AdventChest(14, location(1062, 60, 424)));
// Plaza
adventChestList.add(new AdventChest(15, location(964, 52, 441)));
// Frozen
adventChestList.add(new AdventChest(16, location(1009, 47, 567)));
// Harbor
adventChestList.add(new AdventChest(17, location(828, 51, 515)));
// Plaza
adventChestList.add(new AdventChest(18, location(862, 58, 457)));
// Harbor
adventChestList.add(new AdventChest(19, location(812, 52, 538)));
// Plaza
adventChestList.add(new AdventChest(20, location(849, 55, 384)));
// Harbor
adventChestList.add(new AdventChest(21, location(809, 68, 565)));
// Gardens
adventChestList.add(new AdventChest(22, location(1094, 45, 386)));
// Plaza
adventChestList.add(new AdventChest(23, location(866, 57, 395)));
// Frozen
adventChestList.add(new AdventChest(24, location(1056, 43, 531)));
// Unknown
adventChestList.add(new AdventChest(25, location(886, 95, 313)));
// @formatter:on
}
use of gg.projecteden.nexus.features.events.y2020.pugmas20.models.AdventChest in project Nexus by ProjectEdenGG.
the class Pugmas20Command method waypoint.
@Path("waypoint <day>")
@Description("Get directions to a chest you have already found")
void waypoint(int day) {
if (!pugmasUser.getLocatedDays().contains(day))
error("You have not located that chest yet");
AdventChest adventChest = AdventChests.getAdventChest(day);
if (adventChest == null)
error("Advent chest is null");
showWaypoint(adventChest, player());
}
use of gg.projecteden.nexus.features.events.y2020.pugmas20.models.AdventChest in project Nexus by ProjectEdenGG.
the class Pugmas20Command method progress.
@Path("progress [player]")
@Description("View your event progress")
void progress(@Arg(value = "self", permission = Group.STAFF) Pugmas20User user) {
LocalDate now = LocalDate.now();
if (isBeforePugmas(now))
now = now.withYear(2020).withMonth(12).withDayOfMonth(1);
if (isPastPugmas(now))
error("Next year!");
if (isSecondChance(now))
now = now.withYear(2020).withMonth(12).withDayOfMonth(25);
int day = now.getDayOfMonth();
line(2);
send(PREFIX + "Event progress (Day &e#" + day + "&3):");
line();
String advent;
AdventChest adventChest = AdventChests.getAdventChest(day);
if (user.getFoundDays().size() == 25)
advent = "&a☑ &3Complete";
else if (user.getFoundDays().contains(day))
advent = "&a☑ &3Found today's chest";
else if (day == 25)
if (user.getFoundDays().size() != 24)
advent = "&7☐ &3Find all chests before #25";
else
advent = "&7☐ &3Find the last chest";
else
advent = "&7☐ &3Find today's chest (&e#" + day + " &3in the &e" + adventChest.getDistrict().getName() + " District&3)";
send("&6&lAdvent Chests");
send(json("&f " + advent + " &7- Click for info").hover("Click to open the Advent menu").command("/pugmas advent"));
line();
send("&6&lQuests");
for (Pugmas20QuestStageHelper quest : Pugmas20QuestStageHelper.values()) {
QuestStage stage = quest.getter().apply(user);
String instructions = Pugmas20Quest.valueOf(quest.name()).getInstructions(user, stage);
JsonBuilder json = json();
if (quest == Pugmas20QuestStageHelper.THE_MINES && stage == QuestStage.STARTED) {
List<String> tradesLeft = getIngotTradesLeft(user);
if (tradesLeft.isEmpty()) {
json.next("&f &a☑ &3" + camelCase(quest) + " &7- &aCompleted daily quest &7- Come back tomorrow for more");
} else {
json.next("&f &7☐ &3" + camelCase(quest) + " &7- &eIn progress &7- " + instructions);
tradesLeft.add(0, "&6Today's available trades:");
json.next(" &7&o(Hover for info)").hover(String.join("\n", tradesLeft));
}
} else {
if (stage == QuestStage.COMPLETE) {
json.next("&f &a☑ &3" + camelCase(quest) + " &7- &aComplete");
} else if (stage == QuestStage.NOT_STARTED || stage == QuestStage.INELIGIBLE) {
json.next("&f &7☐ &3" + camelCase(quest) + " &7- &cNot started" + (instructions == null ? "" : " &7- " + instructions));
} else {
json.next("&f &7☐ &3" + camelCase(quest) + " &7- &eIn progress &7- ");
if (instructions == null)
json.next("&c???").hover(camelCase(stage));
else
json.next("&7" + instructions);
}
if (quest == Pugmas20QuestStageHelper.TOY_TESTING && stage == QuestStage.STARTED) {
List<String> toysLeft = getUnplayedToysList(user);
toysLeft.add(0, "&6Toys left to test:");
json.next(" &7&o(Hover for info)").hover(String.join("\n&f", toysLeft));
}
if (quest == Pugmas20QuestStageHelper.ORNAMENT_VENDOR && stage != QuestStage.NOT_STARTED) {
List<String> lore = getOrnamentTradesLeft(user);
if (!lore.isEmpty()) {
lore.add(0, "&6Available ornament trades:");
if (stage == QuestStage.COMPLETE)
json.next(" &7- More trades available");
lore.add("&f");
lore.add("&fYou get to keep any extra ornaments");
json.next(" &7&o(Hover for info)").hover(String.join("\n&f", lore));
}
}
}
send(json);
}
line();
if (day < 25) {
send("&3Next day begins in &e" + Timespan.of(now.plusDays(1)).format());
line();
}
}
Aggregations