public class CraftScriptContext extends CraftScriptEnvironment
config, controller, player, server, session| Constructor and Description |
|---|
CraftScriptContext(WorldEdit controller,
ServerInterface server,
LocalConfiguration config,
LocalSession session,
LocalPlayer 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 msg)
Print an error message to the user.
|
BaseBlock |
getBlock(String id)
Get a block.
|
BaseBlock |
getBlock(String arg,
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.
|
LocalPlayer |
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 msg)
Print a regular message to the user.
|
void |
printRaw(String msg)
Print an raw message to the user.
|
EditSession |
remember()
Get an edit session.
|
public CraftScriptContext(WorldEdit controller, ServerInterface server, LocalConfiguration config, LocalSession session, LocalPlayer player, String[] args)
public EditSession remember()
public LocalPlayer getPlayer()
public LocalSession getSession()
public LocalConfiguration getConfiguration()
public List<EditSession> getEditSessions()
public void print(String msg)
msg - public void error(String msg)
msg - public void printRaw(String msg)
msg - public void checkArgs(int min,
int max,
String usage)
throws InsufficientArgumentsException
min - max - -1 for no maximumusage - usage stringInsufficientArgumentsExceptionpublic BaseBlock getBlock(String arg, boolean allAllowed) throws WorldEditException
arg - allAllowed - true to ignore blacklistsUnknownItemExceptionDisallowedItemExceptionWorldEditExceptionpublic BaseBlock getBlock(String id) throws WorldEditException
id - UnknownItemExceptionDisallowedItemExceptionWorldEditExceptionpublic Pattern getBlockPattern(String list) throws WorldEditException
list - UnknownItemExceptionDisallowedItemExceptionWorldEditExceptionpublic Set<Integer> getBlockIDs(String list, boolean allBlocksAllowed) throws WorldEditException
list - allBlocksAllowed - UnknownItemExceptionDisallowedItemExceptionWorldEditException@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.