Put the summary of the bug you're having here
What I expected to happen was...:
nothing
What actually happened was...:
got kicked
Steps to Reproduce:
1.Spam Chat In Single player mode
2. get kicked
Linked issues
Attachments
Comments

It literally says "Kicked for spamming".
Thank you for your report!
We're actually already tracking this issue in MC-14923, so I resolved and linked this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature in the future to see if the issue has already been reported.
Anti-spam is a built-in functionality of Minecraft.
You mention you both get kicked, which should only happen if both of you are spamming. Is that what happened?
(You have to take into account that your single player world is a server. It's just integrated.)