Search in sources :

Example 16 with CooldownService

use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.

the class Pride20Listener method onBalloonNPCClick.

@EventHandler
public void onBalloonNPCClick(NPCRightClickEvent event) {
    if (event.getNPC().getId() != 2771)
        return;
    Player player = event.getClicker();
    CooldownService cooldownService = new CooldownService();
    if (!cooldownService.check(player, "prideDyeBomb", TickTime.MINUTE.x(1)))
        return;
    PlayerUtils.send(player, "&3Vendor > &eSadly all my balloons have uh... floated away, but I can give you this to play with");
    DyeBombCommand.giveDyeBomb(player, 5);
}
Also used : Player(org.bukkit.entity.Player) CooldownService(gg.projecteden.nexus.models.cooldown.CooldownService) EventHandler(org.bukkit.event.EventHandler)

Example 17 with CooldownService

use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.

the class Pride20Listener method onRegionEnter.

@EventHandler
public void onRegionEnter(PlayerEnteredRegionEvent event) {
    if (!event.getRegion().getId().equalsIgnoreCase("pride20"))
        return;
    CooldownService cooldownService = new CooldownService();
    if (!cooldownService.check(event.getPlayer(), "pride20enter", TickTime.MINUTE.x(5)))
        return;
    PlayerUtils.send(event.getPlayer(), "&eWelcome to the Pride Parade!" + " &3Have a look at all the colorful floats and roam around the city. If you'd like to join the parade, " + "type &c/pride20 parade join &3while standing where you want to be in the parade. &eEnjoy and happy pride!");
}
Also used : CooldownService(gg.projecteden.nexus.models.cooldown.CooldownService) EventHandler(org.bukkit.event.EventHandler)

Example 18 with CooldownService

use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.

the class Halloween20 method onNPCClick.

// Talking NPCs Handler
@EventHandler
public void onNPCClick(NPCRightClickEvent event) {
    QuestNPC npc = QuestNPC.getByID(event.getNPC().getId());
    if (npc == null)
        return;
    if (!new CooldownService().check(event.getClicker(), "Halloween20_NPC", TickTime.SECOND.x(2)))
        return;
    npc.sendScript(event.getClicker());
}
Also used : QuestNPC(gg.projecteden.nexus.features.events.y2020.halloween20.models.QuestNPC) CooldownService(gg.projecteden.nexus.models.cooldown.CooldownService) EventHandler(org.bukkit.event.EventHandler)

Example 19 with CooldownService

use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.

the class Effects method onClickNetherBrickStair.

// Netherbrick chairs
@EventHandler
public void onClickNetherBrickStair(PlayerInteractEvent event) {
    Player player = event.getPlayer();
    Block clicked = player.getTargetBlockExact(2);
    if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK))
        return;
    if (clicked == null)
        return;
    if (!isInWorld(clicked))
        return;
    if (!(new CooldownService().check(player, "AeveonProject_Sit", TickTime.SECOND.x(2))))
        return;
    if (clicked.getType().equals(Material.NETHER_BRICK_STAIRS)) {
        PlayerUtils.runCommandAsOp(player, "sit");
    }
}
Also used : Player(org.bukkit.entity.Player) Block(org.bukkit.block.Block) CooldownService(gg.projecteden.nexus.models.cooldown.CooldownService) EventHandler(org.bukkit.event.EventHandler)

Example 20 with CooldownService

use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.

the class Tip method show.

public boolean show(TipType tipType) {
    if (!isOnline())
        throw new PlayerNotOnlineException(this);
    if (!received.contains(tipType)) {
        received.add(tipType);
        new TipService().save(this);
        return true;
    }
    if (!new CooldownService().check(uuid, "Tip-" + tipType.name(), tipType.getCooldown()))
        return false;
    if (tipType.getPredicate() != null)
        if (!tipType.getPredicate().test(getOnlinePlayer()))
            return false;
    if (tipType.getRetryChance() > 0)
        return RandomUtils.chanceOf(tipType.getRetryChance());
    return true;
}
Also used : PlayerNotOnlineException(gg.projecteden.nexus.framework.exceptions.postconfigured.PlayerNotOnlineException) CooldownService(gg.projecteden.nexus.models.cooldown.CooldownService)

Aggregations

CooldownService (gg.projecteden.nexus.models.cooldown.CooldownService)20 Player (org.bukkit.entity.Player)11 EventHandler (org.bukkit.event.EventHandler)11 ItemStack (org.bukkit.inventory.ItemStack)5 Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)4 SoundBuilder (gg.projecteden.nexus.utils.SoundBuilder)3 WorldGroup (gg.projecteden.nexus.utils.WorldGroup)3 UUID (java.util.UUID)3 CommandCooldownException (gg.projecteden.nexus.framework.exceptions.postconfigured.CommandCooldownException)2 Block (org.bukkit.block.Block)2 QuestNPC (gg.projecteden.nexus.features.events.y2020.halloween20.models.QuestNPC)1 SoundButton (gg.projecteden.nexus.features.events.y2020.halloween20.models.SoundButton)1 Match (gg.projecteden.nexus.features.minigames.models.Match)1 HoleInTheWallArena (gg.projecteden.nexus.features.minigames.models.arenas.HoleInTheWallArena)1 HoleInTheWallMatchData (gg.projecteden.nexus.features.minigames.models.matchdata.HoleInTheWallMatchData)1 Track (gg.projecteden.nexus.features.minigames.models.matchdata.HoleInTheWallMatchData.Track)1 PathParser.getPathString (gg.projecteden.nexus.framework.commands.models.PathParser.getPathString)1 Confirm (gg.projecteden.nexus.framework.commands.models.annotations.Confirm)1 PlayerNotOnlineException (gg.projecteden.nexus.framework.exceptions.postconfigured.PlayerNotOnlineException)1 EventUser (gg.projecteden.nexus.models.eventuser.EventUser)1