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.github.jsixface:*</include>
|
||||||
<include>com.fasterxml.jackson.dataformat</include>
|
<include>com.fasterxml.jackson.dataformat</include>
|
||||||
<include>com.fasterxml.jackson.core</include>
|
<include>com.fasterxml.jackson.core</include>
|
||||||
|
<include>org.mariadb.jdbc</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
<relocations>
|
<relocations>
|
||||||
|
@ -60,6 +61,10 @@
|
||||||
<pattern>com.fasterxml.jackson.core</pattern>
|
<pattern>com.fasterxml.jackson.core</pattern>
|
||||||
<shadedPattern>net.artelnatif.libs.jackson.core</shadedPattern>
|
<shadedPattern>net.artelnatif.libs.jackson.core</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.mariadb.jdbc</pattern>
|
||||||
|
<shadedPattern>net.artelnatif.libs.mariadb</shadedPattern>
|
||||||
|
</relocation>
|
||||||
</relocations>
|
</relocations>
|
||||||
<minimizeJar>false</minimizeJar>
|
<minimizeJar>false</minimizeJar>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -161,12 +166,6 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.mariadb.jdbc</groupId>
|
|
||||||
<artifactId>mariadb-java-client</artifactId>
|
|
||||||
<version>3.1.0</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
|
|
@ -150,6 +150,7 @@
|
||||||
<include>com.github.jsixface:*</include>
|
<include>com.github.jsixface:*</include>
|
||||||
<include>com.fasterxml.jackson.dataformat</include>
|
<include>com.fasterxml.jackson.dataformat</include>
|
||||||
<include>com.fasterxml.jackson.core</include>
|
<include>com.fasterxml.jackson.core</include>
|
||||||
|
<include>org.mariadb.jdbc</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
<relocations>
|
<relocations>
|
||||||
|
@ -173,6 +174,10 @@
|
||||||
<pattern>com.fasterxml.jackson.core</pattern>
|
<pattern>com.fasterxml.jackson.core</pattern>
|
||||||
<shadedPattern>net.artelnatif.libs.jackson.core</shadedPattern>
|
<shadedPattern>net.artelnatif.libs.jackson.core</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.mariadb.jdbc</pattern>
|
||||||
|
<shadedPattern>net.artelnatif.libs.mariadb</shadedPattern>
|
||||||
|
</relocation>
|
||||||
</relocations>
|
</relocations>
|
||||||
<!-- Prevents breaking AnvilGUI's VersionWrapper. -->
|
<!-- Prevents breaking AnvilGUI's VersionWrapper. -->
|
||||||
<minimizeJar>false</minimizeJar>
|
<minimizeJar>false</minimizeJar>
|
||||||
|
|
|
@ -12,11 +12,11 @@ import java.io.IOException;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class Nicko {
|
public class Nicko {
|
||||||
|
private boolean bungeecord = false;
|
||||||
private ConfigurationManager configManager;
|
private ConfigurationManager configManager;
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
private File dataFolder;
|
private File dataFolder;
|
||||||
private MojangAPI mojangAPI;
|
private MojangAPI mojangAPI;
|
||||||
private boolean bungeecord;
|
|
||||||
private Configuration config;
|
private Configuration config;
|
||||||
|
|
||||||
private PlayerDataStore dataStore;
|
private PlayerDataStore dataStore;
|
||||||
|
@ -24,6 +24,7 @@ public class Nicko {
|
||||||
public void initBungeecord(Plugin bungee) {
|
public void initBungeecord(Plugin bungee) {
|
||||||
logger = bungee.getLogger();
|
logger = bungee.getLogger();
|
||||||
dataFolder = bungee.getDataFolder();
|
dataFolder = bungee.getDataFolder();
|
||||||
|
bungeecord = true;
|
||||||
initNicko();
|
initNicko();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package net.artelnatif.nicko.bungee;
|
||||||
|
|
||||||
import net.artelnatif.nicko.Nicko;
|
import net.artelnatif.nicko.Nicko;
|
||||||
import net.artelnatif.nicko.bungee.event.UpdateMessageListener;
|
import net.artelnatif.nicko.bungee.event.UpdateMessageListener;
|
||||||
import net.artelnatif.nicko.storage.sql.SQLStorageProvider;
|
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
|
|
||||||
public class NickoBungee extends Plugin {
|
public class NickoBungee extends Plugin {
|
||||||
|
@ -21,20 +20,14 @@ public class NickoBungee extends Plugin {
|
||||||
nicko.initBungeecord(this);
|
nicko.initBungeecord(this);
|
||||||
|
|
||||||
getLogger().info("Loading persistence...");
|
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().isError()) {
|
||||||
if (!nicko.getDataStore().getStorage().getProvider().init()) {
|
if (!nicko.getDataStore().getStorage().getProvider().init()) {
|
||||||
getLogger().severe("Failed to open persistence!");
|
getLogger().severe("Failed to load persistence!");
|
||||||
getLogger().severe("Player data transfer is disabled.");
|
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);
|
nicko.setBungeecord(false);
|
||||||
|
onDisable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class PlayerDataStore {
|
||||||
|
|
||||||
public PlayerDataStore(Nicko nicko) {
|
public PlayerDataStore(Nicko nicko) {
|
||||||
this.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) {
|
public void storeName(Player player) {
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
address: "localhost"
|
address: "localhost"
|
||||||
# SQL database's username.
|
# SQL database's username.
|
||||||
# Accepted values: any string
|
# Accepted values: any string
|
||||||
username: ""
|
username: "username"
|
||||||
# SQL database's password.
|
# SQL database's password.
|
||||||
# Accepted values: any string
|
# Accepted values: any string
|
||||||
password: ""
|
password: "password"
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# BUKKIT/SPIGOT #
|
# BUKKIT/SPIGOT #
|
||||||
|
|
Loading…
Reference in a new issue