-
Notifications
You must be signed in to change notification settings - Fork 0
API
Vrekt edited this page Jun 12, 2021
·
6 revisions
Everything within the API is will work-in-progress and subject to change at anytime!
PlayerViolationEvent
is invoked when a player violates a check.
Here you can receive the check failed, the violation level and information.
@EventHandler
private void onPlayerViolation(PlayerViolationEvent event) {
final Player player = event.getPlayer();
final CheckType check = event.checkFailed();
final CheckResult result = event.result();
myLogger.info("Player violation: " + player.getName() + " with check " + check.getName());
myLogger.info("Information: " + result.information());
if (check == CheckType.JESUS) {
if (someCustomCheckForMyPlugin()) event.setCancelled(true);
}
}
PostPlayerViolationEvent
is invoked after the violation has been processed.
Here you can retrieve certain actions like if the result was to ban, kick, notify, etc.
@EventHandler
private void onPostPlayerViolation(PostPlayerViolationEvent event) {
final Player player = event.getPlayer();
final ViolationResult result = event.result();
if (result.ban() || result.kick()) {
Arc.arc().getLogger().info("Player " + player.getName() + " will be disconnected for " + event.checkFailed().getName());
}
}
PlayerBanEvent
is invoked before a player is set to be banned for violating a check.
Here you can retrieve the ban delay, the ban date and the raw check object.
@EventHandler
private void onPlayerBan(PlayerBanEvent event) {
event.setCancelled(true);
handleMyCustomBanPlugin();
}
PlayerExemptionCheckEvent
is invoked when Arc internally checks if a player is exempt.
Therefore, you can set the exemption status.
private void onExemptionCheck(PlayerExemptionCheckEvent event) {
if (event.check() == CheckType.FLIGHT && event.subType() == CheckSubType.FLIGHT_BOATFLY) {
// I have a boat-fly plugin :)
event.isExempt(true);
}
}