public class CraftScriptContext extends CraftScriptEnvironment
config, controller, player, server, session
Constructor and Description |
---|
CraftScriptContext(WorldEdit controller,
Platform server,
LocalConfiguration config,
LocalSession session,
Player player,
java.lang.String[] args) |
Modifier and Type | Method and Description |
---|---|
void |
checkArgs(int min,
int max,
java.lang.String usage)
Checks to make sure that there are enough but not too many arguments.
|
void |
error(java.lang.String message)
Print an error message to the user.
|
BlockStateHolder |
getBlock(java.lang.String id)
Get a block.
|
BlockStateHolder |
getBlock(java.lang.String input,
boolean allAllowed)
Get an item from an item name or an item ID number.
|
Pattern |
getBlockPattern(java.lang.String list)
Get a list of blocks as a set.
|
java.util.Set<BlockStateHolder> |
getBlocks(java.lang.String list,
boolean allBlocksAllowed)
Get a list of blocks as a set.
|
LocalConfiguration |
getConfiguration()
Get the configuration for WorldEdit.
|
java.util.List<EditSession> |
getEditSessions()
Get a list of edit sessions that have been created.
|
Player |
getPlayer()
Get the player.
|
java.io.File |
getSafeOpenFile(java.lang.String folder,
java.lang.String filename,
java.lang.String defaultExt,
java.lang.String... exts)
Gets the path to a file for opening.
|
java.io.File |
getSafeSaveFile(java.lang.String folder,
java.lang.String filename,
java.lang.String defaultExt,
java.lang.String... exts)
Gets the path to a file for saving.
|
LocalSession |
getSession()
Get the player's session.
|
void |
print(java.lang.String message)
Print a regular message to the user.
|
void |
printRaw(java.lang.String message)
Print an raw message to the user.
|
EditSession |
remember()
Get an edit session.
|
public CraftScriptContext(WorldEdit controller, Platform server, LocalConfiguration config, LocalSession session, Player player, java.lang.String[] args)
public EditSession remember()
public Player getPlayer()
public LocalSession getSession()
public LocalConfiguration getConfiguration()
public java.util.List<EditSession> getEditSessions()
EditSession
spublic void print(java.lang.String message)
message
- a messagepublic void error(java.lang.String message)
message
- a messagepublic void printRaw(java.lang.String message)
message
- a messagepublic void checkArgs(int min, int max, java.lang.String usage) throws InsufficientArgumentsException
min
- a number of argumentsmax
- -1 for no maximumusage
- usage stringInsufficientArgumentsException
public BlockStateHolder getBlock(java.lang.String input, boolean allAllowed) throws WorldEditException
input
- input to parseallAllowed
- true to ignore blacklistsUnknownItemException
DisallowedItemException
WorldEditException
public BlockStateHolder getBlock(java.lang.String id) throws WorldEditException
id
- the type IdUnknownItemException
DisallowedItemException
WorldEditException
public Pattern getBlockPattern(java.lang.String list) throws WorldEditException
list
- the inputUnknownItemException
DisallowedItemException
WorldEditException
public java.util.Set<BlockStateHolder> getBlocks(java.lang.String list, boolean allBlocksAllowed) throws WorldEditException
list
- a listallBlocksAllowed
- true if all blocks are allowedUnknownItemException
DisallowedItemException
WorldEditException
public java.io.File getSafeOpenFile(java.lang.String folder, java.lang.String filename, java.lang.String defaultExt, java.lang.String... exts) throws FilenameException
java.io.File
object will be
returned.
Use this method if you need to read a file from a directory.
folder
- sub-directory to look infilename
- filename (user-submitted)defaultExt
- default extension to append if there is noneexts
- list of extensions for file open dialog, null for no filterFilenameException
public java.io.File getSafeSaveFile(java.lang.String folder, java.lang.String filename, java.lang.String defaultExt, java.lang.String... exts) throws FilenameException
java.io.File
object will be
returned.
Use this method if you need to read a file from a directory.
folder
- sub-directory to look infilename
- filename (user-submitted)defaultExt
- default extension to append if there is noneexts
- list of extensions for file save dialog, null for no filterFilenameException