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());
|
VaroTeam otherTeam = this.queryAppliance(Teams.class).getTeamFromPlayer(otherPlayer.getUniqueId());
|
||||||
if (otherTeam == null || ownTeam.equals(otherTeam)) continue;
|
if (otherTeam == null || ownTeam.equals(otherTeam)) continue;
|
||||||
|
if(player.getLocation().getWorld().equals(otherPlayer.getLocation().getWorld())) continue;
|
||||||
|
|
||||||
if (player.getLocation().distance(otherPlayer.getLocation()) <= BLOCK_RADIUS) {
|
if (player.getLocation().distance(otherPlayer.getLocation()) <= BLOCK_RADIUS) {
|
||||||
this.setInFight(ownTeam);
|
this.setInFight(ownTeam);
|
||||||
|
@ -71,7 +71,7 @@ public class JoinProtection extends Appliance {
|
|||||||
Component.text(
|
Component.text(
|
||||||
secondsLeft > 0
|
secondsLeft > 0
|
||||||
? String.format("Du bist in %d Sekunden angreifbar!", secondsLeft)
|
? String.format("Du bist in %d Sekunden angreifbar!", secondsLeft)
|
||||||
: "Du jetzt angreifbar!",
|
: "Du bist jetzt angreifbar!",
|
||||||
NamedTextColor.RED
|
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) {
|
if(isInFight) {
|
||||||
Main.logger().info(String.format("Cannot kick Team %s because it is in a fight!", this.name));
|
Main.logger().info(String.format("Cannot kick Team %s because it is in a fight!", this.name));
|
||||||
this.getOnlinePlayers()
|
this.getOnlinePlayers()
|
||||||
.forEach(player -> player.sendActionBar(
|
.forEach(player -> player.sendMessage(
|
||||||
"Du befindest dich in einer Kampfhandlung oder in der Nähe eines gegnerischen Teams! Der Kick wird verzögert!"
|
"Du befindest dich in einer Kampfhandlung oder in der Nähe eines gegnerischen Teams. Der Kick wird verzögert!"
|
||||||
));
|
));
|
||||||
Bukkit.getScheduler().runTaskLater(
|
Bukkit.getScheduler().runTaskLater(
|
||||||
Main.instance(),
|
Main.instance(),
|
||||||
|
Reference in New Issue
Block a user