Class OffsetSetCommand
java.lang.Object
com.jtprince.coordinateoffset.command.OffsetSetCommand
- All Implemented Interfaces:
OffsetCommand
Container for data and response methods for "/offset set" commands.
-
Constructor Summary
ConstructorsConstructorDescriptionOffsetSetCommand(OffsetCommandSender commandSender, List<? extends OffsetPlayer> targets, ScalableOffset offset) -
Method Summary
Modifier and TypeMethodDescriptionGet who sent this command.Get the offset that was specified in the command.@Nullable OffsetProviderCheck if the offset provider affected by this command has calledwarnOffsetIsNotPersistentInProvider(com.jtprince.coordinateoffset.provider.OffsetProvider, com.jtprince.coordinateoffset.adapter.OffsetPlayer).Get an immutable list of the player(s) whose offset is being set by a command.@Nullable DoublegetWarnScaling(OffsetPlayer target) Retrieve the scaling factor that will be applied to the offset for the specified player.voidwarnOffsetIsNotPersistentInProvider(OffsetProvider provider, OffsetPlayer target) Print a warning message to the sender that the specified offset will be lost the next time an offset can change for a given player.voidwarnScaling(OffsetPlayer target, double scalingFactor) Print a warning message to the sender that the specified offset will be scaled by the specified factor since the targeted player is in a world with a non-unit scaling factor.
-
Constructor Details
-
OffsetSetCommand
public OffsetSetCommand(OffsetCommandSender commandSender, List<? extends OffsetPlayer> targets, ScalableOffset offset)
-
-
Method Details
-
getCommandSender
Description copied from interface:OffsetCommandGet who sent this command. Can be used to respond to the command.- Specified by:
getCommandSenderin interfaceOffsetCommand
-
getTargets
Get an immutable list of the player(s) whose offset is being set by a command. -
getOffset
Get the offset that was specified in the command. -
warnOffsetIsNotPersistentInProvider
Print a warning message to the sender that the specified offset will be lost the next time an offset can change for a given player.- Parameters:
provider- Offset provider that is not persisting the offset. The name is printed in the warning message.target- Player whose offset will be lost.
-
getOffsetIsNotPersistentForProvider
Check if the offset provider affected by this command has calledwarnOffsetIsNotPersistentInProvider(com.jtprince.coordinateoffset.provider.OffsetProvider, com.jtprince.coordinateoffset.adapter.OffsetPlayer).- Parameters:
target- Player whose offset is being set.- Returns:
- The offset provider that indicated it is not storing the specified offset, or null if no offset provider indicated it is not storing the offset.
-
warnScaling
Print a warning message to the sender that the specified offset will be scaled by the specified factor since the targeted player is in a world with a non-unit scaling factor.- Parameters:
target- Player whose offset will be scaled.scalingFactor- The scaling factor (divisor) that will be applied to the offset.
-
getWarnScaling
Retrieve the scaling factor that will be applied to the offset for the specified player.- Parameters:
target- Player whose offset scaling factor is being retrieved.- Returns:
- The scaling factor (divisor) that will be applied to the offset, or null if no scaling warning is set.
-