can you remove items off the ground without entering the minecraft server

my friend has spawned in 9000 water buckets right next to me and the game crashed, so i was wondering if it was possible to remove items from the ground not in the server


Type kill @e[type=minecraft:item] from the console to remove all dropped items in the world.