Class ServerResourcePackRemoveEvent
java.lang.Object
com.velocitypowered.api.event.player.ServerResourcePackRemoveEvent
- All Implemented Interfaces:
ResultedEvent<ResultedEvent.GenericResult>
@AwaitingEvent
public class ServerResourcePackRemoveEvent
extends Object
implements ResultedEvent<ResultedEvent.GenericResult>
This event is fired when the downstream server tries to remove a resource pack from the player
or clear all of them. The proxy will wait on this event to finish before forwarding the
action to the user. If this event is denied, no resource packs will be removed from the player.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.velocitypowered.api.event.ResultedEvent
ResultedEvent.ComponentResult, ResultedEvent.GenericResult, ResultedEvent.Result -
Constructor Summary
ConstructorsConstructorDescriptionServerResourcePackRemoveEvent(UUID packId, ServerConnection serverConnection) Instantiates this event. -
Method Summary
Modifier and TypeMethodDescription@Nullable UUIDReturns the id of the resource pack, if it's null, all the resource packs from player will be cleared.Returns the currentResultedEvent.GenericResultthat determines whether the resource pack removal should proceed.Returns the server that tries to remove a resource pack from the player or clear all of them.voidsetResult(ResultedEvent.GenericResult result) Sets theResultedEvent.GenericResultto control whether the resource pack removal proceeds.
-
Constructor Details
-
ServerResourcePackRemoveEvent
Instantiates this event.- Parameters:
packId- the UUID of the resource pack to remove, ornullto clear allserverConnection- the server attempting to remove the resource pack
-
-
Method Details
-
getPackId
Returns the id of the resource pack, if it's null, all the resource packs from player will be cleared.- Returns:
- the id
-
getServerConnection
Returns the server that tries to remove a resource pack from the player or clear all of them.- Returns:
- the server connection
-
getResult
Returns the currentResultedEvent.GenericResultthat determines whether the resource pack removal should proceed.By default, the result is
allowed(), meaning the resource pack removal or clear will be forwarded to the client unless explicitly denied.- Specified by:
getResultin interfaceResultedEvent<ResultedEvent.GenericResult>- Returns:
- the current result
-
setResult
Sets theResultedEvent.GenericResultto control whether the resource pack removal proceeds.Use
ResultedEvent.GenericResult.denied()to prevent removal, orResultedEvent.GenericResult.allowed()to allow it. If denied, the packet will not be forwarded to the player.- Specified by:
setResultin interfaceResultedEvent<ResultedEvent.GenericResult>- Parameters:
result- the result to apply to this event- Throws:
NullPointerException- ifresultis null
-