use of gg.projecteden.nexus.framework.commands.models.annotations.Path in project Nexus by ProjectEdenGG.
the class WhoIsCommand method run.
@Async
@Path("<player>")
void run(Nerd nerd) {
line();
line();
send("&3Who the fuck is &6&l" + nerd.getNickname() + "&3?");
HoursService hoursService = new HoursService();
GeoIPService geoipService = new GeoIPService();
Punishments punishments = Punishments.of(nerd);
boolean history = punishments.hasHistory();
JsonBuilder alts = punishments.getAltsMessage();
Hours hours = hoursService.get(nerd);
String rank = nerd.getRank().getColoredName();
String firstJoin = shortDateTimeFormat(nerd.getFirstJoin());
String lastJoinQuitLabel = null;
String lastJoinQuitDate = null;
String lastJoinQuitDiff = null;
if (nerd.isOnline()) {
if (nerd.getLastQuit() != null) {
lastJoinQuitLabel = "Last Quit";
lastJoinQuitDate = shortDateTimeFormat(nerd.getLastQuit());
lastJoinQuitDiff = Timespan.of(nerd.getLastQuit()).format();
}
} else {
lastJoinQuitLabel = "Last Join";
lastJoinQuitDate = shortDateTimeFormat(nerd.getLastQuit());
lastJoinQuitDiff = Timespan.of(nerd.getLastJoin()).format();
}
Set<String> pastNames = nerd.getPastNames();
Godmode godmode = new GodmodeService().get(nerd);
JsonBuilder json = json();
if (nerd.hasNickname())
json.newline().next("&3Real Name: &e" + nerd.getName()).group();
json.newline().next("&3Rank: &e" + rank).group();
json.newline().next("&3First Join: &e" + firstJoin).group();
if (lastJoinQuitDate != null)
json.newline().next("&3" + lastJoinQuitLabel + ": &e" + lastJoinQuitDiff + " ago").hover("&e" + lastJoinQuitDate).group();
if (hours.getTotal() > 0)
json.newline().next("&3Hours: &e" + TimespanBuilder.ofSeconds(hours.getTotal()).noneDisplay(true).format()).group();
if (history)
json.newline().next("&3History: &e" + punishments.getPunishments().size()).command("/history " + nerd.getName()).hover("&eClick to view history").group();
if (alts != null)
json.newline().next("&3Alts: &e").next(alts).group();
if (!pastNames.isEmpty())
json.newline().next("&3Past Names: &e" + String.join("&3, &e", pastNames)).group();
try {
GeoIP geoip = geoipService.get(nerd);
if (!isNullOrEmpty(geoip.getIp()))
json.newline().next("&3GeoIP: &e" + geoip.getFriendlyLocationString()).hover("&e" + geoip.getIp()).suggest(geoip.getIp()).group();
} catch (InvalidInputException ex) {
json.newline().next("&3GeoIP: &c" + ex.getMessage()).group();
}
try {
json.newline().next("&3Location: &e" + getLocationString(nerd.getLocation())).hover("&eClick to TP").command("/tp " + nerd.getName()).group();
} catch (InvalidInputException ex) {
json.newline().next("&3Location: &c" + ex.getMessage()).group();
}
json.newline().next("&3Balances:");
for (ShopGroup shopGroup : ShopGroup.values()) if (new BankerService().getBalance(nerd, shopGroup) != 500)
json.newline().next(" &3" + camelCase(shopGroup) + ": &e" + new BankerService().getBalanceFormatted(nerd, shopGroup)).group();
if (nerd.isOnline()) {
Player player = nerd.getOnlinePlayer();
json.newline().next("&3Minecraft Version: &e" + PlayerUtils.getPlayerVersion(player));
json.newline().next("&3Client Brand Name: &e" + player.getClientBrandName()).group();
final LocalResourcePackUser packUser = new LocalResourcePackUserService().get(nerd);
json.newline().next("&3Saturn: &e" + packUser.getSaturnStatus()).group();
json.newline().next("&3Titan: &e" + packUser.getTitanStatus()).group();
json.newline().next("&3Gamemode: &e" + camelCase(player.getGameMode())).group();
json.newline().next("&3God mode: &e" + godmode.isEnabled()).group();
json.newline().next("&3Fly mode: &e" + player.getAllowFlight() + " &3(" + (player.isFlying() ? "flying" : "not flying") + ")").group();
final ChatVisibility chatVisibility = player.getClientOption(ClientOption.CHAT_VISIBILITY);
if (chatVisibility != ChatVisibility.FULL)
json.newline().next("&3Chat Visibility: &e" + camelCase(chatVisibility));
}
json.newline().next("&3OP: &e" + nerd.getOfflinePlayer().isOp()).group();
send(json);
}
use of gg.projecteden.nexus.framework.commands.models.annotations.Path in project Nexus by ProjectEdenGG.
the class WorldEditUtilsCommand method clipboard.
@Path("clipboard [--build] [--async] [--entities]")
void clipboard(@Switch @Arg("false") boolean build, @Switch @Arg("false") boolean async, @Switch @Arg("false") boolean entities) {
final WorldEditUtils utils = new WorldEditUtils(world());
List<CompletableFuture<Void>> futures = new ArrayList<>();
Runnable task = () -> {
final Paster paster = utils.paster("Testing clipboard").clipboard(player()).at(location()).entities(entities);
if (build) {
send("Building " + (async ? "async" : "sync"));
for (int i = 0; i < 5; i++) futures.add(paster.build());
} else {
send("Pasting " + (async ? "async" : "sync"));
for (int i = 0; i < 5; i++) futures.add(paster.pasteAsync());
}
CompletableFutures.allOf(futures).thenRun(() -> send("done"));
};
if (async)
Tasks.async(task);
else
task.run();
}
use of gg.projecteden.nexus.framework.commands.models.annotations.Path in project Nexus by ProjectEdenGG.
the class WorldEditUtilsCommand method rotate.
@Path("rotate [y] [x] [z]")
void rotate(int y, int x, int z) {
final WorldEditUtils worldedit = new WorldEditUtils(player());
worldedit.paster("Testing rotate").clipboard(worldedit.getPlayerSelection(player())).at(location()).transform(new AffineTransform().rotateY(y).rotateX(x).rotateZ(z)).pasteAsync();
}
use of gg.projecteden.nexus.framework.commands.models.annotations.Path in project Nexus by ProjectEdenGG.
the class SoundMenuCommand method playSound.
@Path("play <sound>")
public void playSound(String string) {
Location loc = location();
float pitch = (float) getPitchDouble(player());
Sound sound = getSound(string);
if (sound == null)
error("Couldn't find sound: " + string);
if (playToOthers.contains(uuid()))
loc.getWorld().playSound(loc, sound, 1F, pitch);
else
player().playSound(loc, sound, 1F, pitch);
bookMenu(pageMap.get(uuid()));
}
use of gg.projecteden.nexus.framework.commands.models.annotations.Path in project Nexus by ProjectEdenGG.
the class StripMetaCommand method menu.
@Path
void menu() {
Inventory inv = Bukkit.createInventory(null, 54, TITLE);
player().openInventory(inv);
}
Aggregations