How do you remove a SPECIFIC level of potion effect from a player?
I'm creating a Minecraft map which requires you to find splash potions to access new areas. I'm using effect @p clear minecraft:speed 0, but it sometimes activates another potion's ability. How do I stop this from happening?
I'm asking how to remove a specific level of potion effect.
Example:
Speed 5 triggers a tp command to teleport me to underground (desired), but this also happens when I use Speed 1 (undesired)
Best Answer
When you apply the effect to the player, set some scoreboard value to 1. Set it back to 0 when clearing the effect from the player. This way you can keep track of what effects the player might or might not have.
To create a scoreboard do scoreboard objectives create speed1 dummy. Then set the player's score to 1 using scoreboard players set <player> speed1 1. After that give all players with a score of 1 speed using effect @a[score_speed1_min=1] speed 1000000 <whatever value> true. When clearing the effect do the exact opposite, set the score back to 0 and clear the effects of all players with a score of 1.
You should have the command blocks applying and clearing the effects on a clock. If you set score speed2 for player1 to 0, while a player2 has speed1 set to 1, this will happen:
- Speed (all levels) will get cleared from player1 and player2
- Speed 1 will be given to player2
So: Before - Player1 has speed 2, player2 has speed 1. After - Player1 has no speed, player2 still has speed 1
Please excuse me for my possibly not very good English, I hope this helped you :)
Pictures about "How do you remove a SPECIFIC level of potion effect from a player?"



How do I remove a specific effect from a player?
You can also use the /effect command to clear all effects from a player. Type the command in the chat window and press the Enter key to run the command. This /effect command will clear all of the effects from the player called DigMinecraft.What is the command to remove potion effects in Minecraft?
"/effect <PlayerName> clear" removes status effects on the target player. If left blank, the player that executed the command will remove their effects. "/effect @a clear" will remove effects from all players currently connected to the Minecraft world, alive or not.Can you disable potion effects?
Once you have one activated, go to booster cookie menu in skyblock menu, and go to potion effects, and disable the ones you do not want. You can do the same to re-enable them.Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: ready made, Tembela Bohle, Stephane Hurbe, Enric Cruz López
