Resource pack API
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package com.velocitypowered.api.event.player;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
|
||||
public class PlayerResourcePackStatusEvent {
|
||||
private final Player player;
|
||||
private final Status result;
|
||||
|
||||
public PlayerResourcePackStatusEvent(Player player, Status result) {
|
||||
this.player = Preconditions.checkNotNull(player, "player");
|
||||
this.result = Preconditions.checkNotNull(result, "result");
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public Status getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PlayerResourcePackStatusEvent{"
|
||||
+ "player=" + player
|
||||
+ ", result=" + result
|
||||
+ '}';
|
||||
}
|
||||
|
||||
public enum Status {
|
||||
/**
|
||||
* The resource pack was applied successfully.
|
||||
*/
|
||||
SUCCESSFUL,
|
||||
/**
|
||||
* The player declined to download the resource pack.
|
||||
*/
|
||||
DECLINED,
|
||||
/**
|
||||
* The player could not download the resource pack.
|
||||
*/
|
||||
FAILED_DOWNLOAD,
|
||||
/**
|
||||
* The player has accepted the resource pack and is now downloading it.
|
||||
*/
|
||||
ACCEPTED
|
||||
}
|
||||
}
|
@@ -151,4 +151,20 @@ public interface Player extends CommandSource, InboundConnection, ChannelMessage
|
||||
* @param input the chat input to send
|
||||
*/
|
||||
void spoofChatInput(String input);
|
||||
|
||||
/**
|
||||
* Sends the specified resource pack from {@code url} to the user. If at all possible, send the
|
||||
* resource pack using {@link #sendResourcePack(String, byte[])}.
|
||||
*
|
||||
* @param url the URL for the resource pack
|
||||
*/
|
||||
void sendResourcePack(String url);
|
||||
|
||||
/**
|
||||
* Sends the specified resource pack from {@code url} to the user.
|
||||
*
|
||||
* @param url the URL for the resource pack
|
||||
* @param hash the SHA-1 hash value for the resource pack
|
||||
*/
|
||||
void sendResourcePack(String url, byte[] hash);
|
||||
}
|
||||
|
Reference in New Issue
Block a user