Skip to content

Commit

Permalink
Merge pull request #7 from BONNePlayground/develop
Browse files Browse the repository at this point in the history
Release 1.4.2
  • Loading branch information
BONNe authored Jun 17, 2022
2 parents 49c2442 + 01fd92a commit b15ce20
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 6 deletions.
18 changes: 12 additions & 6 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.18.2-R0.1-SNAPSHOT</spigot.version>
<spigot.version>1.19-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.1</build.version>
<build.version>1.4.2</build.version>
<build.number>-LOCAL</build.number>
</properties>

Expand Down Expand Up @@ -133,7 +133,7 @@
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>22.0.0</version>
<version>23.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -172,19 +172,25 @@
<dependency>
<groupId>io.github.iltotore</groupId>
<artifactId>customentity</artifactId>
<version>1.3.1</version>
<version>1.4.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>lv.id.bonne</groupId>
<artifactId>dragonfights-v1_18_r1</artifactId>
<version>1.3.1</version>
<version>1.4.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>lv.id.bonne</groupId>
<artifactId>dragonfights-v1_18_r2</artifactId>
<version>1.3.1</version>
<version>1.4.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>lv.id.bonne</groupId>
<artifactId>dragonfights-v1_19_r1</artifactId>
<version>1.4.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/lv/id/bonne/dragonfights/config/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,28 @@ public void setBattleSeed(long battleSeed)
}


/**
* Gets number of path points.
*
* @return the number of path points
*/
public int getNumberOfPathPoints()
{
return numberOfPathPoints;
}


/**
* Sets number of path points.
*
* @param numberOfPathPoints the number of path points
*/
public void setNumberOfPathPoints(int numberOfPathPoints)
{
this.numberOfPathPoints = Math.max(4, numberOfPathPoints);
}


// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------
Expand Down Expand Up @@ -324,6 +346,12 @@ public void setBattleSeed(long battleSeed)
@ConfigEntry(path = "battle.tower-count")
private int towerCount = 12;

@ConfigComment("Number of inner path points for dragon to fly between towers and end trophy generated for the battle.")
@ConfigComment("It is recommended to set it to the half of the tower numbers, but never less than 4.")
@ConfigComment("Default value is 6. Minimal value is 4.")
@ConfigEntry(path = "battle.inner-path-point-count")
private int numberOfPathPoints = 6;

@ConfigComment("Distance from portal till the towers.")
@ConfigComment("Default value is 40.")
@ConfigEntry(path = "battle.tower-distance")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ 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);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ public void onFirstEndJoin(PlayerChangedWorldEvent event)

Island island = islandOptional.get();

if (island.getCenter().getBlockX() == 0 && island.getCenter().getBlockZ() == 0)
{
// Dragon should not operate for 0, 0 island because that spot is reserved for
// vanilla ender dragon.
return;
}

if (island.getRank(User.getInstance(event.getPlayer())) < RanksManager.MEMBER_RANK)
{
// Only island members should activate the battle.
Expand Down Expand Up @@ -182,6 +189,13 @@ public void onCrystalPlacement(EntitySpawnEvent event)

Island island = optionalIsland.get();

if (island.getCenter().getBlockX() == 0 && island.getCenter().getBlockZ() == 0)
{
// Dragon should not operate for 0, 0 island because that spot is reserved for
// vanilla ender dragon.
return;
}

Optional<CustomDragonBattle> optionalBattle =
this.addonManager.getDragonBattle(island.getUniqueId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ public CustomDragonBattle createDragonBattle(World world, Island island)
dragonBattleBuilder.setBattleSeed(this.addon.getSettings().getBattleSeed());
dragonBattleBuilder.setNumberOfTowers(this.addon.getSettings().getTowerCount());
dragonBattleBuilder.setNumberOfProtectedTowers(this.addon.getSettings().getNumberOfProtectedTowers());
dragonBattleBuilder.setNumberOfPathPoints(this.addon.getSettings().getNumberOfPathPoints());
dragonBattleBuilder.setMaxTowerHeight(this.addon.getSettings().getMaxTowerHeight());
dragonBattleBuilder.setMinTowerHeight(this.addon.getSettings().getMinTowerHeight());
dragonBattleBuilder.setDistanceTillTowers(this.addon.getSettings().getTowerDistance());
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ battle:
# Number of towers generated for the battle.
# Default value is 12.
tower-count: 12
# Number of inner path points for dragon to fly between towers and end trophy generated for the battle.
# It is recommended to set it to the half of the tower numbers, but never less than 4.
# Default value is 6. Minimal value is 4.
inner-path-point-count: 6
# Distance from portal till the towers.
# Default value is 40.
tower-distance: 40
Expand Down

0 comments on commit b15ce20

Please sign in to comment.