TechzoneMC / Combat-Tag-Reloaded

Spigot 1.8 Combat Tag with NPCs and Instakill
http://dev.bukkit.org/bukkit-plugins/combat-tag/
Creative Commons Zero v1.0 Universal
6 stars 4 forks source link

Cancel entity damage if not authenticated by authme #33

Closed orkun1675 closed 9 years ago

orkun1675 commented 9 years ago

We should cancel the damage no matter what if either of the players are not authenticated by AuthMe. An un-logged-in player cannot do damage or receive it, and should never tag or get tagged.

I should have moved the attacker variable up, and should have checked if AuthMe is available. But I didn't want to interfere with your coding style. Just trying to help a bit.

orkun1675 commented 9 years ago

I forgot to add return; in the two positions after the setCancelled("true") line. GitHub takes time to get used to I guess..

Techcable commented 9 years ago
  1. Please move this to PluginCompatibilityListener, events should never be cancelled or modified in anyway in a monitor level listener.
  2. Don't worry about checking for installation, isAuthenticated will always return true if authme isn't installed.
  3. Thanks for the help :smiley:
orkun1675 commented 9 years ago

Will this work?

Techcable commented 9 years ago

Make sure to cast Utils.getRootDamager to a player,the isAuthenticated() method is only available on combatplayers so you need to use PluginCompatibility, Instead if

!Utils.getRootDamager(event.getDamager()).isAuthenticated())

you should do

PluginCompatibility.isAuthenticated((Player)Utils.getRootDamager(event.getDamager()))

.

Techcable commented 9 years ago

You must add import statements:

orkun1675 commented 9 years ago

I hope this will work?

Techcable commented 9 years ago

I'll take it from here.

Techcable commented 9 years ago

Use Build #22 to get the new features.

orkun1675 commented 9 years ago

Tested this and it is even worse. I just figured out that the actual damage problem was caused by authme. So, CombatTag does not need to hook into AuthMe API. AuthMe should be cancelling damage if not authenciated. (https://github.com/Xephi/AuthMeReloaded/pull/18)

Can you remove code related to AuthMe please?

Techcable commented 9 years ago

@orkun1675 Upgrade to the latest dev build.