Class PluginContext
java.lang.Object
me.pauleff.converter.api.PluginContext
Holds shared state for a conversion run and is passed to each
MOOCPlugin.
Created from ParsedArguments, it resolves the server and world folders and
accumulates detection results (server type, folder structure, save format) plus
UUID remappings produced during conversion.
-
Method Summary
Modifier and TypeMethodDescriptionReturns whether this run converts toward online or offline mode.static PluginContextfrom(ParsedArguments parsedArgs) Builds aPluginContextfrom successfully parsed CLI arguments.getTargetUuid(UUID from) Returns the remapped UUID previously stored for the given original UUID.booleanIndicates whether an online/offline conversion was requested on the command line.Returns the parsed CLI arguments for this run.voidputUuidMapping(UUID from, UUID to) Records a UUID remapping from an original player UUID to its converted counterpart.Returns the detected save file format, if set by a detection plugin.Returns the absolute, normalized path to the server root folder.Returns the detected server type, if set by a detection plugin.voidsetSaveFileFormat(SaveFileFormat saveFileFormat) Sets the detected save file format for this conversion run.voidsetServerType(ServerType serverType) Sets the detected server type for this conversion run.voidsetWorldFolderStructure(WorldFolderStructure worldFolderStructure) Sets the detected world folder structure for this conversion run.toString()Returns a string representation of this context for debugging.uuidMap()Returns the live map of original-to-remapped player UUIDs.Returns the path to the world folder resolved fromserver.properties.Returns the detected world folder structure, if set by a detection plugin.
-
Method Details
-
from
Builds aPluginContextfrom successfully parsed CLI arguments.Resolves the server folder (defaulting to the current directory), requires
server.properties, derives the world folder fromlevel-name, and sets the conversion target from the online/offline flags (offline when absent).- Parameters:
parsedArgs- the parsed CLI arguments- Returns:
- a new context ready for plugin execution
- Throws:
PathNotValidException- if the server folder,server.properties, or world folder is missingNullPointerException- ifparsedArgsisnull
-
putUuidMapping
Records a UUID remapping from an original player UUID to its converted counterpart.- Parameters:
from- the original UUIDto- the remapped UUID- Throws:
NullPointerException- iffromortoisnull
-
getTargetUuid
Returns the remapped UUID previously stored for the given original UUID.- Parameters:
from- the original UUID to look up- Returns:
- the remapped UUID, or
nullif no mapping exists - Throws:
NullPointerException- iffromisnull
-
serverFolder
Returns the absolute, normalized path to the server root folder.- Returns:
- the server folder path
-
worldFolder
Returns the path to the world folder resolved fromserver.properties.- Returns:
- the world folder path
-
conversionTarget
Returns whether this run converts toward online or offline mode.- Returns:
- the conversion target
-
serverType
Returns the detected server type, if set by a detection plugin.- Returns:
- the server type, or
nullif not yet detected
-
worldFolderStructure
Returns the detected world folder structure, if set by a detection plugin.- Returns:
- the world folder structure, or
nullif not yet detected
-
saveFileFormat
Returns the detected save file format, if set by a detection plugin.- Returns:
- the save file format, or
nullif not yet detected
-
uuidMap
Returns the live map of original-to-remapped player UUIDs.Mutations via
putUuidMapping(UUID, UUID)are visible through this map.- Returns:
- the UUID remapping map; never
null
-
setServerType
Sets the detected server type for this conversion run.- Parameters:
serverType- the detectedServerType
-
setWorldFolderStructure
Sets the detected world folder structure for this conversion run.- Parameters:
worldFolderStructure- the detectedWorldFolderStructure
-
setSaveFileFormat
Sets the detected save file format for this conversion run.- Parameters:
saveFileFormat- the detectedSaveFileFormat
-
parsedArguments
Returns the parsed CLI arguments for this run.- Returns:
- the
ParsedArgumentsused to build this context
-
isConversionOperation
public boolean isConversionOperation()Indicates whether an online/offline conversion was requested on the command line.- Returns:
trueif a conversion operation was requested;falseotherwise
-
toString
-