Minecraft – How to give theself certain potions via commands

minecraft-commandsminecraft-java-edition

I am making an RPG server and so I'm also making shops where you use points to get items, everything is working but the potions, I tried to look up how to give potions with command block but every answer tells me to use numbers (ID for the potion) which does not work, how do I give a potion with the effects already in game with command block?

Best Answer

To give a custom potion to a player you can use the command:

/give <selector> minecraft:potion{CustomPotionEffects:[{Id:<id>,Duration:<duration>}],Potion:"minecraft:water"}

Replace <selector> with whatever you are giving it to, <id> with the numerical ID for what you want, and <duration> with the duration in ticks. See here for a list of potion IDs.

If you want multiple effects on one potion you can duplicate {Id:<id>,Duration:<duration>} within its list multiple times, separated with commas.