diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..5651668a --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: stargate-rewritten diff --git a/CHANGELOG.md b/CHANGELOG.md index fe4770fb..2dbda3b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changes +#### [Version 1.0.0.17] Stargate-Rewritten + +- Fixed several incompatibilities with the MyWorlds plugin +- Fixed several incompatibilities with hybrid servers. + #### [Version 1.0.0.16] Stargate-Rewritten - Added full support for MineCraft 1.20.X; fixed related bugs introduced by double sided and editable signs. diff --git a/README.md b/README.md index 6653133d..83b89bd2 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,14 @@ > [!WARNING] > -> **THIS IS A TESTING BUILD FROM THE ALPHA CHANNEL!**
->
-> **FOR**: Addon developers, early adopters, and adventure seekers.
-> **ENJOY**: Acccess to experimental features -- your feedback helps determine what makes it to beta.
-> **EXPECT**: Test builds with bugs, incompatible addons, and possible crashes.
+> **THIS IS AN DEVELOPMENT BUILD FROM THE NIGHTLY CHANNEL!** +> +> **FOR**: Stargate developers and contributors. +> **ENJOY**: Access to cutting edge features still under active development. +> **EXPECT**: Crashes, unstable test builds, bugs, incomplete integrations, possible data corruption. > -> **THIS BUILD IS NOT YET SUITABLE FOR USE AT SCALE OR ON MOST PRODUCTION SERVERS**
-> **Use at your own risk, remember to make backups, and please report the bugs you will find!** +> **THIS BUILD IS NOT SUITABLE FOR USE ON PRODUCTION SERVERS OF ANY SORT** +> **Use at your own risk, and remember to make backups!** ![Stargate Banner](https://i.imgur.com/7Ji4jrr.png) diff --git a/pom.xml b/pom.xml index a43a29e6..58114b0c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.sgrewritten stargate - 1.0.0.16-ALPHA + 1.0.0.17-NIGHTLY Stargate The original, and still the best, transportation plugin for the Bukkit Ecosystem. https://sgrewritten.org @@ -182,7 +182,7 @@ - Stargate-${project.version} + Stargate-${project.version}-${git.commit.id.abbrev} org.apache.maven.plugins diff --git a/src/main/java/org/sgrewritten/stargate/migration/DataMigration9.java b/src/main/java/org/sgrewritten/stargate/migration/DataMigration9.java index de9aaa39..5bfc9986 100644 --- a/src/main/java/org/sgrewritten/stargate/migration/DataMigration9.java +++ b/src/main/java/org/sgrewritten/stargate/migration/DataMigration9.java @@ -26,7 +26,7 @@ import java.util.Set; /** - * A data migrator to migrate from 1.0.0.14 to 1.0.0.16 + * A data migrator to migrate from 1.0.0.14 to 1.0.0.17 */ public class DataMigration9 extends DataMigration { private final Properties configConversions = loadConfigConversions("/migration/config-migrations-9.properties"); @@ -44,6 +44,12 @@ public void run(@NotNull SQLDatabaseAPI database, StargateAPI stargateAPI) { } catch (SQLException | IOException e) { Stargate.log(e); } + + try { + new SQLDatabaseMigrator(database, tableNameConfiguration, "/migration/database/v-9", isInterServer).run(); + } catch (SQLException | IOException e) { + Stargate.log(e); + } } @Override diff --git a/src/main/resources/database/sqlite-queries/CREATE_TABLE_INTER_PORTAL_FLAG_RELATION.sql b/src/main/resources/database/sqlite-queries/CREATE_TABLE_INTER_PORTAL_FLAG_RELATION.sql index 4748d09a..d29d8924 100644 --- a/src/main/resources/database/sqlite-queries/CREATE_TABLE_INTER_PORTAL_FLAG_RELATION.sql +++ b/src/main/resources/database/sqlite-queries/CREATE_TABLE_INTER_PORTAL_FLAG_RELATION.sql @@ -19,6 +19,7 @@ CREATE TABLE IF NOT EXISTS {InterPortalFlagRelation} name, network ) - ON UPDATE CASCADE, + ON UPDATE CASCADE + ON DELETE CASCADE, FOREIGN KEY (flag) REFERENCES {Flag} (id) ); \ No newline at end of file diff --git a/src/main/resources/database/sqlite-queries/CREATE_TABLE_INTER_PORTAL_POSITION.sql b/src/main/resources/database/sqlite-queries/CREATE_TABLE_INTER_PORTAL_POSITION.sql index f29f5d36..6cde66e2 100644 --- a/src/main/resources/database/sqlite-queries/CREATE_TABLE_INTER_PORTAL_POSITION.sql +++ b/src/main/resources/database/sqlite-queries/CREATE_TABLE_INTER_PORTAL_POSITION.sql @@ -26,6 +26,7 @@ CREATE TABLE IF NOT EXISTS {InterPortalPosition} name, network ) - ON UPDATE CASCADE, + ON UPDATE CASCADE + ON DELETE CASCADE, FOREIGN KEY (positionType) REFERENCES {PositionType} (id) ); \ No newline at end of file diff --git a/src/main/resources/database/sqlite-queries/CREATE_TABLE_PORTAL_FLAG_RELATION.sql b/src/main/resources/database/sqlite-queries/CREATE_TABLE_PORTAL_FLAG_RELATION.sql index 22fe9e70..dad72f24 100644 --- a/src/main/resources/database/sqlite-queries/CREATE_TABLE_PORTAL_FLAG_RELATION.sql +++ b/src/main/resources/database/sqlite-queries/CREATE_TABLE_PORTAL_FLAG_RELATION.sql @@ -19,6 +19,7 @@ CREATE TABLE IF NOT EXISTS {PortalFlagRelation} name, network ) - ON UPDATE CASCADE, + ON UPDATE CASCADE + ON DELETE CASCADE, FOREIGN KEY (flag) REFERENCES {Flag} (id) ); \ No newline at end of file diff --git a/src/main/resources/database/sqlite-queries/CREATE_TABLE_PORTAL_POSITION.sql b/src/main/resources/database/sqlite-queries/CREATE_TABLE_PORTAL_POSITION.sql index 8ffe14f5..64949a8f 100644 --- a/src/main/resources/database/sqlite-queries/CREATE_TABLE_PORTAL_POSITION.sql +++ b/src/main/resources/database/sqlite-queries/CREATE_TABLE_PORTAL_POSITION.sql @@ -26,6 +26,7 @@ CREATE TABLE IF NOT EXISTS {PortalPosition} name, network ) - ON UPDATE CASCADE, + ON UPDATE CASCADE + ON DELETE CASCADE, FOREIGN KEY (positionType) REFERENCES {PositionType} (id) ); \ No newline at end of file diff --git a/src/main/resources/migration/database/v-9/inter_server/step0.sql b/src/main/resources/migration/database/v-9/inter_server/step0.sql new file mode 100644 index 00000000..94a50c4d --- /dev/null +++ b/src/main/resources/migration/database/v-9/inter_server/step0.sql @@ -0,0 +1,46 @@ +/* + * Add a update on cascade constraint to the InterPortalPosition table + * This is the only way of doing it in sqlite (by recreating the table) + */ + + +CREATE TABLE IF NOT EXISTS {InterPortalPosition}1 +( + portalName NVARCHAR (180) NOT NULL, + networkName NVARCHAR (180) NOT NULL, + xCoordinate INTEGER NOT NULL, + yCoordinate INTEGER NOT NULL, + zCoordinate INTEGER NOT NULL, + positionType INTEGER NOT NULL, + metaData TEXT, + pluginName VARCHAR(255) DEFAULT "Stargate", + PRIMARY KEY + ( + portalName, + networkName, + xCoordinate, + yCoordinate, + zCoordinate + ), + FOREIGN KEY + ( + portalName, + networkName + ) + REFERENCES {InterPortal} + ( + name, + network + ) + ON UPDATE CASCADE + ON DELETE CASCADE, + FOREIGN KEY (positionType) REFERENCES {PositionType} (id) +); + +INSERT INTO {InterPortalPosition}1 SELECT * +FROM + {InterPortalPosition}; + +DROP TABLE {InterPortalPosition}; + +ALTER TABLE {InterPortalPosition}1 RENAME TO {InterPortalPosition}; \ No newline at end of file diff --git a/src/main/resources/migration/database/v-9/inter_server/step1.sql b/src/main/resources/migration/database/v-9/inter_server/step1.sql new file mode 100644 index 00000000..7f6ece60 --- /dev/null +++ b/src/main/resources/migration/database/v-9/inter_server/step1.sql @@ -0,0 +1,42 @@ +/* + * Add a update on cascade constraint to the InterPortalFlagRelation table + * This is the only way of doing it in sqlite (by recreating the table) + */ + +CREATE TABLE IF NOT EXISTS {InterPortalFlagRelation}1 +( + name NVARCHAR (180) NOT NULL, + network NVARCHAR (180) NOT NULL, + flag INTEGER NOT NULL, + PRIMARY KEY + ( + name, + network, + flag + ), + FOREIGN KEY + ( + name, + network + ) + REFERENCES {InterPortal} + ( + name, + network + ) + ON UPDATE CASCADE + ON DELETE CASCADE, + FOREIGN KEY (flag) REFERENCES {Flag} (id) +); + +INSERT INTO {InterPortalFlagRelation}1 SELECT * +FROM + {InterPortalFlagRelation}; + +DROP VIEW {InterPortalView}; + +DROP TABLE {InterPortalFlagRelation}; + +ALTER TABLE {InterPortalFlagRelation}1 RENAME TO {InterPortalFlagRelation}; + +CREATE_VIEW_INTER_PORTAL; \ No newline at end of file diff --git a/src/main/resources/migration/database/v-9/local/step0.sql b/src/main/resources/migration/database/v-9/local/step0.sql new file mode 100644 index 00000000..efd64675 --- /dev/null +++ b/src/main/resources/migration/database/v-9/local/step0.sql @@ -0,0 +1,45 @@ +/* + * Add a update on cascade constraint to the PortalPosition table + * This is the only way of doing it in sqlite (by recreating the table) + */ + +CREATE TABLE IF NOT EXISTS {PortalPosition}1 +( + portalName NVARCHAR (180) NOT NULL, + networkName NVARCHAR (180) NOT NULL, + xCoordinate INTEGER NOT NULL, + yCoordinate INTEGER NOT NULL, + zCoordinate INTEGER NOT NULL, + positionType INTEGER NOT NULL, + metaData TEXT, + pluginName VARCHAR(255) DEFAULT "Stargate", + PRIMARY KEY + ( + portalName, + networkName, + xCoordinate, + yCoordinate, + zCoordinate + ), + FOREIGN KEY + ( + portalName, + networkName + ) + REFERENCES {Portal} + ( + name, + network + ) + ON UPDATE CASCADE + ON DELETE CASCADE, + FOREIGN KEY (positionType) REFERENCES {PositionType} (id) +); + +INSERT INTO {PortalPosition}1 SELECT * +FROM + {PortalPosition}; + +DROP TABLE {PortalPosition}; + +ALTER TABLE {PortalPosition}1 RENAME TO {PortalPosition}; \ No newline at end of file diff --git a/src/main/resources/migration/database/v-9/local/step1.sql b/src/main/resources/migration/database/v-9/local/step1.sql new file mode 100644 index 00000000..12e90286 --- /dev/null +++ b/src/main/resources/migration/database/v-9/local/step1.sql @@ -0,0 +1,42 @@ +/* + * Add a update on cascade constraint to the InterPortalFlagRelation table + * This is the only way of doing it in sqlite (by recreating the table) + */ + +CREATE TABLE IF NOT EXISTS {PortalFlagRelation}1 +( + name NVARCHAR (180) NOT NULL, + network NVARCHAR (180) NOT NULL, + flag INTEGER NOT NULL, + PRIMARY KEY + ( + name, + network, + flag + ), + FOREIGN KEY + ( + name, + network + ) + REFERENCES {Portal} + ( + name, + network + ) + ON UPDATE CASCADE + ON DELETE CASCADE, + FOREIGN KEY (flag) REFERENCES {Flag} (id) +); + +INSERT INTO {PortalFlagRelation}1 SELECT * +FROM + {PortalFlagRelation}; + +DROP VIEW {PortalView}; + +DROP TABLE {PortalFlagRelation}; + +ALTER TABLE {PortalFlagRelation}1 RENAME TO {PortalFlagRelation}; + +CREATE_VIEW_PORTAL; \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index a029d643..6e2e935e 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -6,7 +6,7 @@ authors: [ Knarvik, Thorin, sgrewritten.org/credits ] website: https://sgrewritten.org api-version: 1.20 folia-supported: true -softdepend: [Vault, BKCommonLib, BlockUtil] +softdepend: [Vault, BKCommonLib, BlockUtil, My_Worlds] commands: stargate: description: Used to interact with the Stargate plugin at a system level. diff --git a/src/test/java/org/sgrewritten/stargate/migration/SQLDatabaseMigratorTest.java b/src/test/java/org/sgrewritten/stargate/migration/SQLDatabaseMigratorTest.java index 605231da..356ca7ec 100644 --- a/src/test/java/org/sgrewritten/stargate/migration/SQLDatabaseMigratorTest.java +++ b/src/test/java/org/sgrewritten/stargate/migration/SQLDatabaseMigratorTest.java @@ -18,11 +18,12 @@ class SQLDatabaseMigratorTest { - private SQLDatabaseMigrator databaseMigrator; + private SQLDatabaseMigrator databaseMigrator7; private SQLiteDatabase database; private TableNameConfiguration nameConfiguration; private static final File sqlDatabaseFile = new File("src/test/resources", "alpha-1_0_0_11.db"); private static final File oldSqlDatabaseFile = new File("src/test/resources", "alpha-1_0_0_11.old"); + private SQLDatabaseMigrator databaseMigrator9; @BeforeEach void setUp() throws SQLException, IOException { @@ -31,7 +32,8 @@ void setUp() throws SQLException, IOException { database = new SQLiteDatabase(sqlDatabaseFile); nameConfiguration = new TableNameConfiguration("", ""); - databaseMigrator = new SQLDatabaseMigrator(database, nameConfiguration, "/migration/database/v-7", true); + databaseMigrator7 = new SQLDatabaseMigrator(database, nameConfiguration, "/migration/database/v-7", true); + databaseMigrator9 = new SQLDatabaseMigrator(database, nameConfiguration, "/migration/database/v-9", true); } @AfterEach @@ -43,7 +45,8 @@ void tearDown() { // CHECK IF THE UPDATE ON CASCADE OPTION IS THERE, BY LOOKING AT THE BEHAVIOR @Test void renamePortalPosition() throws SQLException, IOException { - databaseMigrator.run(); + databaseMigrator7.run(); + databaseMigrator9.run(); renamePortal(nameConfiguration.getPortalTableName()); try (Connection connection = database.getConnection()) { SQLTestHelper.checkIfHasNot(nameConfiguration.getPortalPositionTableName(), "portal", "network", @@ -54,7 +57,8 @@ void renamePortalPosition() throws SQLException, IOException { @Test void renameInterPortalPosition() throws SQLException, IOException { - databaseMigrator.run(); + databaseMigrator7.run(); + databaseMigrator9.run(); renamePortal(nameConfiguration.getInterPortalTableName()); try (Connection connection = database.getConnection()) { SQLTestHelper.checkIfHasNot(nameConfiguration.getInterPortalPositionTableName(), "portal", "network", @@ -66,7 +70,8 @@ void renameInterPortalPosition() throws SQLException, IOException { @Test void renamePortalFlag() throws SQLException, IOException { - databaseMigrator.run(); + databaseMigrator7.run(); + databaseMigrator9.run(); renamePortal(nameConfiguration.getPortalTableName()); try (Connection connection = database.getConnection()) { SQLTestHelper.checkIfHasNot(nameConfiguration.getFlagRelationTableName(), "portal", "network", connection); @@ -76,7 +81,8 @@ void renamePortalFlag() throws SQLException, IOException { @Test void renameInterPortalFlag() throws SQLException, IOException { - databaseMigrator.run(); + databaseMigrator7.run(); + databaseMigrator9.run(); renamePortal(nameConfiguration.getInterPortalTableName()); try (Connection connection = database.getConnection()) { SQLTestHelper.checkIfHasNot(nameConfiguration.getInterFlagRelationTableName(), "portal", "network", @@ -88,7 +94,8 @@ void renameInterPortalFlag() throws SQLException, IOException { @Test void portalPosition_checkPluginName() throws SQLException, IOException { - databaseMigrator.run(); + databaseMigrator7.run(); + databaseMigrator9.run(); try (Connection connection = database.getConnection()) { SQLTestHelper.checkIfColumnIs(nameConfiguration.getPortalPositionTableName(), "pluginName", "portal", "network", "Stargate", connection); }