For a custom capability you need to have an Interface, Default implementation, Storage, Provider and a Factory.
If you want to attach the capability to a player you will need to use an attachcapability event and register it in your main mod class.
If your Player is teleported or respawns you will also have to manage your capability so you dont lose data.
Here is an example:
https://github.com/SALTStation/mod/tree/master/src/main/java/com/SaltStation/Main/Capabilities/FatigueCapability
https://github.com/SALTStation/mod/blob/master/src/main/java/com/SaltStation/Main/handlers/events/CapabilityHandeler.java
Ignore wrong grammar...