... | @@ -7,6 +7,7 @@ Unlike most of my projects, BungeeUtilisals has a fairly high documentation (at |
... | @@ -7,6 +7,7 @@ Unlike most of my projects, BungeeUtilisals has a fairly high documentation (at |
|
## Table of content: ##
|
|
## Table of content: ##
|
|
* [How to create a BossBar](#how-to-create-a-bossbar)
|
|
* [How to create a BossBar](#how-to-create-a-bossbar)
|
|
* [Configuration API](#configuration-api)
|
|
* [Configuration API](#configuration-api)
|
|
|
|
* [Language Integration](#language-integration)
|
|
|
|
|
|
## How to create a BossBar ##
|
|
## How to create a BossBar ##
|
|
For all IBossBar methods, please check [our Javadoc](https://docs.dbsoftwares.eu/BungeeUtilisals/com/dbsoftwares/bungeeutilisals/api/bossbar/IBossBar.html).
|
|
For all IBossBar methods, please check [our Javadoc](https://docs.dbsoftwares.eu/BungeeUtilisals/com/dbsoftwares/bungeeutilisals/api/bossbar/IBossBar.html).
|
... | @@ -108,3 +109,35 @@ YAML: |
... | @@ -108,3 +109,35 @@ YAML: |
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
|
|
## Language Integration ##
|
|
|
|
BungeeUtilisals has a built in way of handling languages through the BungeeUtilisals Users database.
|
|
|
|
But as some networks have their own way of handling languages (if they have them), they might want to implement their own language (selection).
|
|
|
|
|
|
|
|
Which is why the Language Integration API has been made. It makes it possible for external developers to integrate their own way of fetching language for a certain UUID.
|
|
|
|
|
|
|
|
The code below basically tells the Language API to fetch the language from the **lang** column in the **users** table.
|
|
|
|
|
|
|
|
**How to register custom language fetching?**:
|
|
|
|
```java
|
|
|
|
ILanguageManager langManager = BUCore.getApi().getLanguageManager();
|
|
|
|
|
|
|
|
langManager.setLanguageIntegration(uuid -> {
|
|
|
|
Language language = null;
|
|
|
|
|
|
|
|
try (Connection connection = database.getConnection()) {
|
|
|
|
PreparedStatement pstmt = connection.prepareStatement("SELECT lang FROM users WHERE uuid = ?;");
|
|
|
|
pstmt.setString(1, uuid.toString());
|
|
|
|
|
|
|
|
try (ResultSet rs = pstmt.executeQuery()) {
|
|
|
|
if (rs.next()) {
|
|
|
|
language = langManager.getLangOrDefault(rs.getString("lang"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (SQLException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
|
|
|
|
return language == null ? langManager.getDefaultLanguage() : language;
|
|
|
|
});
|
|
|
|
``` |
|
|
|
\ No newline at end of file |