update 1.2.1

This commit is contained in:
mlus-Asuka 2023-09-29 16:48:23 +08:00
parent 45e13f1199
commit e3a17e5b2a
6 changed files with 13 additions and 10 deletions

View File

@ -2,6 +2,7 @@
This is a Minecraft forge mod using Mysql backend to make player data synchronization between different servers.
Such as equipment,inventory,effects,experience,food level.Any other mods support is also possible.
Support version now:
1.20.1
1.19-1.19.3
1.18.2
1.16.5

View File

@ -4,7 +4,7 @@ plugins {
id 'net.minecraftforge.gradle' version '5.1.+'
}
version = '1.2.0'
version = mod_version
group = 'vip.fubuki.playersync' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'playersync'

View File

@ -1,4 +1,6 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.daemon=false
mod_version=1.19.2-1.2.1

View File

@ -41,7 +41,7 @@ public class PlayerSync
@SubscribeEvent
public void onServerStarting(ServerStartingEvent event) throws SQLException {
JDBCsetUp.executeUpdate("CREATE DATABASE IF NOT EXISTS "+JdbcConfig.DATABASE_NAME.get());
JDBCsetUp.executeUpdate("CREATE DATABASE IF NOT EXISTS "+JdbcConfig.DATABASE_NAME.get(),1);
JDBCsetUp.executeUpdate("CREATE TABLE IF NOT EXISTS player_data (uuid CHAR(36) NOT NULL," +
"inventory MEDIUMBLOB,armor BLOB,advancements BLOB,enderchest MEDIUMBLOB,effects BLOB," +

View File

@ -24,13 +24,16 @@ public class JDBCsetUp {
}
public static int executeUpdate(String sql) throws SQLException{
return executeUpdate(sql,0);
}
public static int executeUpdate(String sql,int init) throws SQLException{
try (Connection connection = getConnection()) {
try (PreparedStatement useStatement = connection.prepareStatement("USE " + JdbcConfig.DATABASE_NAME.get())) {
useStatement.executeUpdate();
if(init==0){
sql="USE " + JdbcConfig.DATABASE_NAME.get() +";" + sql;
}
try (PreparedStatement updateStatement = connection.prepareStatement(sql)) {
return updateStatement.executeUpdate();
}

View File

@ -16,10 +16,7 @@ license="GPL-3.0 license"
[[mods]] #mandatory
# The modid of the mod
modId="playersync" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
# see the associated build.gradle script for how to populate this completely automatically during a build
version="1.2.0" #mandatory
version="${file.jarVersion}" #mandatory
# A display name for the mod
displayName="PlayerSync" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/