SHOW:
|
|
- or go back to the newest paste.
1 | - | public static ArrayList<Player> players = new ArrayList<Player>(); |
1 | + | |
2 | - | public static ListIterator<Player> iterPlayers = players.listIterator(); |
2 | + | |
3 | - | public static Location holeLoc; |
3 | + | |
4 | ||
5 | final Location holeLoc = loc; | |
6 | final int pullRadius = plugin.getConfig().getInt("Pull Radius"); | |
7 | ||
8 | - | holeLoc = loc; |
8 | + | |
9 | public void run() { | |
10 | ArrayList<Player> players = new ArrayList<Player>(); | |
11 | for (Player pl : holeLoc.getWorld().getPlayers()) { | |
12 | if (pl.getLocation().distance(holeLoc) <= pullRadius) { | |
13 | - | |
13 | + | Vector vector = holeLoc.toVector().subtract(p.getLocation().toVector()); |
14 | - | for (Player nearbyPlayers : holeLoc.getWorld().getPlayers()) { |
14 | + | p.setVelocity(vector.multiply(0.5)); |
15 | - | if(nearbyPlayers.getWorld() != holeLoc.getWorld() || nearbyPlayers.getLocation().distance(holeLoc) > pullRadius) { |
15 | + | |
16 | - | continue; |
16 | + | |
17 | } | |
18 | - | players.add(nearbyPlayers); |
18 | + | }, 0, 1); |
19 | } |