public class WorldEdit extends Object
An instance handles event handling; block, mask, pattern, etc. registration;
the management of sessions; the creation of EditSessions; and more.
In order to use WorldEdit, at least one Platform must be registered
with WorldEdit using PlatformManager.register(Platform) on the
manager retrieved using getPlatformManager().
An instance of WorldEdit can be retrieved using the static
method getInstance(), which is shared among all
platforms within the same classloader hierarchy.
| Modifier and Type | Method and Description |
|---|---|
void |
checkMaxBrushRadius(double radius)
Checks to see if the specified brush radius is within bounds.
|
void |
checkMaxRadius(double radius)
Checks to see if the specified radius is within bounds.
|
void |
clearSessions()
Deprecated.
|
void |
flushBlockBag(Actor actor,
EditSession editSession)
Flush a block bag's changes to a player.
|
BaseBlock |
getBlock(Player player,
String id)
Deprecated.
|
BaseBlock |
getBlock(Player player,
String arg,
boolean allAllowed)
Deprecated.
|
BaseBlock |
getBlock(Player player,
String arg,
boolean allAllowed,
boolean allowNoData)
Deprecated.
|
BlockFactory |
getBlockFactory()
Get the block factory from which new
BaseBlocks can be
constructed. |
Set<Integer> |
getBlockIDs(Player player,
String list,
boolean allBlocksAllowed)
Deprecated.
|
Mask |
getBlockMask(Player player,
LocalSession session,
String input)
Deprecated.
|
Pattern |
getBlockPattern(Player player,
String input)
Deprecated.
|
Set<BaseBlock> |
getBlocks(Player player,
String list)
Deprecated.
|
Set<BaseBlock> |
getBlocks(Player player,
String list,
boolean allAllowed)
Deprecated.
|
Set<BaseBlock> |
getBlocks(Player player,
String list,
boolean allAllowed,
boolean allowNoData)
Deprecated.
|
LocalConfiguration |
getConfiguration()
Get Worldedit's configuration.
|
Vector |
getDiagonalDirection(Player player,
String dirStr)
Get diagonal direction vector for a player's direction.
|
Vector |
getDirection(Player player,
String dirStr)
Get the direction vector for a player's direction.
|
EditSessionFactory |
getEditSessionFactory()
Get a factory for
EditSessions. |
EventBus |
getEventBus()
Get the event bus for WorldEdit.
|
CuboidClipboard.FlipDirection |
getFlipDirection(Player player,
String dirStr)
Get the flip direction for a player's direction.
|
static WorldEdit |
getInstance()
Gets the current instance of this class.
|
MaskFactory |
getMaskFactory()
Get the mask factory from which new
Masks
can be constructed. |
PatternFactory |
getPatternFactory()
Get the pattern factory from which new
Patterns
can be constructed. |
PlatformManager |
getPlatformManager()
Get the platform manager, where platforms (that implement WorldEdit)
can be registered and information about registered platforms can
be queried.
|
File |
getSafeOpenFile(Player player,
File dir,
String filename,
String defaultExt,
String... extensions)
Gets the path to a file.
|
File |
getSafeSaveFile(Player player,
File dir,
String filename,
String defaultExt,
String... extensions)
Gets the path to a file.
|
ServerInterface |
getServer()
Get the server interface.
|
LocalSession |
getSession(Player player)
Deprecated.
|
LocalSession |
getSession(String player)
Deprecated.
|
SessionManager |
getSessionManager()
Return the session manager.
|
static String |
getVersion()
Get the version.
|
File |
getWorkingDirectoryFile(String path)
Get a file relative to the defined working directory.
|
boolean |
handleArmSwing(Player player)
Called on arm swing.
|
boolean |
handleBlockLeftClick(Player player,
WorldVector clicked)
Called on left click.
|
boolean |
handleBlockRightClick(Player player,
WorldVector clicked)
Called on right click.
|
boolean |
handleRightClick(Player player)
Called on right click (not on a block).
|
boolean |
hasSession(Player player)
Deprecated.
|
void |
removeSession(Player player)
Deprecated.
|
void |
runScript(Player player,
File f,
String[] args)
Executes a WorldEdit script.
|
void |
setEditSessionFactory(EditSessionFactory factory)
Deprecated.
EditSessionFactories are no longer used. Please register an
EditSessionEvent event
with the event bus in order to override or catch changes to the world |
static void |
setVersion(String version)
Deprecated.
Declare your platform version with
Platform.getPlatformVersion() |
public static final Logger logger
public static WorldEdit getInstance()
An instance will always be available, but no platform may yet be registered with WorldEdit, meaning that a number of operations may fail. However, event handlers can be registered.
public PlatformManager getPlatformManager()
public EventBus getEventBus()
Event handlers can be registered on the event bus.
public BlockFactory getBlockFactory()
BaseBlocks can be
constructed.public MaskFactory getMaskFactory()
Masks
can be constructed.public PatternFactory getPatternFactory()
Patterns
can be constructed.public SessionManager getSessionManager()
@Deprecated public LocalSession getSession(String player)
getSessionManager()@Deprecated public LocalSession getSession(Player player)
getSessionManager()@Deprecated public void removeSession(Player player)
getSessionManager()@Deprecated public void clearSessions()
getSessionManager()@Deprecated public boolean hasSession(Player player)
getSessionManager()@Deprecated public BaseBlock getBlock(Player player, String arg, boolean allAllowed) throws WorldEditException
getBlockFactory() and AbstractFactory.parseFromInput(String, ParserContext)WorldEditException@Deprecated public BaseBlock getBlock(Player player, String arg, boolean allAllowed, boolean allowNoData) throws WorldEditException
getBlockFactory() and AbstractFactory.parseFromInput(String, ParserContext)WorldEditException@Deprecated public BaseBlock getBlock(Player player, String id) throws WorldEditException
getBlockFactory() and AbstractFactory.parseFromInput(String, ParserContext)WorldEditException@Deprecated public Set<BaseBlock> getBlocks(Player player, String list, boolean allAllowed, boolean allowNoData) throws WorldEditException
getBlockFactory() and BlockFactory.parseFromListInput(String, ParserContext)WorldEditException@Deprecated public Set<BaseBlock> getBlocks(Player player, String list, boolean allAllowed) throws WorldEditException
getBlockFactory() and AbstractFactory.parseFromInput(String, ParserContext)WorldEditException@Deprecated public Set<BaseBlock> getBlocks(Player player, String list) throws WorldEditException
getBlockFactory() and BlockFactory.parseFromListInput(String, ParserContext)WorldEditException@Deprecated public Set<Integer> getBlockIDs(Player player, String list, boolean allBlocksAllowed) throws WorldEditException
getBlockFactory() and BlockFactory.parseFromListInput(String, ParserContext)WorldEditException@Deprecated public Pattern getBlockPattern(Player player, String input) throws WorldEditException
getPatternFactory() and AbstractFactory.parseFromInput(String, ParserContext)WorldEditException@Deprecated public Mask getBlockMask(Player player, LocalSession session, String input) throws WorldEditException
getMaskFactory() ()} and AbstractFactory.parseFromInput(String, ParserContext)WorldEditExceptionpublic File getSafeSaveFile(Player player, File dir, String filename, String defaultExt, String... extensions) throws FilenameException
java.io.File object will be returned.player - the playerdir - sub-directory to look infilename - filename (user-submitted)defaultExt - append an extension if missing one, null to not useextensions - list of extensions, null for anyFilenameException - thrown if the filename is invalidpublic File getSafeOpenFile(Player player, File dir, String filename, String defaultExt, String... extensions) throws FilenameException
java.io.File object will be returned.player - the playerdir - sub-directory to look infilename - filename (user-submitted)defaultExt - append an extension if missing one, null to not useextensions - list of extensions, null for anyFilenameException - thrown if the filename is invalidpublic void checkMaxRadius(double radius)
throws MaxRadiusException
radius - the radiusMaxRadiusExceptionpublic void checkMaxBrushRadius(double radius)
throws MaxBrushRadiusException
radius - the radiusMaxBrushRadiusExceptionpublic File getWorkingDirectoryFile(String path)
path - the subpath under the working directorypublic Vector getDirection(Player player, String dirStr) throws UnknownDirectionException
player - the playerdirStr - the direction stringUnknownDirectionException - thrown if the direction is not knownpublic Vector getDiagonalDirection(Player player, String dirStr) throws UnknownDirectionException
player - the playerdirStr - the direction stringUnknownDirectionException - thrown if the direction is not knownpublic CuboidClipboard.FlipDirection getFlipDirection(Player player, String dirStr) throws UnknownDirectionException
player - the playerdirStr - the direction stringUnknownDirectionException - thrown if the direction is not knownpublic void flushBlockBag(Actor actor, EditSession editSession)
actor - the actoreditSession - the edit sessionpublic boolean handleArmSwing(Player player)
player - the playerpublic boolean handleRightClick(Player player)
player - the playerpublic boolean handleBlockRightClick(Player player, WorldVector clicked)
player - the playerclicked - the clicked blockpublic boolean handleBlockLeftClick(Player player, WorldVector clicked)
player - the playerclicked - the clicked blockpublic void runScript(Player player, File f, String[] args) throws WorldEditException
player - the playerf - the script file to executeargs - arguments for the scriptWorldEditExceptionpublic LocalConfiguration getConfiguration()
public ServerInterface getServer()
public EditSessionFactory getEditSessionFactory()
EditSessions.@Deprecated public void setEditSessionFactory(EditSessionFactory factory)
EditSessionEvent event
with the event bus in order to override or catch changes to the worldpublic static String getVersion()
@Deprecated public static void setVersion(String version)
Platform.getPlatformVersion()Copyright © 2010-2014. All Rights Reserved.