use of gg.projecteden.nexus.utils.JsonBuilder in project Nexus by ProjectEdenGG.
the class BoopCommand method run.
public void run(Player booper, Player booped, String message, boolean anonymous) {
if (message == null)
message = "";
if (isSelf(booped))
error("You cannot boop yourself!");
if (MuteMenuUser.hasMuted(booper, MuteMenuItem.BOOPS))
error("You have boops disabled!");
if (MuteMenuUser.hasMuted(booped, MuteMenuItem.BOOPS))
error(booped.getName() + " has boops disabled!");
if (Minigames.isMinigameWorld(booper.getWorld()))
error("You cannot boop in minigames!");
String boopedName = Nickname.of(booped);
if (Minigames.isMinigameWorld(booped.getWorld()))
error("You cannot boop " + boopedName + ", they are in minigames");
String toBooper = PREFIX;
String toBooped = PREFIX;
if (!message.equalsIgnoreCase(""))
message = " &3and said &e" + message;
if (anonymous) {
toBooper += "&3You anonymously booped &e" + boopedName + message;
toBooped += "&eSomebody &3booped you" + message;
} else {
toBooper += "&3You booped &e" + boopedName + message;
toBooped += "&e" + nickname() + " &3booped you" + message;
}
send(toBooper);
JsonBuilder json = new JsonBuilder(toBooped);
if (!anonymous)
json.next("&3. &eClick to boop back").suggest("/boop " + Nickname.of(booper) + " ");
booped.sendMessage(booper, json);
booped.playSound(booped.getLocation(), Sound.BLOCK_NOTE_BLOCK_XYLOPHONE, 10.0F, 0.1F);
}
use of gg.projecteden.nexus.utils.JsonBuilder 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.utils.JsonBuilder in project Nexus by ProjectEdenGG.
the class RulesCommand method search.
private List<JsonBuilder> search(RulesType rulesType, String filter) {
List<JsonBuilder> results = new ArrayList<>();
for (RulesSection page : rulesType.getPages()) for (JsonBuilder message : page.getRules()) if (message.toString().toLowerCase().contains(filter.toLowerCase()))
results.add(message);
if (results.isEmpty())
return new ArrayList<>();
return new ArrayList<>() {
{
add(json("&3[+] &e" + camelCase(rulesType) + " Rules").command("/rules " + rulesType.name().toLowerCase()));
add(json(" "));
addAll(results);
add(json(" "));
}
};
}
use of gg.projecteden.nexus.utils.JsonBuilder in project Nexus by ProjectEdenGG.
the class Pugmas20Command method treeCounts.
@Permission(Group.ADMIN)
@Path("tree counts")
void treeCounts() {
int total = 0;
JsonBuilder json = json(PREFIX + "Pugmas tree counts:");
for (PugmasTreeType treeType : PugmasTreeType.values()) {
Set<Integer> ids = treeType.getPasters().keySet();
if (ids.size() == 0)
continue;
String collect = ids.stream().map(String::valueOf).collect(Collectors.joining(", "));
json.newline().next("&e " + camelCase(treeType) + " &7- " + ids.size() + " &3[" + collect + "]");
total += ids.size();
}
if (total == 0)
error("No pugmas trees found");
send(json.newline().next("&3Total: &e" + total));
}
use of gg.projecteden.nexus.utils.JsonBuilder in project Nexus by ProjectEdenGG.
the class AntiXray method checkLogs.
private void checkLogs(Player player, Material ore) {
UUID uuid = player.getUniqueId();
List<XRayLog> logs = XRayLogs.get(uuid);
LocalDateTime now = LocalDateTime.now();
int count = 0;
for (XRayLog log : new ArrayList<>(logs)) {
if (log.getTimestamp().isAfter(now.minusMinutes(minuteThreshold)))
++count;
if (count > countMap.get(ore)) {
new WarpsService().edit0(warps -> warps.add(new Warp(player.getName(), WarpType.XRAY, player.getLocation())));
logs.clear();
String name = player.getName();
final JsonBuilder message = new JsonBuilder("&7&l[&cRadar&7&l] &a" + name + "&f is possibly xraying. ").next("&e[Click to Teleport]").command("mcmd vanish on ;; xraywarp " + name).hover("This will automatically vanish you");
Broadcast.staffIngame().message(message).send();
Broadcast.staffDiscord().prefix("Radar").message(name + " is possibly xraying. `/xraywarp " + name + "`").send();
break;
}
}
}
Aggregations