Merge remote-tracking branch 'origin/master'

# Conflicts:
#	pom.xml
This commit is contained in:
Ka0rX 2022-08-27 15:23:23 +02:00
commit 75265356ee
5 changed files with 58 additions and 82 deletions

View File

@ -149,13 +149,6 @@
</dependency>
<!-- Plugin dependencies -->
<dependency>
<groupId>io.lumine</groupId>
<artifactId>MythicLib-dist</artifactId>
<version>1.4.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.lumine</groupId>
<artifactId>Mythic-Dist</artifactId>

View File

@ -13,6 +13,14 @@ public class MySQLDataProvider extends MMODataSource implements DataProvider {
private final MySQLPlayerDataManager playerManager = new MySQLPlayerDataManager(this);
private final YAMLGuildDataManager guildManager = new YAMLGuildDataManager();
private static final String[] NEW_COLUMNS = new String[]{
"times_claimed", "LONGTEXT",
"is_saved", "TINYINT",
"skill_reallocation_points", "INT(11)",
"skill_tree_reallocation_points", "INT(11)",
"skill_tree_points", "LONGTEXT",
"skill_tree_levels", "LONGTEXT"};
public MySQLDataProvider(FileConfiguration config) {
this.setup(config);
}
@ -21,72 +29,44 @@ public class MySQLDataProvider extends MMODataSource implements DataProvider {
public void load() {
// Fully create table
executeUpdateAsync(
"CREATE TABLE IF NOT EXISTS mmocore_playerdata(uuid VARCHAR(36),class_points "
+ "INT(11) DEFAULT 0,skill_points INT(11) DEFAULT 0,attribute_points INT(11) "
+ "DEFAULT 0,attribute_realloc_points INT(11) DEFAULT 0,skill_reallocation_points INT(11) DEFAULT 0,level INT(11) DEFAULT 1,"
+ "experience INT(11) DEFAULT 0,class VARCHAR(20),guild VARCHAR(20),last_login LONG,"
+ "attributes LONGTEXT,professions LONGTEXT,times_claimed LONGTEXT,quests LONGTEXT,"
+ "waypoints LONGTEXT,friends LONGTEXT,skills LONGTEXT,bound_skills LONGTEXT,"
+ "class_info LONGTEXT, is_saved TINYINT, PRIMARY KEY (uuid));");
executeUpdateAsync("CREATE TABLE IF NOT EXISTS mmocore_playerdata(uuid VARCHAR(36)," +
"class_points INT(11) DEFAULT 0," +
"skill_points INT(11) DEFAULT 0," +
"attribute_points INT(11) DEFAULT 0," +
"attribute_realloc_points INT(11) DEFAULT 0," +
"skill_reallocation_points INT(11) DEFAULT 0," +
"skill_tree_reallocation_points INT(11) DEFAULT 0," +
"skill_tree_points LONGTEXT," +
"skill_tree_levels LONGTEXT," +
"level INT(11) DEFAULT 1," +
"experience INT(11) DEFAULT 0," +
"class VARCHAR(20),guild VARCHAR(20)," +
"last_login LONG," +
"attributes LONGTEXT," +
"professions LONGTEXT," +
"times_claimed LONGTEXT," +
"quests LONGTEXT," +
"waypoints LONGTEXT," +
"friends LONGTEXT," +
"skills LONGTEXT," +
"bound_skills LONGTEXT," +
"class_info LONGTEXT," +
"is_saved TINYINT," +
"PRIMARY KEY (uuid));");
// Add 'times_claimed' if it doesn't exist
getResultAsync("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = 'mmocore_playerdata' AND COLUMN_NAME = 'times_claimed'", result -> {
// Add columns that might not be here by default
for (int i = 0; i < NEW_COLUMNS.length; i += 2) {
final String columnName = NEW_COLUMNS[i];
final String dataType = NEW_COLUMNS[i + 1];
getResultAsync("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = 'mmocore_playerdata' AND COLUMN_NAME = '" + columnName + "'", result -> {
try {
if (!result.next())
executeUpdateAsync("ALTER TABLE mmocore_playerdata ADD COLUMN times_claimed LONGTEXT");
executeUpdate("ALTER TABLE mmocore_playerdata ADD COLUMN " + columnName + " " + dataType);
} catch (SQLException exception) {
exception.printStackTrace();
}
});
// Add 'is_saved' if it doesn't exist
getResultAsync("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = 'mmocore_playerdata' AND COLUMN_NAME = 'is_saved'", result -> {
try {
if (!result.next())
executeUpdate("ALTER TABLE mmocore_playerdata ADD COLUMN is_saved TINYINT");
} catch (SQLException exception) {
exception.printStackTrace();
}
});
// Add 'skill_reallocation_points' if it doesn't exist
getResultAsync("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = 'mmocore_playerdata' AND COLUMN_NAME = 'skill_reallocation_points'", result -> {
try {
if (!result.next())
executeUpdate("ALTER TABLE mmocore_playerdata ADD COLUMN skill_reallocation_points INT(11)");
} catch (SQLException exception) {
exception.printStackTrace();
}
});
// Add 'skill_tree_reallocation_points' if it doesn't exist
getResultAsync("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = 'mmocore_playerdata' AND COLUMN_NAME = 'skill_tree_reallocation_points'", result -> {
try {
if (!result.next())
executeUpdate("ALTER TABLE mmocore_playerdata ADD COLUMN skill_tree_reallocation_points INT(11)");
} catch (SQLException exception) {
exception.printStackTrace();
}
});
// Add 'skill_tree_points' if it doesn't exist
getResultAsync("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = 'mmocore_playerdata' AND COLUMN_NAME = 'skill_tree_points'", result -> {
try {
if (!result.next())
executeUpdate("ALTER TABLE mmocore_playerdata ADD COLUMN skill_tree_points LONGTEXT");
} catch (SQLException exception) {
exception.printStackTrace();
}
});
// Add 'skill_tree_levels' if it doesn't exist
getResultAsync("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = 'mmocore_playerdata' AND COLUMN_NAME = 'skill_tree_levels'", result -> {
try {
if (!result.next())
executeUpdate("ALTER TABLE mmocore_playerdata ADD COLUMN skill_tree_levels LONGTEXT");
} catch (SQLException exception) {
exception.printStackTrace();
}
});
}
@Override

View File

@ -119,13 +119,6 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.lumine</groupId>
<artifactId>MythicLib-dist</artifactId>
<version>1.3.4-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -35,7 +35,6 @@ default-playerdata:
attribute-points: 0
attribute-realloc-points: 0
# The list of all conditions which must be met for the
# BLOCK REGEN and BLOCK RESTRICTIONS to apply. Set to
# 'custom-mine-conditions: []' to disable custom mining entirely.
@ -91,7 +90,6 @@ skill-casting:
mode: SKILL_BAR
open: SWAP_HANDS
loot-chests:
# Time in seconds it takes for a loot chest to
@ -205,6 +203,7 @@ hotbar-swapping:
# in creative mode to enter casting mode
can-creative-cast: false
# Not implemented yet
ability-targeting-options:
# Prevent heals/buffs on players in a different guild

13
pom.xml
View File

@ -16,7 +16,7 @@
<description>Offer your players a brand new RPG experience!!</description>
<properties>
<revision>1.10.2-SNAPSHOT</revision>
<revision>1.10.3-SNAPSHOT</revision>
<downloadSources>false</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -71,4 +71,15 @@
</repositories>
<dependencies>
<dependency>
<groupId>io.lumine</groupId>
<artifactId>MythicLib-dist</artifactId>
<version>1.4.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>