Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Knockback implements Listener {
- private main plugin = main.getPlugin(main.class);
- @EventHandler
- public void onPunch(EntityDamageByEntityEvent e) {
- if (e.getEntity() instanceof Player) {
- if (e.getDamager() instanceof Player) {
- if (!(ZoutMoreKB.zout.contains(e.getDamager().getName()))){
- Player p = (Player) e.getDamager();
- Player t = (Player) e.getEntity();
- Location l = t.getLocation().subtract(p.getLocation());
- double distance = t.getLocation().distance(p.getLocation());
- Vector v = l.toVector().multiply(0.26 / distance);
- if (sumoArraylists.players.contains(p.getName()) && sumoArraylists.players.contains(t.getName())) {
- t.setVelocity(v);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement