added verbose logging for api requests
added autostrike for early leave
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package eu.mhsl.craftattack.spawn.varo.appliances.metaGameplay.teams;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.common.api.repositories.VaroReportRepository;
|
||||
import eu.mhsl.craftattack.spawn.core.Main;
|
||||
import eu.mhsl.craftattack.spawn.core.api.client.ReqResp;
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
||||
import eu.mhsl.craftattack.spawn.core.util.text.DisconnectInfo;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -40,10 +42,24 @@ class ConnectivityChangeListener extends ApplianceListener<Teams> {
|
||||
return;
|
||||
}
|
||||
|
||||
if(event.getPlayer().isOp()) return;
|
||||
|
||||
VaroTeam team = Main.instance().getAppliance(Teams.class).getTeamFromPlayer(event.getPlayer().getUniqueId());
|
||||
Objects.requireNonNull(team, "Team not found for player " + event.getPlayer().getUniqueId());
|
||||
Main.logger().info(String.format("Team %s got a Strike, because they %s left early!", team.name, event.getPlayer().getName()));
|
||||
// TODO: strike team
|
||||
|
||||
VaroReportRepository.StrikeCreationInfo report = new VaroReportRepository.StrikeCreationInfo(
|
||||
null,
|
||||
event.getPlayer().getUniqueId(),
|
||||
"early left",
|
||||
"player left the server too early",
|
||||
null,
|
||||
null,
|
||||
1
|
||||
);
|
||||
ReqResp<Void> response = Main.instance().getRepositoryLoader().getRepository(VaroReportRepository.class).createStrike(report);
|
||||
Main.logger().info(String.format("Autostrike response for Team %s: %s", team.name, response));
|
||||
|
||||
this.getAppliance().enforceTeamLeave(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user