Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha #384

Closed
wants to merge 5 commits into from
Closed

Alpha #384

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: stargate-rewritten
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

> [!WARNING]
>
> **THIS IS A TESTING BUILD FROM THE ALPHA CHANNEL!**<br>
> <br>
> **FOR**: Addon developers, early adopters, and adventure seekers.<br>
> **ENJOY**: Acccess to experimental features -- your feedback helps determine what makes it to beta.<br>
> **EXPECT**: Test builds with bugs, incompatible addons, and possible crashes.<br>
> **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**<BR>
> **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)
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.sgrewritten</groupId>
<artifactId>stargate</artifactId>
<version>1.0.0.16-ALPHA</version>
<version>1.0.0.17-NIGHTLY</version>
<name>Stargate</name>
<description>The original, and still the best, transportation plugin for the Bukkit Ecosystem.</description>
<url>https://sgrewritten.org</url>
Expand Down Expand Up @@ -182,7 +182,7 @@
</dependency>
</dependencies>
<build>
<finalName>Stargate-${project.version}</finalName>
<finalName>Stargate-${project.version}-${git.commit.id.abbrev}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
46 changes: 46 additions & 0 deletions src/main/resources/migration/database/v-9/inter_server/step0.sql
Original file line number Diff line number Diff line change
@@ -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};
42 changes: 42 additions & 0 deletions src/main/resources/migration/database/v-9/inter_server/step1.sql
Original file line number Diff line number Diff line change
@@ -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;
45 changes: 45 additions & 0 deletions src/main/resources/migration/database/v-9/local/step0.sql
Original file line number Diff line number Diff line change
@@ -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};
42 changes: 42 additions & 0 deletions src/main/resources/migration/database/v-9/local/step1.sql
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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);
Expand All @@ -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",
Expand All @@ -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);
}
Expand Down
Loading