public class CraftScriptContext extends CraftScriptEnvironment
config, controller, player, server, session| Constructor and Description |
|---|
CraftScriptContext(WorldEdit controller,
Platform server,
LocalConfiguration config,
LocalSession session,
Player player,
String[] args) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkArgs(int min,
int max,
String usage)
Checks to make sure that there are enough but not too many arguments.
|
void |
error(String message)
Print an error message to the user.
|
BaseBlock |
getBlock(String id)
Get a block.
|
BaseBlock |
getBlock(String input,
boolean allAllowed)
Get an item ID from an item name or an item ID number.
|
Set<Integer> |
getBlockIDs(String list,
boolean allBlocksAllowed)
Get a list of blocks as a set.
|
Pattern |
getBlockPattern(String list)
Get a list of blocks as a set.
|
LocalConfiguration |
getConfiguration()
Get the configuration for WorldEdit.
|
List<EditSession> |
getEditSessions()
Get a list of edit sessions that have been created.
|
Player |
getPlayer()
Get the player.
|
File |
getSafeFile(String folder,
String filename)
Deprecated.
|
File |
getSafeOpenFile(String folder,
String filename,
String defaultExt,
String... exts)
Gets the path to a file for opening.
|
File |
getSafeSaveFile(String folder,
String filename,
String defaultExt,
String... exts)
Gets the path to a file for saving.
|
LocalSession |
getSession()
Get the player's session.
|
void |
print(String message)
Print a regular message to the user.
|
void |
printRaw(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, String[] args)
public EditSession remember()
public Player getPlayer()
public LocalSession getSession()
public LocalConfiguration getConfiguration()
public List<EditSession> getEditSessions()
EditSessionspublic void print(String message)
message - a messagepublic void error(String message)
message - a messagepublic void printRaw(String message)
message - a messagepublic void checkArgs(int min,
int max,
String usage)
throws InsufficientArgumentsException
min - a number of argumentsmax - -1 for no maximumusage - usage stringInsufficientArgumentsExceptionpublic BaseBlock getBlock(String input, boolean allAllowed) throws WorldEditException
input - input to parseallAllowed - true to ignore blacklistsUnknownItemExceptionDisallowedItemExceptionWorldEditExceptionpublic BaseBlock getBlock(String id) throws WorldEditException
id - the type IdUnknownItemExceptionDisallowedItemExceptionWorldEditExceptionpublic Pattern getBlockPattern(String list) throws WorldEditException
list - the inputUnknownItemExceptionDisallowedItemExceptionWorldEditExceptionpublic Set<Integer> getBlockIDs(String list, boolean allBlocksAllowed) throws WorldEditException
list - a listallBlocksAllowed - true if all blocks are allowedUnknownItemExceptionDisallowedItemExceptionWorldEditException@Deprecated public File getSafeFile(String folder, String filename) 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)FilenameExceptionpublic File getSafeOpenFile(String folder, String filename, String defaultExt, 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 filterFilenameExceptionpublic File getSafeSaveFile(String folder, String filename, String defaultExt, 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 filterFilenameExceptionCopyright © 2010-2014. All Rights Reserved.