The combination of energy drinks and sleeping pills is a breach of every player's contract, not just rugby league but in any professional sport.
The contention that it isn't illegal cannot justify the abuse of substances which in effect breach two ethical rules.
First, to knowingly take this combination to achieve a "high" for competition is cheating, albeit with legal substances; you are increasing performance outside of skill development and hard work.
Second, in the professional contract, a clause appears stating you are banned from pursuing sports or activities which have the ability to cause injury or harm to your body, or words to that effect.
Each sport has its own version of that clause. These substances have the potential to cause harm. There is also a code of conduct which forbids the use of illegal or performance-enhancing drugs which must be adhered to by all participants.