Prevent same-team players from being knocked back by flags.
Added a check to ensure players on the same team as the flag carrier are not affected by knockback when near the flag. Updated the build number to reflect the new changes.
This commit is contained in:
parent
05a63b9a52
commit
95b54d1a03
|
|
@ -81,10 +81,18 @@ public class Flag implements Runnable {
|
|||
if (flagCarrier != null) {
|
||||
return;
|
||||
}
|
||||
Team team = teamPlayer.getTeam();
|
||||
flagLocation.getNearbyPlayers(5).forEach(nearbyPlayer -> {
|
||||
if (nearbyPlayer.getUniqueId().equals(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
Optional<TeamPlayer> nearByTeamPlayer = gameManager.getTeamPlayer(nearbyPlayer);
|
||||
if (nearByTeamPlayer.isEmpty()) {
|
||||
return;
|
||||
} else if (nearByTeamPlayer.get().getTeam().equals(team)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Vector direction = nearbyPlayer.getLocation().toVector().subtract(flagLocation.toVector()).normalize();
|
||||
direction.setY(0.2);
|
||||
nearbyPlayer.setVelocity(direction.multiply(5));
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
#Sat Mar 01 19:29:28 CET 2025
|
||||
buildNumber=102
|
||||
#Sat Mar 01 20:08:55 CET 2025
|
||||
buildNumber=103
|
||||
version=0.1
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user