Package org.geysermc.geyser.command
Record Class CommandSourceConverter<S>
java.lang.Object
java.lang.Record
org.geysermc.geyser.command.CommandSourceConverter<S>
- Type Parameters:
S- server command sender type- Record Components:
senderType- class of the server command sender typeplayerLookup- function for looking up a player command sender by UUIDconsoleProvider- supplier of the console command sendercommandSourceLookup- supplier of the platform implementation of theGeyserCommandSource
- All Implemented Interfaces:
org.incendo.cloud.SenderMapper<S,GeyserCommandSource>
public record CommandSourceConverter<S>(Class<S> senderType, Function<UUID,S> playerLookup, Supplier<S> consoleProvider, Function<S,GeyserCommandSource> commandSourceLookup)
extends Record
implements org.incendo.cloud.SenderMapper<S,GeyserCommandSource>
Converts
GeyserCommandSources to the server's command sender type (and back) in a lenient manner.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecommandSourceLookuprecord component.Returns the value of theconsoleProviderrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static <P,S> CommandSourceConverter<S> layered(Class<S> senderType, Function<UUID, P> playerLookup, Function<P, S> senderLookup, Supplier<S> consoleProvider, Function<S, GeyserCommandSource> commandSourceLookup) Creates a new CommandSourceConverter for a server platform in which the player type is not a command sender type, and must be mapped.@NonNull GeyserCommandSourceReturns the value of theplayerLookuprecord component.@NonNull Sreverse(GeyserCommandSource source) Returns the value of thesenderTyperecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CommandSourceConverter
public CommandSourceConverter(Class<S> senderType, Function<UUID, S> playerLookup, Supplier<S> consoleProvider, Function<S, GeyserCommandSource> commandSourceLookup) Creates an instance of aCommandSourceConverterrecord class.- Parameters:
senderType- the value for thesenderTyperecord componentplayerLookup- the value for theplayerLookuprecord componentconsoleProvider- the value for theconsoleProviderrecord componentcommandSourceLookup- the value for thecommandSourceLookuprecord component
-
-
Method Details
-
layered
public static <P,S> CommandSourceConverter<S> layered(Class<S> senderType, Function<UUID, P> playerLookup, Function<P, S> senderLookup, Supplier<S> consoleProvider, Function<S, GeyserCommandSource> commandSourceLookup) Creates a new CommandSourceConverter for a server platform in which the player type is not a command sender type, and must be mapped.- Type Parameters:
P- server player typeS- server command sender type- Parameters:
senderType- class of the command sender typeplayerLookup- function for looking up a player by UUIDsenderLookup- function for converting a player to a command senderconsoleProvider- supplier of the console command sendercommandSourceLookup- supplier of the platform implementation ofGeyserCommandSource- Returns:
- a new CommandSourceConverter
-
map
- Specified by:
mapin interfaceorg.incendo.cloud.SenderMapper<S,GeyserCommandSource>
-
reverse
- Specified by:
reversein interfaceorg.incendo.cloud.SenderMapper<S,GeyserCommandSource> - Throws:
IllegalArgumentException
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
senderType
Returns the value of thesenderTyperecord component.- Returns:
- the value of the
senderTyperecord component
-
playerLookup
Returns the value of theplayerLookuprecord component.- Returns:
- the value of the
playerLookuprecord component
-
consoleProvider
Returns the value of theconsoleProviderrecord component.- Returns:
- the value of the
consoleProviderrecord component
-
commandSourceLookup
Returns the value of thecommandSourceLookuprecord component.- Returns:
- the value of the
commandSourceLookuprecord component
-