use of org.spongepowered.api.event.entity.living.player.KickPlayerEvent in project SpongeCommon by SpongePowered.
the class ServerPlayerMixin method bridge$kick.
@Override
public boolean bridge$kick(final Component message) {
final Component messageToSend;
if (ShouldFire.KICK_PLAYER_EVENT) {
final KickPlayerEvent kickEvent = SpongeEventFactory.createKickPlayerEvent(PhaseTracker.getCauseStackManager().currentCause(), message, message, (ServerPlayer) this);
if (Sponge.eventManager().post(kickEvent)) {
return false;
}
messageToSend = kickEvent.message();
} else {
messageToSend = message;
}
final net.minecraft.network.chat.Component component = SpongeAdventure.asVanilla(messageToSend);
this.connection.disconnect(component);
return true;
}
Aggregations