Interface StringMatcher


public interface StringMatcher
  • Method Summary

    Modifier and Type
    Method
    Description
    default Iterable<? extends LocalPlayer>
    checkPlayerMatch(List<? extends LocalPlayer> players)
    Checks if the given list of players is greater than size 0, otherwise throw an exception.
    com.sk89q.worldedit.world.World
    Gets a world by name, if possible.
    Match player names.
    com.sk89q.worldedit.extension.platform.Actor
    matchPlayerOrConsole(com.sk89q.worldedit.extension.platform.Actor sender, String filter)
    Match only a single player or console.
    matchPlayers(com.sk89q.worldedit.extension.platform.Actor source, String filter)
    Matches players based on the specified filter string The filter string format is as follows: * returns all the players currently online If sender is a Player: #world returns all players in the world that sender is in #near reaturns all players within 30 blocks of sender's location Otherwise, the format is as specified in matchPlayerNames(String)
    Get a single player as an iterator for players.
    default LocalPlayer
    matchSinglePlayer(com.sk89q.worldedit.extension.platform.Actor sender, String filter)
    Match only a single player.
    com.sk89q.worldedit.world.World
    matchWorld(com.sk89q.worldedit.extension.platform.Actor sender, String filter)
    Match a world.
    replaceMacros(com.sk89q.worldedit.extension.platform.Actor sender, String message)
    Replace macros in the text.
  • Method Details

    • matchWorld

      com.sk89q.worldedit.world.World matchWorld(com.sk89q.worldedit.extension.platform.Actor sender, String filter) throws com.sk89q.minecraft.util.commands.CommandException
      Match a world. The filter string syntax is as follows: #main returns the main world #normal returns the first world with a normal environment #nether return the first world with a nether environment #player:[name] returns the world that a player named name is located in, if the player is online. [name] A world with the name name
      Parameters:
      sender - The sender requesting a match
      filter - The filter string
      Returns:
      The resulting world
      Throws:
      com.sk89q.minecraft.util.commands.CommandException - if no world matches
    • matchPlayerNames

      List<LocalPlayer> matchPlayerNames(String filter)
      Match player names. The filter string uses the following format: \@[name] looks up all players with the exact name *[name] matches any player whose name contains name [name] matches any player whose name starts with name
      Parameters:
      filter - The filter string to check.
      Returns:
      A List of players who match filter
    • checkPlayerMatch

      default Iterable<? extends LocalPlayer> checkPlayerMatch(List<? extends LocalPlayer> players) throws com.sk89q.minecraft.util.commands.CommandException
      Checks if the given list of players is greater than size 0, otherwise throw an exception.
      Parameters:
      players - The List to check
      Returns:
      players as an Iterable
      Throws:
      com.sk89q.minecraft.util.commands.CommandException - If players is empty
    • matchPlayers

      Iterable<? extends LocalPlayer> matchPlayers(com.sk89q.worldedit.extension.platform.Actor source, String filter) throws com.sk89q.minecraft.util.commands.CommandException
      Matches players based on the specified filter string The filter string format is as follows: * returns all the players currently online If sender is a Player: #world returns all players in the world that sender is in #near reaturns all players within 30 blocks of sender's location Otherwise, the format is as specified in matchPlayerNames(String)
      Parameters:
      source - The CommandSender who is trying to find a player
      filter - The filter string for players
      Returns:
      iterator for players
      Throws:
      com.sk89q.minecraft.util.commands.CommandException - if no matches are found
    • matchSinglePlayer

      default LocalPlayer matchSinglePlayer(com.sk89q.worldedit.extension.platform.Actor sender, String filter) throws com.sk89q.minecraft.util.commands.CommandException
      Match only a single player.
      Parameters:
      sender - The Actor who is requesting a player match
      filter - The filter string.
      Returns:
      The single player
      Throws:
      com.sk89q.minecraft.util.commands.CommandException - If more than one player match was found
      See Also:
    • matchPlayerOrConsole

      com.sk89q.worldedit.extension.platform.Actor matchPlayerOrConsole(com.sk89q.worldedit.extension.platform.Actor sender, String filter) throws com.sk89q.minecraft.util.commands.CommandException
      Match only a single player or console. The filter string syntax is as follows: #console, *console, or ! return the server console All syntax from matchSinglePlayer(Actor, String)
      Parameters:
      sender - The sender trying to match a CommandSender
      filter - The filter string
      Returns:
      The resulting CommandSender
      Throws:
      com.sk89q.minecraft.util.commands.CommandException - if either zero or more than one player matched.
    • matchPlayers

      default Iterable<LocalPlayer> matchPlayers(LocalPlayer player)
      Get a single player as an iterator for players.
      Parameters:
      player - The player to return in an Iterable
      Returns:
      iterator for player
    • getWorldByName

      @Nullable com.sk89q.worldedit.world.World getWorldByName(String worldName)
      Gets a world by name, if possible.
      Parameters:
      worldName - The name
      Returns:
      The world
    • replaceMacros

      String replaceMacros(com.sk89q.worldedit.extension.platform.Actor sender, String message)
      Replace macros in the text. The macros replaced are as follows: %name%: The name of sender. %id%: The unique name of the sender. %online%: The number of players currently online on the server If sender is a Player: %world%: The name of the world sender is located in %health%: The health of sender.
      Parameters:
      sender - The sender to check
      message - The message to replace macros in
      Returns:
      The message with macros replaced