function setEffect(p: player, e: potion effect type, t: integer, s: time span, h: boolean, a: boolean, c: colour) :: boolean: if {_p} is a player: if {_e} is a potion effect type: if {_t} is an integer: if {_s} is a time span: if {_h} is a boolean: if {_a} is a boolean: if {effects::%{_p}%::%{_e}%} is not set: set {effects::%{_p}%::%{_e}%} to now + {_s} else: if {effects::%{_p}%::%{_e}%} > now: set {_s} to {effects::%{_p}%::%{_e}%} - now if (now + {_s}) < {effects::%{_p}%::%{_e}%}: send "[DEBUG] The current effect lasts longer than specified!" to console return false stop apply potion of {_e} of tier {_t} to {_p} for {_s} and ambient {_a} hide particle effects {_a} colour {_c} else: send "[DEBUG] %{_a}% is not a valid boolean!" to console return false else: send "[DEBUG] %{_h}% is not a valid boolean!" to console return false else: send "[DEBUG] %{_s}% is not a valid time span!" to console return false else: send "[DEBUG] %{_t}% is not a valid integer!" to console return false else: send "[DEBUG] %{_e}% is not a valid potion effect type!" to console return false else: send "[DEBUG] %{_p}% is not a valid player!" to console return false