Klasse Database
java.lang.Object
de.delinkedde.mobarenareborn.persistence.Database
Owns the SQLite connection and applies the schema.
A single connection is kept open for the lifetime of the plugin. The driver is bundled and
relocated, so no external dependency is required at runtime; it is resolved through the JDBC
service loader by the jdbc:sqlite: URL.
The schema is created on connect() if absent. Statements are executed
synchronously; callers that run on the main server thread should keep queries small or defer
them to an asynchronous task.
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidclose()Closes the connection if open.voidconnect()Opens the connection and ensures the schema exists.@NotNull Connectionstatic @NotNull DatabaseforDataFolder(@NotNull File dataFolder) Creates a database backed byplayerdata.dbinside the given data folder.
-
Konstruktordetails
-
Database
- Parameter:
jdbcUrl- the JDBC URL, for examplejdbc:sqlite:/path/playerdata.dborjdbc:sqlite::memory:
-
-
Methodendetails
-
forDataFolder
Creates a database backed byplayerdata.dbinside the given data folder.- Parameter:
dataFolder- the plugin data folder- Gibt zurück:
- a new, unconnected database
-
connect
Opens the connection and ensures the schema exists.- Löst aus:
SQLException- if the connection cannot be opened or the schema cannot be applied
-
close
public void close()Closes the connection if open. Safe to call more than once. -
connection
- Gibt zurück:
- the open connection
- Löst aus:
IllegalStateException- ifconnect()has not been called
-