Untitled
java
2 months ago
1.1 kB
8
Indexable
Never
@SubscribeEvent public static void onPlayerTick(TickEvent.PlayerTickEvent event) { if (event.side == LogicalSide.SERVER) { event.player.getCapability(PlayerElementalSkillUsedProvider.PLAYER_ELEMENTAL_SKILL_USED).ifPresent(skillUsed -> { event.player.getCapability(PlayerElementalSkillCdProvider.PLAYER_ELEMENTAL_SKILL_CD).ifPresent(cooldown -> { if (skillUsed.getSkillUsed() && cooldown.getCooldown() > 0) { cooldown.subCooldown(1); event.player.sendSystemMessage(Component.literal( "Still Cooldown! " + cooldown.getCooldown() + " ticks left.").withStyle(ChatFormatting.RED)); if (cooldown.getCooldown() == 0) { skillUsed.setSkillUsed(false); event.player.sendSystemMessage(Component.literal("Elemental skill cd over").withStyle(ChatFormatting.AQUA)); ElementalSkillC2SPacket.skillHoldTime = 0; } } }); }); } }