13
0
geforkt von Mirrors/Velocity

Add Javadoc to resource pack API

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-12-29 15:37:56 -05:00
Ursprung 0ca0c2a297
Commit c8f73ea0ab
2 geänderte Dateien mit 31 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -3,31 +3,49 @@ package com.velocitypowered.api.event.player;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.Player; 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 { 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.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() { public Player getPlayer() {
return player; 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 @Override
public String toString() { public String toString() {
return "PlayerResourcePackStatusEvent{" return "PlayerResourcePackStatusEvent{"
+ "player=" + player + "player=" + player
+ ", result=" + result + ", status=" + status
+ '}'; + '}';
} }
/**
* Represents the possible statuses for the resource pack.
*/
public enum Status { public enum Status {
/** /**
* The resource pack was applied successfully. * The resource pack was applied successfully.

Datei anzeigen

@ -1,6 +1,7 @@
package com.velocitypowered.api.proxy; package com.velocitypowered.api.proxy;
import com.velocitypowered.api.command.CommandSource; 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.ChannelMessageSink;
import com.velocitypowered.api.proxy.messages.ChannelMessageSource; import com.velocitypowered.api.proxy.messages.ChannelMessageSource;
import com.velocitypowered.api.proxy.player.PlayerSettings; 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 * 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 * @param url the URL for the resource pack
*/ */
void sendResourcePack(String url); 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 url the URL for the resource pack
* @param hash the SHA-1 hash value for the resource pack * @param hash the SHA-1 hash value for the resource pack