ataranlen / civcraft

MineTexas Civcraft
https://www.minetexas.com/
GNU General Public License v2.0
19 stars 38 forks source link

RangedAttack not always called when damaging Players #158

Open YourCoal opened 6 years ago

YourCoal commented 6 years ago

The RangedAttack method for bows is only called when a player is holding a bow and an arrow the player shot hit a player. This actually isn't the best since during WarTime or any PvP a player might need to switch to a sword to defend them-self, so if the arrow hits the player when this happens the damage is set to the default minecraft arrow damage.

(A possible fix is getting the damage when the arrow is fired, then setting the entity's metadata to have that damage, so when a player is hit by an entity and the metadata "damage" != null then they will take damage that way.)

TheLegionCrazy commented 6 years ago

maybe queue instead metadata ? it's faster

class RangedAttackQueue extends BukkitRunnable {

   static HashMap<String, Long> ranged = new HashMap<>();

   public static void addAttack(...);

    .....
}