How do I keep the sea from flooding my basement?

Solution 1:

If you break a block and water flows in, it cannot create water inside the basement. It only allows water to flow in, this means it will only flow 7 blocks and if you replace the block you removed it will automatically drain.

This will revert it to as it was before it was flooded except that torches and redstone are uprooted and must be picked up and replaced, and levers are destroyed. Fire is also put out and lava turned to cobblestone/obsidian.

Solution 2:

Water cannot pass through signs, ladders and other non-solid, waterproof blocks. I recommend signs, you can stack them and build a wall this way.

Some servers might also have sponges enabled, ask the admin for that.