Yet Another World Protector is a server-side protection mod which allows you to protect your creations against various different events/actions of players, mobs and the environment. It was inspired by the forge mod WorldProtector and the WorldGuard plugin.
MrCrayfishGunMod: https://github.com/MrCrayfish/MrCrayfishGunMod/blob/1.19.X/src/main/java/com/mrcrayfish/guns/entity/ProjectileEntity.java#L423