Interface StringMatcher
public interface StringMatcher
-
Method Summary
Modifier and TypeMethodDescriptiondefault 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.WorldgetWorldByName(String worldName)Gets a world by name, if possible.matchPlayerNames(String filter)Match player names.com.sk89q.worldedit.extension.platform.ActormatchPlayerOrConsole(com.sk89q.worldedit.extension.platform.Actor sender, String filter)Match only a single player or console.Iterable<? extends LocalPlayer>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 Ifsenderis aPlayer: #world returns all players in the world thatsenderis in #near reaturns all players within 30 blocks ofsender's location Otherwise, the format is as specified inmatchPlayerNames(String)default Iterable<LocalPlayer>matchPlayers(LocalPlayer player)Get a single player as an iterator for players.default LocalPlayermatchSinglePlayer(com.sk89q.worldedit.extension.platform.Actor sender, String filter)Match only a single player.com.sk89q.worldedit.world.WorldmatchWorld(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.CommandExceptionMatch 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 namednameis located in, if the player is online. [name] A world with the namename- Parameters:
sender- The sender requesting a matchfilter- The filter string- Returns:
- The resulting world
- Throws:
com.sk89q.minecraft.util.commands.CommandException- if no world matches
-
matchPlayerNames
Match player names. The filter string uses the following format: \@[name] looks up all players with the exactname*[name] matches any player whose name containsname[name] matches any player whose name starts withname- Parameters:
filter- The filter string to check.- Returns:
- A
Listof players who matchfilter
-
checkPlayerMatch
default Iterable<? extends LocalPlayer> checkPlayerMatch(List<? extends LocalPlayer> players) throws com.sk89q.minecraft.util.commands.CommandExceptionChecks if the given list of players is greater than size 0, otherwise throw an exception. -
matchPlayers
Iterable<? extends LocalPlayer> matchPlayers(com.sk89q.worldedit.extension.platform.Actor source, String filter) throws com.sk89q.minecraft.util.commands.CommandExceptionMatches players based on the specified filter string The filter string format is as follows: * returns all the players currently online Ifsenderis aPlayer: #world returns all players in the world thatsenderis in #near reaturns all players within 30 blocks ofsender's location Otherwise, the format is as specified inmatchPlayerNames(String)- Parameters:
source- The CommandSender who is trying to find a playerfilter- 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.CommandExceptionMatch only a single player.- Parameters:
sender- TheActorwho is requesting a player matchfilter- The filter string.- Returns:
- The single player
- Throws:
com.sk89q.minecraft.util.commands.CommandException- If more than one player match was found- See Also:
for filter string syntax
-
matchPlayerOrConsole
com.sk89q.worldedit.extension.platform.Actor matchPlayerOrConsole(com.sk89q.worldedit.extension.platform.Actor sender, String filter) throws com.sk89q.minecraft.util.commands.CommandExceptionMatch only a single player or console. The filter string syntax is as follows: #console, *console, or ! return the server console All syntax frommatchSinglePlayer(Actor, String)- Parameters:
sender- The sender trying to match a CommandSenderfilter- The filter string- Returns:
- The resulting CommandSender
- Throws:
com.sk89q.minecraft.util.commands.CommandException- if either zero or more than one player matched.
-
matchPlayers
Get a single player as an iterator for players.- Parameters:
player- The player to return in an Iterable- Returns:
- iterator for player
-
getWorldByName
Gets a world by name, if possible.- Parameters:
worldName- The name- Returns:
- The world
-
replaceMacros
Replace macros in the text. The macros replaced are as follows: %name%: The name ofsender. %id%: The unique name of the sender. %online%: The number of players currently online on the server Ifsenderis a Player: %world%: The name of the worldsenderis located in %health%: The health ofsender.- Parameters:
sender- The sender to checkmessage- The message to replace macros in- Returns:
- The message with macros replaced
-