Suggested name: Steadfast Suggested category: fun Request: If a player has the permission defined below, they are 100% immune to knockback. Permissions: Player.Steadfast
xXSilverswordXx Untested alpha: https://wesley009.com/downloads/steadfast.jar It should work Permission node: steadfast.steadfast
wesley009 EntityDamageEvent (now) has a getFinalDamage() method which would eliminate the need for your getDamageReduced() method - you should also look into switch statements, by the way. They're quite nice And your code would result in a ClassCastException anytime that a Player is damaged by a non-player - since the OP didn't state that he wanted to just stop Player-induced knockback, I would leave out the cast altogether.
AdamQpzm Damnt I forgot to make my code obstuctive Also I just made this in 10 min and I got the function for getDamageReduced() from the bukkit forums Also entitydamagedbyentity doesn't have the finaldamage function yet
Why: so it is hard to read and steal code. And programs. Bukkit devs and moderators don't really like it though when you do it.
timtower Granted, but I didn't think that anyone would really feel the need to protect a simple thing such as this from theft, especially given the above flaws that I mentioned (no offense) In my mind, it would probably be more inconvenient to find, download, decompile & then steal this than to create it yourself, and the latter has the advantage of not being someone else's code, but maybe that's just me ^^
AdamQpzm Lol "flaws" The getFinalDamage isn't even available in the event I use + it is an early alpha So instead of judging others make the plugin yourself and prove you can do it better Also timtower is kinda right, I was joking because I don't care about obstructing such small things. Also most of my made stuff will be open source sometime
wesley009 Jokes are hard to pick up on the internet, especially without indication. As I said, I didn't mean any offence But since you asked, I would've done it like this: https://gist.github.com/AdamQpzm/d471d39995e4cfa6fa03
AdamQpzm Oke I don't take any offense then, also I just started coding Java/Bukkit again so I didn't know that bukkit added this function. Anyhow I get this error thing with your function.
wesley009 Ah right, you'll need to use a more recent version of Bukkit It was only added a couple of version back, I believe
xXSilverswordXx It works, it only doesn't keep enchantment resistance in mind. But it will work with 1.7.9 When there is a beta for 1.7.10 then I can make a better one (due too the getFinalDamage not yet being implemented into the latest beta only in development versions)