Class OffsetSetCommand

java.lang.Object
com.jtprince.coordinateoffset.command.OffsetSetCommand
All Implemented Interfaces:
OffsetCommand

@NullMarked public class OffsetSetCommand extends Object implements OffsetCommand
Container for data and response methods for "/offset set" commands.
  • Constructor Details

  • Method Details

    • getCommandSender

      public OffsetCommandSender getCommandSender()
      Description copied from interface: OffsetCommand
      Get who sent this command. Can be used to respond to the command.
      Specified by:
      getCommandSender in interface OffsetCommand
    • getTargets

      public List<OffsetPlayer> getTargets()
      Get an immutable list of the player(s) whose offset is being set by a command.
    • getOffset

      public ScalableOffset getOffset()
      Get the offset that was specified in the command.
    • warnOffsetIsNotPersistentInProvider

      public void warnOffsetIsNotPersistentInProvider(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.
      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

      public @Nullable OffsetProvider getOffsetIsNotPersistentForProvider(OffsetPlayer target)
      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

      public void warnScaling(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.
      Parameters:
      target - Player whose offset will be scaled.
      scalingFactor - The scaling factor (divisor) that will be applied to the offset.
    • getWarnScaling

      public @Nullable Double getWarnScaling(OffsetPlayer target)
      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.