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

View File

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

View File

@ -35,7 +35,6 @@ default-playerdata:
attribute-points: 0 attribute-points: 0
attribute-realloc-points: 0 attribute-realloc-points: 0
# The list of all conditions which must be met for the # The list of all conditions which must be met for the
# BLOCK REGEN and BLOCK RESTRICTIONS to apply. Set to # BLOCK REGEN and BLOCK RESTRICTIONS to apply. Set to
# 'custom-mine-conditions: []' to disable custom mining entirely. # 'custom-mine-conditions: []' to disable custom mining entirely.
@ -91,7 +90,6 @@ skill-casting:
mode: SKILL_BAR mode: SKILL_BAR
open: SWAP_HANDS open: SWAP_HANDS
loot-chests: loot-chests:
# Time in seconds it takes for a loot chest to # Time in seconds it takes for a loot chest to
@ -205,6 +203,7 @@ hotbar-swapping:
# in creative mode to enter casting mode # in creative mode to enter casting mode
can-creative-cast: false can-creative-cast: false
# Not implemented yet
ability-targeting-options: ability-targeting-options:
# Prevent heals/buffs on players in a different guild # 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> <description>Offer your players a brand new RPG experience!!</description>
<properties> <properties>
<revision>1.10.2-SNAPSHOT</revision> <revision>1.10.3-SNAPSHOT</revision>
<downloadSources>false</downloadSources> <downloadSources>false</downloadSources>
<downloadJavadocs>false</downloadJavadocs> <downloadJavadocs>false</downloadJavadocs>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -71,4 +71,15 @@
</repositories> </repositories>
<dependencies>
<dependency>
<groupId>io.lumine</groupId>
<artifactId>MythicLib-dist</artifactId>
<version>1.4.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project> </project>