Hello, I trie to make a Plugin, which allows players to use combat based magic, like striking another player with a lightning. My problem is: Based on another feature of my plugin, you are able to skill attributes of your character. For example, you should also be able to increase your "magic" damage. Now I need to figure out a way to observe, which player was the "caster" of the spell, so I can check his magic damage rating and adjust the damage. But if you spawn a lightning or spawn an explosion for a spell effect, there is no relation to the player who casted the spell. Any suggestions?
Wouldn't the lightning itself be the entity, who damaged the other entity? Because in this case, how should i check for the player?
Well, if you summon the strike like so: Code (Java): final LightningStrike strike = world.spawn(location, LightningStrike.class); you can store the player that cast the strike and the strike in a Map. You can then (in the EntityDamageByEntityEvent) check if the strike hit the player and get the player that caused the Strike