Skip to main content
The FactoriesManager provides methods to register custom factory implementations and create various game objects like islands, players, positions, and transactions.

Factory Registration

registerIslandsFactory

Register a custom islands factory.
void registerIslandsFactory(@Nullable IslandsFactory islandsFactory)
islandsFactory
IslandsFactory
The new factory to set. If set to null, the default factory will be used.
Example:
FactoriesManager manager = plugin.getFactoriesManager();
manager.registerIslandsFactory(new CustomIslandsFactory());

getIslandsFactory

Get the current islands factory.
IslandsFactory getIslandsFactory()
return
IslandsFactory
The current islands factory instance.

registerPlayersFactory

Register a custom players factory.
void registerPlayersFactory(@Nullable PlayersFactory playersFactory)
playersFactory
PlayersFactory
The new factory to set. If set to null, the default factory will be used.

getPlayersFactory

Get the current players factory.
PlayersFactory getPlayersFactory()
return
PlayersFactory
The current players factory instance.

registerBanksFactory

Register a custom banks factory.
void registerBanksFactory(@Nullable BanksFactory banksFactory)
banksFactory
BanksFactory
The new factory to set. If set to null, the default factory will be used.

getBanksFactory

Get the current banks factory.
BanksFactory getBanksFactory()
return
BanksFactory
The current banks factory instance.

registerDatabaseBridgeFactory

Register a custom database-bridge factory.
void registerDatabaseBridgeFactory(@Nullable DatabaseBridgeFactory databaseBridgeFactory)
databaseBridgeFactory
DatabaseBridgeFactory
The new factory to set. If set to null, the default factory will be used.

getDatabaseBridgeFactory

Get the database bridge factory.
DatabaseBridgeFactory getDatabaseBridgeFactory()
return
DatabaseBridgeFactory
The database bridge factory instance.

Island Creation

createIsland

Create a new Island object.
This island is not saved into the database unless inserting it manually!
Island createIsland(@Nullable SuperiorPlayer owner, UUID uuid, Location center, String islandName, String schemName)
owner
SuperiorPlayer
The owner of the island.
uuid
UUID
The uuid of the island.
center
Location
The location of the island.
islandName
String
The name of the island.
schemName
String
The schematic used to create the island.
return
Island
The newly created island instance.
Example:
FactoriesManager manager = plugin.getFactoriesManager();
SuperiorPlayer player = plugin.getPlayersManager().getSuperiorPlayer(uuid);
Location center = new Location(world, 0, 100, 0);

Island island = manager.createIsland(
    player,
    UUID.randomUUID(),
    center,
    "MyIsland",
    "default"
);

createIslandBuilder

Create a new builder for an Island object.
Island.Builder createIslandBuilder()
return
Island.Builder
A new island builder instance.
Example:
Island.Builder builder = manager.createIslandBuilder()
    .setOwner(player)
    .setUniqueId(UUID.randomUUID())
    .setCenter(location)
    .setName("MyIsland")
    .setSchematicName("default");

Island island = builder.build();

Player Creation

createPlayer

Create a new SuperiorPlayer object.
This player is not saved into the database unless inserting it manually!
SuperiorPlayer createPlayer(UUID playerUUID)
playerUUID
UUID
The uuid of the player.
return
SuperiorPlayer
The newly created player instance.

createPlayerBuilder

Create a new builder for a SuperiorPlayer object.
SuperiorPlayer.Builder createPlayerBuilder()
return
SuperiorPlayer.Builder
A new player builder instance.

Position Objects

createBlockOffset

Create a BlockOffset object from given offsets.
BlockOffset createBlockOffset(int offsetX, int offsetY, int offsetZ)
offsetX
int
The x-coords offset.
offsetY
int
The y-coords offset.
offsetZ
int
The z-coords offset.
return
BlockOffset
The created block offset.
Example:
BlockOffset offset = manager.createBlockOffset(5, 10, -3);

createBlockPosition (with coordinates)

Create a BlockPosition object from given block coordinates.
BlockPosition createBlockPosition(int blockX, int blockY, int blockZ)
blockX
int
The x-coords of the block.
blockY
int
The y-coords of the block.
blockZ
int
The z-coords of the block.
return
BlockPosition
The created block position.

createBlockPosition (from Location)

Create a BlockPosition object from a location.
BlockPosition createBlockPosition(Location location)
location
Location
The location.
return
BlockPosition
The created block position.
Example:
BlockPosition position = manager.createBlockPosition(player.getLocation());

createWorldPosition (with coordinates)

Create a WorldPosition object from given world coordinates.
WorldPosition createWorldPosition(double x, double y, double z)
x
double
The x-coords of the position.
y
double
The y-coords of the position.
z
double
The z-coords of the position.
return
WorldPosition
The created world position.

createWorldPosition (with rotation)

Create a WorldPosition object from given world coordinates with rotation.
WorldPosition createWorldPosition(double x, double y, double z, float yaw, float pitch)
x
double
The x-coords of the position.
y
double
The y-coords of the position.
z
double
The z-coords of the position.
yaw
float
The yaw of the position.
pitch
float
The pitch of the position.
return
WorldPosition
The created world position.

createWorldPosition (from Location)

Create a WorldPosition object from a location.
WorldPosition createWorldPosition(Location location)
location
Location
The location.
return
WorldPosition
The created world position.

Transaction Objects

createTransaction

Create a new bank transaction.
BankTransaction createTransaction(@Nullable UUID player, BankAction action, int position,
                                  long time, String failureReason, BigDecimal amount)
player
UUID
The player that made the transaction. Can be null if console made it.
action
BankAction
The transaction action.
position
int
The position of the transaction.
time
long
The time the transaction was made.
failureReason
String
The reason of failure for this transaction, if exists. On successful transactions, empty string should be set.
amount
BigDecimal
The amount of money that was transferred in this transaction.
return
BankTransaction
The created bank transaction.
Example:
BankTransaction transaction = manager.createTransaction(
    player.getUniqueId(),
    BankAction.DEPOSIT,
    0,
    System.currentTimeMillis(),
    "",
    new BigDecimal("1000.00")
);

World and Sound Objects

createWorldInfo

Create a new world info.
WorldInfo createWorldInfo(String worldName, Dimension dimension)
worldName
String
The name of the world.
dimension
Dimension
The dimension of the world.
return
WorldInfo
The created world info.

createGameSound

Create a new game sound instance.
GameSound createGameSound(Sound sound, float volume, float pitch)
sound
Sound
The sound to play.
volume
float
The volume to play the sound.
pitch
float
The pitch to play the sound.
return
GameSound
The created game sound.
Example:
GameSound sound = manager.createGameSound(Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 1.0f);

Schematic Options

createSchematicOptionsBuilder

Create a new builder for a SchematicOptions object.
SchematicOptions.Builder createSchematicOptionsBuilder(String schematicName)
schematicName
String
The name of the schematic to create.
return
SchematicOptions.Builder
A new schematic options builder.
Example:
SchematicOptions.Builder builder = manager.createSchematicOptionsBuilder("default")
    .setOffset(offset)
    .setIgnoreAir(true);

SchematicOptions options = builder.build();