Class FlagContext

java.lang.Object
com.sk89q.worldguard.protection.flags.FlagContext

public final class FlagContext extends Object
  • Method Details

    • create

      public static FlagContext.FlagContextBuilder create()
    • put

      public void put(String name, Object value)
    • getSender

      public com.sk89q.worldedit.extension.platform.Actor getSender()
    • getUserInput

      public String getUserInput()
    • getPlayerSender

      public LocalPlayer getPlayerSender() throws InvalidFlagFormat
      Gets the CommandSender as a player.
      Returns:
      Player
      Throws:
      InvalidFlagFormat - if the sender is not a player
    • getUserInputAsInt

      public Integer getUserInputAsInt() throws InvalidFlagFormat
      Throws:
      InvalidFlagFormat
    • getUserInputAsDouble

      public Double getUserInputAsDouble() throws InvalidFlagFormat
      Throws:
      InvalidFlagFormat
    • get

      @Nullable public Object get(String name)
      Get an object from the context by key name. May return null if the object does not exist in the context.
      Parameters:
      name - key name of the object
      Returns:
      the object matching the key, or null
    • get

      @Nullable public Object get(String name, Object defaultValue)
      Get an object from the context by key name. Will only return null if a) you provide null as the default b) the key has explicity been set to null
      Parameters:
      name - key name of the object
      Returns:
      the object matching the key
    • copyWith

      public FlagContext copyWith(@Nullable com.sk89q.worldedit.extension.platform.Actor commandSender, @Nullable String s, @Nullable Map<String,Object> values)
      Create a copy of this FlagContext, with optional substitutions for values If any supplied variable is null, it will be ignored. If a map is supplied, it will override this FlagContext's values of the same key, but unprovided keys will not be overriden and will be returned as shallow copies.
      Parameters:
      commandSender - CommandSender for the new FlagContext to run under
      s - String of the user input for the new FlagContext
      values - map of values to override from the current FlagContext
      Returns:
      a copy of this FlagContext