use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.
the class Pride20Listener method onSecretCatClick.
@EventHandler
public void onSecretCatClick(NPCRightClickEvent event) {
if (event.getNPC().getId() != 2776)
return;
Player player = event.getClicker();
SettingService service = new SettingService();
Setting setting = service.get(player, "pride20Secret");
if (setting.getBoolean()) {
CooldownService cooldownService = new CooldownService();
if (!cooldownService.check(player, "pride20Cat", TickTime.SECOND.x(10)))
return;
player.playSound(player.getLocation(), Sound.ENTITY_CAT_PURREOW, 5f, .08f);
return;
}
player.playSound(player.getLocation(), Sound.ENTITY_CAT_PURREOW, 5f, .08f);
PlayerUtils.giveItem(player, new ItemBuilder(Material.ORANGE_BANNER).pattern(DyeColor.RED, PatternType.STRIPE_TOP).pattern(DyeColor.YELLOW, PatternType.STRIPE_MIDDLE).pattern(DyeColor.LIME, PatternType.HALF_HORIZONTAL_MIRROR).pattern(DyeColor.YELLOW, PatternType.STRIPE_MIDDLE).pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM).build());
setting.setBoolean(true);
service.save(setting);
PlayerUtils.send(player, "&eHow did you even get here? I mean.... meow");
}
use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.
the class Pugmas20 method onNPCClick.
@EventHandler
public void onNPCClick(NPCRightClickEvent event) {
Player player = event.getClicker();
if (!isAtPugmas(player))
return;
if (!new CooldownService().check(event.getClicker(), "Pugmas20_NPC", TickTime.SECOND.x(10)))
return;
int id = event.getNPC().getId();
QuestNPC.startScript(player, id);
Merchants.openMerchant(player, id);
}
use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.
the class Pugmas20 method onNpcLeftClick.
@EventHandler
public void onNpcLeftClick(NPCLeftClickEvent event) {
Player player = event.getClicker();
if (!isAtPugmas(player))
return;
if (!new CooldownService().check(player, "pugmas20-elf-punch", TickTime.SECOND.x(3)))
return;
String message = RandomUtils.randomElement("Ow!", "Stop that!", "Rude!");
PlayerUtils.send(player, QuestNPC.format(event.getNPC().getName(), message));
}
use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.
the class Halloween20 method onButtonClick.
@EventHandler
public void onButtonClick(PlayerInteractEvent event) {
if (!ActionGroup.CLICK_BLOCK.applies(event))
return;
if (event.getHand() != EquipmentSlot.HAND)
return;
SoundButton button = SoundButton.getByLocation(event.getClickedBlock().getLocation());
if (button == null)
return;
new SoundBuilder(button.getSound()).receiver(event.getPlayer()).play();
Halloween20Service service = new Halloween20Service();
Halloween20User user = service.get(event.getPlayer());
if (user.getFoundButtons().contains(button)) {
if (new CooldownService().check(event.getPlayer(), "halloween20-button-alreadyfound", TickTime.SECOND.x(10)))
user.sendMessage(PREFIX + "You've already found this button!");
return;
}
user.getFoundButtons().add(button);
service.save(user);
user.sendMessage(PREFIX + "You have found a spooky button! &e(" + user.getFoundButtons().size() + "/" + SoundButton.values().length + ")");
if (user.getFoundButtons().size() != SoundButton.values().length)
return;
PermissionChange.set().player(event.getPlayer()).permissions("powder.powder.spookyscaryskeletons").runAsync();
user.sendMessage(PREFIX + "You have unlocked the Spooky Scary Skeletons song! &c/songs");
}
use of gg.projecteden.nexus.models.cooldown.CooldownService in project Nexus by ProjectEdenGG.
the class Mining method breakBlock.
public static boolean breakBlock(BlockBreakEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
Material type = block.getType();
if (!OreType.getOres().contains(type))
return false;
OreType oreType = OreType.ofOre(type);
if (oreType == null)
return false;
ItemStack tool = player.getInventory().getItemInMainHand();
if (!oreType.canBeMinedBy(tool.getType())) {
if (new CooldownService().check(player, "BF21_cantbreak_tool", TickTime.SECOND.x(15))) {
send(Errors.CANT_BREAK + " with this tool. Needs either: " + oreType.getCanBreak(), player);
Quests.sound_villagerNo(player);
}
return true;
}
Quests.giveExp(player);
new SoundBuilder(Sound.BLOCK_STONE_BREAK).location(player.getLocation()).category(SoundCategory.BLOCKS).play();
PlayerUtils.giveItem(player, oreType.getIngotItemStack(tool));
new BlockRegenJob(block.getLocation(), block.getType()).schedule(randomInt(3 * 60, 5 * 60));
block.setType(Material.STONE);
return true;
}
Aggregations