Skip to content

Commit

Permalink
Merge pull request #11 from BONNePlayground/develop
Browse files Browse the repository at this point in the history
Add 1.19.3 support
  • Loading branch information
BONNe authored Dec 23, 2022
2 parents 1563491 + d6a1979 commit 2d67e83
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 13 deletions.
18 changes: 14 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
<java.version>17</java.version>
<powermock.version>1.7.4</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.19-R0.1-SNAPSHOT</spigot.version>
<spigot.version>1.19.3-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.20.0</bentobox.version>
<level.version>2.5.0</level.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- This allows to change between versions and snapshots. -->
<build.version>1.4.3</build.version>
<build.version>1.4.4</build.version>
<build.number>-LOCAL</build.number>
</properties>

Expand Down Expand Up @@ -116,6 +116,10 @@
<name>GitHub BONNe Apache Maven Packages</name>
<url>https://maven.pkg.github.com/BONNePlayground/DragonFightsLibrary</url>
</repository>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repositories>

<distributionManagement>
Expand Down Expand Up @@ -172,7 +176,7 @@
<dependency>
<groupId>io.github.iltotore</groupId>
<artifactId>customentity</artifactId>
<version>1.4.1</version>
<version>1.4.3</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -190,7 +194,13 @@
<dependency>
<groupId>lv.id.bonne</groupId>
<artifactId>dragonfights-v1_19_r1</artifactId>
<version>1.4.2</version>
<version>1.4.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>lv.id.bonne</groupId>
<artifactId>dragonfights-v1_19_r2</artifactId>
<version>1.4.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public Collection<BiomeSpawn> getSpawns(ServerVersion version)
{
this.setVersion(ServerVersion.v1_18_1, lv.id.bonne.dragonfights.v1_18_R1.entity.BentoBoxEnderDragonType::new);
this.setVersion(ServerVersion.v1_18_2, lv.id.bonne.dragonfights.v1_18_R2.entity.BentoBoxEnderDragonType::new);
this.setVersion(ServerVersion.v1_19, lv.id.bonne.dragonfights.v1_19_R1.entity.BentoBoxEnderDragonType::new);
this.setVersion(ServerVersion.v1_19_1, lv.id.bonne.dragonfights.v1_19_R1.entity.BentoBoxEnderDragonType::new);
this.setVersion(ServerVersion.v1_19_2, lv.id.bonne.dragonfights.v1_19_R2.entity.BentoBoxEnderDragonType::new);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public static NMSHandler getAPI()
{
versions.put(ServerVersion.v1_18_1, lv.id.bonne.dragonfights.v1_18_R1.NMSHandler::new);
versions.put(ServerVersion.v1_18_2, lv.id.bonne.dragonfights.v1_18_R2.NMSHandler::new);
versions.put(ServerVersion.v1_19, lv.id.bonne.dragonfights.v1_19_R1.NMSHandler::new);
versions.put(ServerVersion.v1_19_1, lv.id.bonne.dragonfights.v1_19_R1.NMSHandler::new);
versions.put(ServerVersion.v1_19_2, lv.id.bonne.dragonfights.v1_19_R2.NMSHandler::new);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.Database;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.util.Util;


/**
Expand Down Expand Up @@ -118,17 +119,27 @@ public void load()
{
DragonBattleBuilder builder =
CustomEntityAPI.getAPI().createDragonBattleBuilder(dragonFightsObject.getUniqueId());
builder.setWorld(dragonFightsObject.getWorld());

CustomDragonBattle customDragonBattle =
builder.buildFromNBT(dragonFightsObject.getLatestBattleData());
// Fixes a crash when addon tries to load in non-existing world.
if (this.addon.getAddonManager().operatesInWorld(dragonFightsObject.getWorld()))
{
builder.setWorld(dragonFightsObject.getWorld());

CustomDragonBattle customDragonBattle =
builder.buildFromNBT(dragonFightsObject.getLatestBattleData());

this.generatedBattles.put(dragonFightsObject.getUniqueId(), customDragonBattle);
this.generatedBattles.put(dragonFightsObject.getUniqueId(), customDragonBattle);

if (customDragonBattle != null)
if (customDragonBattle != null)
{
// Start the battle with 5 sec delay.
this.startBattleTask(dragonFightsObject, customDragonBattle, 20 * 5);
}
}
else
{
// Start the battle with 5 sec delay.
this.startBattleTask(dragonFightsObject, customDragonBattle, 20 * 5);
// remove fight from cache.
this.dragonFightsCache.remove(dragonFightsObject.getUniqueId());
}
}
});
Expand Down

0 comments on commit 2d67e83

Please sign in to comment.