Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onHit(EntityDamageByEntityEvent e) {
- if (!(e.getDamager() instanceof Player))
- return;
- if (!(e.getEntity() instanceof Player))
- return;
- if (e.isCancelled())
- return;
- if (((LivingEntity) e.getEntity()).getNoDamageTicks() > ((LivingEntity) e
- .getDamager()).getMaximumNoDamageTicks() / 2D)
- return;
- Player p = (Player) e.getDamager();
- Player t = (Player) e.getEntity();
- if (p.hasMetadata("NPC"))
- return;
- if (t.hasMetadata("NPC"))
- return;
- if (t.isOnGround()) {
- Location l = new Location(p.getWorld(), p.getLocation().getX(), 0,
- p.getLocation().getZ());
- Location o = new Location(t.getWorld(), t.getLocation().getX(), 0,
- t.getLocation().getZ());
- CheatData pd = main.getPlayerData(p);
- pd.groundHit(l.distanceSquared(o));
- } else {
- Location l = new Location(p.getWorld(), p.getLocation().getX(), 0,
- p.getLocation().getZ());
- Location o = new Location(t.getWorld(), t.getLocation().getX(), 0,
- t.getLocation().getZ());
- CheatData pd = main.getPlayerData(p);
- pd.doubleHit(l.distanceSquared(o));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement