use of gg.projecteden.nexus.models.nerd.Nerd in project Nexus by ProjectEdenGG.
the class BirthdaysCommand method birthday.
@Path("[amount]")
void birthday(@Arg("10") int amount) {
List<Nerd> nerds = service.getNerdsWithBirthdays();
nerds.sort((nerd1, nerd2) -> {
LocalDate now = LocalDate.now();
return (int) ChronoUnit.DAYS.between(now, getNextBirthday(nerd1)) - (int) ChronoUnit.DAYS.between(now, getNextBirthday(nerd2));
});
line();
send("&3Upcoming birthdays:");
line();
for (int i = 0; i < Math.min(amount, nerds.size()); i++) {
if (LocalDate.now().getDayOfYear() == getNextBirthday(nerds.get(i)).getDayOfYear())
send("&3" + (i + 1) + " &e" + Nickname.of(nerds.get(i)) + " &7- Today");
else {
long until = ChronoUnit.DAYS.between(LocalDate.now(), getNextBirthday(nerds.get(i)));
send(json().next("&3" + (i + 1) + " &e" + Nickname.of(nerds.get(i)) + " &7- " + until + plural(" day", until)).hover(nerds.get(i).getBirthday().format(DateTimeFormatter.ofPattern("MM/dd/yyyy"))));
}
}
}
use of gg.projecteden.nexus.models.nerd.Nerd in project Nexus by ProjectEdenGG.
the class OnlineCommand method help.
@Path
@Override
public void help() {
long vanished = OnlinePlayers.getAll().stream().filter(PlayerUtils::isVanished).count();
long online = OnlinePlayers.getAll().size() - vanished;
boolean canSeeVanished = !isPlayer() || player().hasPermission("pv.see");
String counts = online + ((canSeeVanished && vanished > 0) ? " &3+ &e" + vanished : "");
line();
send("&3There are &e" + counts + " &3out of maximum &e" + Bukkit.getMaxPlayers() + " &3players online");
Rank.REVERSED.forEach(rank -> {
List<Nerd> nerds = rank.getOnlineNerds().stream().filter(this::canSee).collect(Collectors.toList());
if (nerds.size() == 0)
return;
JsonBuilder builder = new JsonBuilder(rank.getColoredName() + "s&f: ");
nerds.forEach(nerd -> getNameWithPresence(nerd, builder));
send(builder);
});
line();
send("&e&lClick &3on a player's name to open the &eQuickAction &3menu");
line();
}
use of gg.projecteden.nexus.models.nerd.Nerd in project Nexus by ProjectEdenGG.
the class TeleportHereCommand method onJoin.
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Nerd nerd = Nerd.of(event.getPlayer());
if (nerd.getTeleportOnLogin() == null)
return;
// No /back
event.getPlayer().teleportAsync(nerd.getTeleportOnLogin());
nerd.setTeleportOnLogin(null);
new NerdService().save(nerd);
}
use of gg.projecteden.nexus.models.nerd.Nerd in project Nexus by ProjectEdenGG.
the class UUIDSearchCommand method search.
@Path("<uuid> [amount]")
void search(String search, @Arg("25") int limit) {
if (search.length() < 4)
error("Please be more specific!");
// List<Nerd> nerds = service.find(search, "uuid").stream().limit(limit).collect(Collectors.toList());
List<Nerd> nerds = new ArrayList<>();
if (nerds.size() == 0)
error("No matches found for &e" + search);
send("&3Matches for '&e" + search + "&3' (&e" + nerds.size() + "&3):");
for (Nerd nerd : nerds) send(json("&e" + nerd.getUuid() + " (" + nerd.getName() + ")").insert(nerd.getUuid().toString()));
send("&3Shift+Click on a name to insert it into your chat");
}
use of gg.projecteden.nexus.models.nerd.Nerd in project Nexus by ProjectEdenGG.
the class TicketFeature method sendMessage.
private static void sendMessage(Ticket ticket, @Nullable Player staff, String staffName, TicketAction action) {
String staffNick = staffName;
if (staff != null)
staffNick = Nickname.of(staff);
for (Nerd _staff : Rank.getOnlineStaff()) {
if (staff == null || !_staff.getUniqueId().equals(staff.getUniqueId()))
action.sendMessage(_staff.getUniqueId(), ticket, staffNick);
}
if (isUUID0(ticket.getUuid()))
return;
if (Rank.of(ticket.getUuid()).isStaff())
return;
if (!PlayerUtils.canSee(ticket.getPlayer(), staff)) {
if (action.equals(TicketAction.TELEPORT))
return;
staffNick = "A staff member";
}
action.sendMessage(ticket.getUuid(), ticket, staffNick);
}
Aggregations