protected static void applyMiasmicEffects(Player p, Entity target, int index) { if (index < 48 || index > 51) { return; } if (target.getMiasmicEffect() == 0) { target.setMiasmicEffect(index - 47); if (target is Player) { ((Player)target).getPackets().sendMessage("Your attack speed has been decreased!"); } int delay = 0; switch (index) { case 48: delay = 12000; break; // Miasmic rush. case 49: delay = 24000; break;// Miasmic burst. case 50: delay = 36000; break;// Miasmic blitz. case 51: delay = 48000; break;// Miasmic barrage. } Event miasmicEffectRemoveEvent = new Event(delay); miasmicEffectRemoveEvent.setAction(() => { miasmicEffectRemoveEvent.stop(); target.setMiasmicEffect(0); }); Server.registerEvent(miasmicEffectRemoveEvent); } }