Class ServerResourcePackSendEvent
java.lang.Object
com.velocitypowered.api.event.player.ServerResourcePackSendEvent
- All Implemented Interfaces:
ResultedEvent<ResultedEvent.GenericResult>
@AwaitingEvent
public class ServerResourcePackSendEvent
extends Object
implements ResultedEvent<ResultedEvent.GenericResult>
This event is fired when the downstream server tries to send a player a ResourcePack packet.
The proxy will wait on this event to finish before forwarding the resource pack to the user.
If this event is denied, it will retroactively send a DENIED status to the downstream
server in response.
If the downstream server has it set to "forced," it will forcefully disconnect the user.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.velocitypowered.api.event.ResultedEvent
ResultedEvent.ComponentResult, ResultedEvent.GenericResult, ResultedEvent.Result -
Constructor Summary
ConstructorsConstructorDescriptionServerResourcePackSendEvent(ResourcePackInfo receivedResourcePack, ServerConnection serverConnection) Constructs a new ServerResourcePackSendEvent. -
Method Summary
Modifier and TypeMethodDescriptionGets the resource pack that will be forwarded to the player.Gets the original resource pack provided by the server.Gets theResultedEvent.GenericResultthat determines whether the resource pack will be forwarded to the player.Gets the server connection that attempted to send the resource pack.voidsetProvidedResourcePack(ResourcePackInfo providedResourcePack) Sets the resource pack that should be forwarded to the player.voidsetResult(ResultedEvent.GenericResult result) Sets theResultedEvent.GenericResultthat controls whether the resource pack is forwarded to the player.
-
Constructor Details
-
ServerResourcePackSendEvent
public ServerResourcePackSendEvent(ResourcePackInfo receivedResourcePack, ServerConnection serverConnection) Constructs a new ServerResourcePackSendEvent.- Parameters:
receivedResourcePack- The resource pack the server sent.serverConnection- The connection this occurred on.
-
-
Method Details
-
getServerConnection
Gets the server connection that attempted to send the resource pack.- Returns:
- the server connection
-
getReceivedResourcePack
Gets the original resource pack provided by the server.- Returns:
- the resource pack sent by the server
-
getProvidedResourcePack
Gets the resource pack that will be forwarded to the player. This can be different from the one received from the server.- Returns:
- the resource pack to send to the player
-
setProvidedResourcePack
Sets the resource pack that should be forwarded to the player.- Parameters:
providedResourcePack- the resource pack to send to the player
-
getResult
Gets theResultedEvent.GenericResultthat determines whether the resource pack will be forwarded to the player.By default, the result is
allowed(), meaning the proxy will forward the resource pack unless explicitly denied by a plugin.- Specified by:
getResultin interfaceResultedEvent<ResultedEvent.GenericResult>- Returns:
- the current event result
-
setResult
Sets theResultedEvent.GenericResultthat controls whether the resource pack is forwarded to the player.If set to
denied(), the proxy will send a DENIED response to the backend server instead of forwarding the pack to the player. If the pack was marked as forced, the server may then disconnect the player.- Specified by:
setResultin interfaceResultedEvent<ResultedEvent.GenericResult>- Parameters:
result- the new result for this event- Throws:
NullPointerException- ifresultisnull
-