How to cheat the.. NoCheat? :-)

Discussion in 'Plugin Development' started by fromgate, Nov 30, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    fromgate

    Hello!

    I created something like a "shot" (for my plugin ReActions). Action works fine and tested. But when it was used at server with NoCheatPlus shots not working.

    This method I'm using to "shoot" entity:

    Code:java
    1.  
    2.  
    3. public static boolean damageEntity (LivingEntity damager, LivingEntity e, double damage){
    4. EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, e, DamageCause.ENTITY_ATTACK, Math.max(damage, 0));
    5. Bukkit.getServer().getPluginManager().callEvent(event);
    6. if (!event.isCancelled()) e.damage(event.getDamage(), event.getDamager());
    7. return !event.isCancelled();
    8. }
    9.  
    10.  


    I use EntityDamageByEntityEvent to determine disabled PVP/PVE and NoCheatPlus determine that this event is not "normal" (ranged attack, no arm swing) and cancels event.

    I know that NoCheatPlus has an API, but I'm going to find a universal solution that could "cheat" other anti-cheat plugins too.

    Have any ideas?
     
  2. Offline

    Brixishuge

    Have you tried setting it's permission to monitor or highest?
     
  3. Offline

    fromgate

    I'm raising an event. I'm not listening it, so how I can change a priority? Or.. may be I did not understand what you mean? (sorry, but my English is need to be a better, much better)
    I'm trying to determine zones where PVP/PVE disabled. If event is cancelled, I count that PVP/PVE disabled too. But NCP cancels event too.
     
  4. Two things to consider, assuming "shoot" means a ranged weapon:

    1. ENTITY_ATTACK de facto means "close combat", so using this for ranged weapons can not really work, because plugins will not be able to distinguish close combat from other attacks anymore. The only way around it using ENTITY_ATTACK would be to define your own event class derived from EntityDamageByEntityEvent (might not need its own handler lists), so a compatibility hook (cncp) can ignore those events using configuration. How about using "magic" for ranged weapons? Using MAGIC would make it be ignored by any close-combat checks directly.

    2. Using entity.damage(other entity) might lead to a redundant event due to the CraftEventFactory or something (compare to tnt issues). If you fire your own even (whatever damage reason) then i don't see a need to use that method for dealing damage. In addition you might want to set last damage cause by hand anyway.
     
  5. Offline

    fromgate

    asofold Thank you. Now I have some ideas to test.
    I think using MAGIC will be enough for me.
     
  6. fromgate Now thinking of gun-like weapons, still abuse is possible in terms of shooting frequency and auto-aiming. Tackling those would need to have specific checks enabled, so that would mean going for implementing an Event that extends EntityDamageByEntityEvent in order to allow a compatibility hook disabling or running only certain checks. Ensuring a maximum shooting frequency could be done by the weapons plugin, though.

    After all this is a projectile hit :) so have you considered adding events for projectile launch and/or for damage by a projectile? I know there is no support in Bukkit for temporary custom entities just used in events, however one might use some thrown potion without any effects but some metadata or so to identify it's special. That would allow other plugins to run projectile checks.

    But i don't intend to give you more headache, anything that makes it work at first should be ok :p.
     
    fromgate likes this.
Thread Status:
Not open for further replies.

Share This Page