diff --git a/api/src/main/java/com/velocitypowered/api/event/player/PlayerResourcePackStatusEvent.java b/api/src/main/java/com/velocitypowered/api/event/player/PlayerResourcePackStatusEvent.java index 0411a8676..71c2427ed 100644 --- a/api/src/main/java/com/velocitypowered/api/event/player/PlayerResourcePackStatusEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/player/PlayerResourcePackStatusEvent.java @@ -3,31 +3,49 @@ package com.velocitypowered.api.event.player; import com.google.common.base.Preconditions; import com.velocitypowered.api.proxy.Player; +/** + * This event is fired when the status of a resource pack sent to the player by the server is + * changed. + */ public class PlayerResourcePackStatusEvent { - private final Player player; - private final Status result; - public PlayerResourcePackStatusEvent(Player player, Status result) { + private final Player player; + private final Status status; + + public PlayerResourcePackStatusEvent(Player player, Status status) { this.player = Preconditions.checkNotNull(player, "player"); - this.result = Preconditions.checkNotNull(result, "result"); + this.status = Preconditions.checkNotNull(status, "status"); } + /** + * Returns the player affected by the change in resource pack status. + * + * @return the player + */ public Player getPlayer() { return player; } - public Status getResult() { - return result; + /** + * Returns the new status for the resource pack. + * + * @return the new status + */ + public Status getStatus() { + return status; } @Override public String toString() { return "PlayerResourcePackStatusEvent{" + "player=" + player - + ", result=" + result + + ", status=" + status + '}'; } + /** + * Represents the possible statuses for the resource pack. + */ public enum Status { /** * The resource pack was applied successfully. diff --git a/api/src/main/java/com/velocitypowered/api/proxy/Player.java b/api/src/main/java/com/velocitypowered/api/proxy/Player.java index 24f330943..8aa9870b1 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/Player.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/Player.java @@ -1,6 +1,7 @@ package com.velocitypowered.api.proxy; import com.velocitypowered.api.command.CommandSource; +import com.velocitypowered.api.event.player.PlayerResourcePackStatusEvent; import com.velocitypowered.api.proxy.messages.ChannelMessageSink; import com.velocitypowered.api.proxy.messages.ChannelMessageSource; import com.velocitypowered.api.proxy.player.PlayerSettings; @@ -154,14 +155,17 @@ public interface Player extends CommandSource, InboundConnection, ChannelMessage /** * Sends the specified resource pack from {@code url} to the user. If at all possible, send the - * resource pack using {@link #sendResourcePack(String, byte[])}. + * resource pack using {@link #sendResourcePack(String, byte[])}. To monitor the status of the + * sent resource pack, subscribe to {@link PlayerResourcePackStatusEvent}. * * @param url the URL for the resource pack */ void sendResourcePack(String url); /** - * Sends the specified resource pack from {@code url} to the user. + * Sends the specified resource pack from {@code url} to the user, using the specified 20-byte + * SHA-1 hash. To monitor the status of the sent resource pack, subscribe to + * {@link PlayerResourcePackStatusEvent}. * * @param url the URL for the resource pack * @param hash the SHA-1 hash value for the resource pack