various bugfixes
This commit is contained in:
@ -66,6 +66,7 @@ public class FightDetector extends Appliance {
|
||||
|
||||
VaroTeam otherTeam = this.queryAppliance(Teams.class).getTeamFromPlayer(otherPlayer.getUniqueId());
|
||||
if (otherTeam == null || ownTeam.equals(otherTeam)) continue;
|
||||
if(player.getLocation().getWorld().equals(otherPlayer.getLocation().getWorld())) continue;
|
||||
|
||||
if (player.getLocation().distance(otherPlayer.getLocation()) <= BLOCK_RADIUS) {
|
||||
this.setInFight(ownTeam);
|
||||
|
@ -71,7 +71,7 @@ public class JoinProtection extends Appliance {
|
||||
Component.text(
|
||||
secondsLeft > 0
|
||||
? String.format("Du bist in %d Sekunden angreifbar!", secondsLeft)
|
||||
: "Du jetzt angreifbar!",
|
||||
: "Du bist jetzt angreifbar!",
|
||||
NamedTextColor.RED
|
||||
)
|
||||
);
|
||||
|
@ -0,0 +1,37 @@
|
||||
package eu.mhsl.craftattack.spawn.varo.appliances.metaGameplay.strike;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.core.Main;
|
||||
import eu.mhsl.craftattack.spawn.core.api.server.HttpServer;
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
||||
import eu.mhsl.craftattack.spawn.varo.appliances.metaGameplay.teams.Teams;
|
||||
import eu.mhsl.craftattack.spawn.varo.appliances.metaGameplay.teams.VaroTeam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Strike extends Appliance {
|
||||
@Override
|
||||
public void httpApi(HttpServer.ApiBuilder apiBuilder) {
|
||||
record StrikeInfo(List<UUID> users, int totalWeight) {
|
||||
}
|
||||
apiBuilder.post("update", StrikeInfo.class, (data, request) -> {
|
||||
Main.instance().getLogger().info(String.format(
|
||||
"API Triggered Strike-Profile update for %s",
|
||||
data.users.stream().map(UUID::toString).collect(Collectors.joining(", ")))
|
||||
);
|
||||
|
||||
VaroTeam team = null;
|
||||
for(UUID uuid : data.users) {
|
||||
team = this.queryAppliance(Teams.class).getTeamFromPlayer(uuid);
|
||||
if(team != null) break;
|
||||
}
|
||||
Objects.requireNonNull(team);
|
||||
|
||||
System.out.println(team.name);
|
||||
|
||||
return HttpServer.nothing;
|
||||
});
|
||||
}
|
||||
}
|
@ -79,8 +79,8 @@ public class VaroTeam {
|
||||
if(isInFight) {
|
||||
Main.logger().info(String.format("Cannot kick Team %s because it is in a fight!", this.name));
|
||||
this.getOnlinePlayers()
|
||||
.forEach(player -> player.sendActionBar(
|
||||
"Du befindest dich in einer Kampfhandlung oder in der Nähe eines gegnerischen Teams! Der Kick wird verzögert!"
|
||||
.forEach(player -> player.sendMessage(
|
||||
"Du befindest dich in einer Kampfhandlung oder in der Nähe eines gegnerischen Teams. Der Kick wird verzögert!"
|
||||
));
|
||||
Bukkit.getScheduler().runTaskLater(
|
||||
Main.instance(),
|
||||
|
Reference in New Issue
Block a user