use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.
the class ShopUtils method giveItems.
public static void giveItems(UUID uuid, List<ItemStack> items) {
Shop shop = new ShopService().get(uuid);
if (shop.isOnline()) {
List<ItemStack> excess = PlayerUtils.giveItemsAndGetExcess(shop.getOnlinePlayer(), items);
shop.addHolding(excess);
if (!excess.isEmpty())
if (new CooldownService().check(uuid, "shop-excess-items", TickTime.SECOND.x(2)))
PlayerUtils.send(uuid, new JsonBuilder(Shops.PREFIX + "Excess items added to item collection menu, click to view").command("/shops collect"));
} else
shop.addHolding(items);
}
use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.
the class CandyCaneCannon method onPlayerInteract.
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (!ActionGroup.RIGHT_CLICK.applies(event))
return;
if (event.getHand() != EquipmentSlot.HAND)
return;
final Player player = event.getPlayer();
final ItemStack item = player.getInventory().getItem(event.getHand());
if (!isCannon(item))
return;
final ItemStack candyCaneItem = findCandyCane(player);
if (candyCaneItem == null) {
if (new CooldownService().check(player, "candycanecannonammo", TickTime.SECOND.x(3)))
PlayerUtils.send(player, "&cYou are out of candy cane ammo!");
event.setCancelled(true);
return;
}
final Snowball snowball = player.launchProjectile(Snowball.class);
snowball.setItem(candyCaneItem);
snowball.setSilent(true);
new SoundBuilder(Sound.ENTITY_SNOWBALL_THROW).location(player).pitch(2).play();
if (!GameModeWrapper.of(player).isCreative())
candyCaneItem.subtract();
}
use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.
the class MailCommand method onWorldChange.
@EventHandler
public void onWorldChange(PlayerChangedWorldEvent event) {
Player player = event.getPlayer();
WorldGroup worldGroup = WorldGroup.of(player);
Mailer mailer = service.get(player);
List<Mail> mails = new ArrayList<>(mailer.getMail(worldGroup));
if (isNullOrEmpty(mails))
return;
if (!new CooldownService().check(player, "youhavemail", TickTime.MINUTE.x(5)))
return;
mailer.sendNotification();
}
use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.
the class Quests method onRightClickNPC.
@EventHandler
public void onRightClickNPC(NPCRightClickEvent event) {
Player player = event.getClicker();
if (event.getNPC().getId() != PARADE_MANAGER.getNpcId())
return;
CooldownService cooldownService = new CooldownService();
if (!cooldownService.check(player, "Pride21_NPCInteract", TimeUtils.TickTime.SECOND.x(5)))
return;
int waitTicks = Talker.sendScript(player, PARADE_MANAGER);
Pride21User user = service.get(player);
if (user.isComplete()) {
Tasks.wait(waitTicks, () -> player.teleportAsync(player.getLocation()));
Tasks.waitAsync(waitTicks, () -> {
player.resetPlayerTime();
viewFloat(player, true);
if (false && !user.isBonusTokenRewardClaimed()) {
Trophy.PRIDE_2021.give(player);
user.setBonusTokenRewardClaimed(true);
service.save(user);
EventUserService eventUserService = new EventUserService();
EventUser eventUser = eventUserService.get(user);
eventUser.giveTokens(50);
eventUserService.save(eventUser);
ItemStack dyeBomb = DyeBombCommand.getDyeBomb();
dyeBomb.setAmount(16);
PlayerUtils.giveItemAndMailExcess(player, dyeBomb, "Pride 2021 Reward", WorldGroup.SURVIVAL);
}
});
}
}
use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.
the class AACNotifyCommand method notify.
@Path("<player> <message...>")
void notify(Player player, String reason) {
String name = player.getName();
WorldGroup worldGroup = WorldGroup.of(player);
int ping = player.getPing();
double tps = Bukkit.getTPS()[1];
if (ping < 300 && tps >= 15) {
String message = "&a" + name + " &f" + reason.replace("{worldgroup}", camelCase(worldGroup)).replace("{ping}", String.valueOf(ping)).replace("{tps}", new DecimalFormat("0.00").format(tps));
UUID uuid = player.getUniqueId();
totalCounts.put(uuid, totalCounts.getOrDefault(uuid, 0) + 1);
if (new CooldownService().check(player, "aac-notify-ingame", TickTime.SECOND.x(15))) {
String ingame = message;
if (ingameCounts.getOrDefault(uuid, 0) > 0)
ingame += (" &c(" + ingameCounts.get(uuid) + " more...)");
Broadcast.staffIngame().message("&7&l[&cRadar&7&l] " + ingame).send();
ingameCounts.remove(uuid);
} else
ingameCounts.put(uuid, ingameCounts.getOrDefault(uuid, 0) + 1);
if (new CooldownService().check(player, "aac-notify-discord", TickTime.MINUTE)) {
String discord = message;
if (discordCounts.getOrDefault(uuid, 0) > 0)
discord += " (" + discordCounts.get(uuid) + " more...)";
Broadcast.staffDiscord().prefix("Radar").message(discord).send();
discordCounts.remove(uuid);
} else
discordCounts.put(uuid, discordCounts.getOrDefault(uuid, 0) + 1);
if (Rank.getOnlineMods().stream().allMatch(nerd -> AFK.get(player.getPlayer()).isTimeAfk()))
if (totalCounts.getOrDefault(uuid, 0) > 20)
runCommandAsConsole("ban " + player.getName() + " 1d You have been automatically banned " + "by our anti cheat. Hacking is not allowed! (C: " + totalCounts.get(uuid) + ")");
}
}
Aggregations