when you say that it isnt working what specifically isnt working because you are now talking about remaking totem of undying for your custom item. Im going to assume you are wondering how to make your player not die. Just cancel the event. You can read the docs on LivingDeathEvent here
for future reference, you need to look up the class in your IDE. For IntelliJ its Ctrl+N