/give command will not work if i add enchantments or attributes [duplicate]

This is most likely a plugin command conflict problem; this happens when two commands register themselves as "/give". My suspicion is that you have "Essentials" or "EssentialsX" installed on your server as well. The Essentials "/give" command does not accept NBT data; however, the minecraft "/give" command does. By default, Essentials registers itself as the main command; to override this and tell it you don't like its decision, change your commands to:

/minecraft:give @p diamond_sword{Damage:1000} 1

and

/minecraft:give @p minecraft:diamond_sword{Enchantments:[{id:sharpness,lvl:2000}]}

This is a really annoying issue I deal with all of the time on servers. Bukkit/Spigot is supposed to allow you to set the default back to minecraft, but for some reason that option is broken right now so you'll have to use the namespace for the vanilla command.