use of gg.projecteden.nexus.features.commands.AgeCommand.ServerAge in project Nexus by ProjectEdenGG.
the class Koda method routine.
private static void routine(ChatEvent event, String id) {
switch(id) {
case "mgn":
NextMGN mgn = new NextMGN();
if (mgn.isNow())
respond(event, "Minigame night is happening right now! Join with /gl");
else
respond(event, "The next Minigame Night will be hosted on " + mgn.getDateFormatted() + " at " + mgn.getTimeFormatted() + ". That is in " + mgn.getUntil());
break;
case "canihaveop":
if (event.getChatter() != null && event.getChatter().isOnline()) {
Player player = event.getChatter().getOnlinePlayer();
double health = player.getHealth();
player.setHealth(20);
player.getWorld().strikeLightningEffect(player.getLocation());
player.damage(8);
Tasks.wait(10, () -> {
player.setHealth(20);
player.getWorld().strikeLightningEffect(player.getLocation());
player.damage(8);
Tasks.wait(10, () -> {
respond(event, "Does that answer your question?");
player.setHealth(health);
});
});
}
break;
case "canibestaff":
if (event.getChatter() != null && event.getChatter().isOnline()) {
Player player = event.getChatter().getOnlinePlayer();
if (Rank.of(player) == Rank.GUEST) {
String command = "staff";
if (event.getMessage().contains("mod"))
command = "moderator";
if (event.getMessage().contains(" op"))
command = "operator";
if (event.getMessage().contains("admin"))
command = "admin";
if (event.getMessage().contains("builder"))
command = "builder";
if ("staff".equals(command)) {
respond(event, "Sorry [player], but you don't meet the requirements for staff. Type /moderator for more info about what's required.");
} else {
respond(event, "Sorry [player], but you don't meet the requirements for " + command + ". Type /" + command + " for more info about what's required.");
}
}
}
break;
case "serverage":
ServerAge serverAge = new ServerAge();
String days = ServerAge.format(serverAge.getDays());
String years = ServerAge.format(serverAge.getYears());
String dogYears = ServerAge.format(serverAge.getDogYears());
respond(event, "The server is " + days + " days old! That's " + years + " years, or " + dogYears + " dog years!");
break;
case "useless":
if ("GriffinCodes".equals(event.getOrigin()) || "Griffin".equals(event.getOrigin()))
respond(event, "You're the one who decided to make a potato do important things.");
else
respond(event, "Griffin is the one who decided to make a potato do important things.");
break;
case "griefing":
if (event.getChatter() != null)
if (!(event.getMessage().contains("not allowed") || event.getMessage().contains("isn't") || event.getMessage().contains("isnt")))
if (Rank.of(event.getChatter()) == Rank.GUEST)
respond(event, "[player], griefing is not allowed. Please take a look at the /rules for more information.");
break;
case "lag":
if (!event.getChatter().isOnline())
break;
int ping = event.getChatter().getOnlinePlayer().getPing();
double tps = Bukkit.getTPS()[1];
if (ping > 200 && tps > 16) {
event.setCancelled(true);
respond(event, StaticChannel.LOCAL.getChannel(), "[player], you are lagging (" + ping + "ms), not the server. Try relogging or rebooting your router.");
}
break;
}
}