feat(bungee): force sql
This commit is contained in:
parent
8c59dae6ae
commit
273ffb28ec
6 changed files with 20 additions and 22 deletions
|
@ -37,6 +37,7 @@
|
|||
<include>com.github.jsixface:*</include>
|
||||
<include>com.fasterxml.jackson.dataformat</include>
|
||||
<include>com.fasterxml.jackson.core</include>
|
||||
<include>org.mariadb.jdbc</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
|
@ -60,6 +61,10 @@
|
|||
<pattern>com.fasterxml.jackson.core</pattern>
|
||||
<shadedPattern>net.artelnatif.libs.jackson.core</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.mariadb.jdbc</pattern>
|
||||
<shadedPattern>net.artelnatif.libs.mariadb</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<minimizeJar>false</minimizeJar>
|
||||
</configuration>
|
||||
|
@ -161,12 +166,6 @@
|
|||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
|
|
|
@ -150,6 +150,7 @@
|
|||
<include>com.github.jsixface:*</include>
|
||||
<include>com.fasterxml.jackson.dataformat</include>
|
||||
<include>com.fasterxml.jackson.core</include>
|
||||
<include>org.mariadb.jdbc</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
|
@ -173,6 +174,10 @@
|
|||
<pattern>com.fasterxml.jackson.core</pattern>
|
||||
<shadedPattern>net.artelnatif.libs.jackson.core</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.mariadb.jdbc</pattern>
|
||||
<shadedPattern>net.artelnatif.libs.mariadb</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<!-- Prevents breaking AnvilGUI's VersionWrapper. -->
|
||||
<minimizeJar>false</minimizeJar>
|
||||
|
|
|
@ -12,11 +12,11 @@ import java.io.IOException;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
public class Nicko {
|
||||
private boolean bungeecord = false;
|
||||
private ConfigurationManager configManager;
|
||||
private Logger logger;
|
||||
private File dataFolder;
|
||||
private MojangAPI mojangAPI;
|
||||
private boolean bungeecord;
|
||||
private Configuration config;
|
||||
|
||||
private PlayerDataStore dataStore;
|
||||
|
@ -24,6 +24,7 @@ public class Nicko {
|
|||
public void initBungeecord(Plugin bungee) {
|
||||
logger = bungee.getLogger();
|
||||
dataFolder = bungee.getDataFolder();
|
||||
bungeecord = true;
|
||||
initNicko();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.artelnatif.nicko.bungee;
|
|||
|
||||
import net.artelnatif.nicko.Nicko;
|
||||
import net.artelnatif.nicko.bungee.event.UpdateMessageListener;
|
||||
import net.artelnatif.nicko.storage.sql.SQLStorageProvider;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
public class NickoBungee extends Plugin {
|
||||
|
@ -21,20 +20,14 @@ public class NickoBungee extends Plugin {
|
|||
nicko.initBungeecord(this);
|
||||
|
||||
getLogger().info("Loading persistence...");
|
||||
if (!(nicko.getDataStore().getStorage().getProvider() instanceof SQLStorageProvider)) {
|
||||
getLogger().severe("Nicko does not support local storage in combination with Bungeecord.");
|
||||
getLogger().severe("The plugin will not continue.");
|
||||
nicko.getDataStore().getStorage().setError(true);
|
||||
nicko.setBungeecord(false);
|
||||
onDisable();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!nicko.getDataStore().getStorage().isError()) {
|
||||
if (!nicko.getDataStore().getStorage().getProvider().init()) {
|
||||
getLogger().severe("Failed to open persistence!");
|
||||
getLogger().severe("Player data transfer is disabled.");
|
||||
getLogger().severe("Failed to load persistence!");
|
||||
getLogger().severe("Nicko can't enable BungeeCord support without SQL storage.");
|
||||
getLogger().severe("The plugin will not continue.");
|
||||
nicko.getDataStore().getStorage().setError(true);
|
||||
nicko.setBungeecord(false);
|
||||
onDisable();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class PlayerDataStore {
|
|||
|
||||
public PlayerDataStore(Nicko nicko) {
|
||||
this.nicko = nicko;
|
||||
this.storage = nicko.getConfig().local() ? new JSONStorage(nicko) : new SQLStorage(nicko);
|
||||
this.storage = nicko.getConfig().local() && !nicko.isBungeecord() ? new JSONStorage(nicko) : new SQLStorage(nicko);
|
||||
}
|
||||
|
||||
public void storeName(Player player) {
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
address: "localhost"
|
||||
# SQL database's username.
|
||||
# Accepted values: any string
|
||||
username: ""
|
||||
username: "username"
|
||||
# SQL database's password.
|
||||
# Accepted values: any string
|
||||
password: ""
|
||||
password: "password"
|
||||
|
||||
#################
|
||||
# BUKKIT/SPIGOT #
|
||||
|
|
Loading…
Reference in a new issue