#971: Add Player methods for client-side potion effects

By: Jishuna <joshl5324@gmail.com>
This commit is contained in:
Bukkit/Spigot 2024-02-04 10:10:28 +11:00
parent 7087785389
commit 04d1d1e2b9

View File

@ -43,6 +43,8 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.map.MapView;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.messaging.PluginMessageRecipient;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.profile.PlayerProfile;
import org.bukkit.scoreboard.Scoreboard;
import org.jetbrains.annotations.ApiStatus;
@ -925,6 +927,32 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@ApiStatus.Experimental
public void sendBlockUpdate(@NotNull Location loc, @NotNull TileState tileState) throws IllegalArgumentException;
/**
* Change a potion effect for the target entity. This will not actually
* change the entity's potion effects in any way.
* <p>
* <b>Note:</b> Sending an effect change to a player for themselves may
* cause unexpected behavior on the client. Effects sent this way will also
* not be removed when their timer reaches 0, they can be removed with
* {@link #sendPotionEffectChangeRemove(LivingEntity, PotionEffectType)}
*
* @param entity the entity whose potion effects to change
* @param effect the effect to change
*/
public void sendPotionEffectChange(@NotNull LivingEntity entity, @NotNull PotionEffect effect);
/**
* Remove a potion effect for the target entity. This will not actually
* change the entity's potion effects in any way.
* <p>
* <b>Note:</b> Sending an effect change to a player for themselves may
* cause unexpected behavior on the client.
*
* @param entity the entity whose potion effects to change
* @param type the effect type to remove
*/
public void sendPotionEffectChangeRemove(@NotNull LivingEntity entity, @NotNull PotionEffectType type);
/**
* Render a map and send it to the player in its entirety. This may be
* used when streaming the map in the normal manner is not desirable.