Skip to content

Commit e7bf1fd

Browse files
authored
Merge pull request #6 from BentoBoxWorld/develop
Release 1.1.0
2 parents a51037d + 1386c82 commit e7bf1fd

File tree

9 files changed

+87
-34
lines changed

9 files changed

+87
-34
lines changed

pom.xml

+17-17
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@
4646
<properties>
4747
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4848
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
49-
<java.version>17</java.version>
50-
<powermock.version>1.7.4</powermock.version>
49+
<java.version>21</java.version>
50+
<powermock.version>2.0.9</powermock.version>
5151
<!-- More visible way how to change dependency versions -->
52-
<spigot.version>1.19-R0.1-SNAPSHOT</spigot.version>
52+
<spigot.version>1.21.1-R0.1-SNAPSHOT</spigot.version>
5353
<!-- BentoBox API version -->
5454
<bentobox.version>1.20.0</bentobox.version>
5555
<!-- Revision variable removes warning about dynamic version -->
5656
<revision>${build.version}-SNAPSHOT</revision>
5757
<!-- This allows to change between versions and snapshots. -->
58-
<build.version>1.0.0</build.version>
58+
<build.version>1.1.0</build.version>
5959
<build.number>-LOCAL</build.number>
6060
</properties>
6161

@@ -94,7 +94,7 @@
9494
<!-- Override only if necessary -->
9595
<revision>${build.version}</revision>
9696
<!-- Empties build.number value -->
97-
<build.number></build.number>
97+
<build.number/>
9898
</properties>
9999
</profile>
100100
<profile>
@@ -108,7 +108,7 @@
108108
<plugin>
109109
<groupId>org.sonarsource.scanner.maven</groupId>
110110
<artifactId>sonar-maven-plugin</artifactId>
111-
<version>3.6.0.1398</version>
111+
<version>4.0.0.4121</version>
112112
<executions>
113113
<execution>
114114
<phase>verify</phase>
@@ -154,7 +154,7 @@
154154
<dependency>
155155
<groupId>org.jetbrains</groupId>
156156
<artifactId>annotations</artifactId>
157-
<version>22.0.0</version>
157+
<version>24.1.0</version>
158158
</dependency>
159159
</dependencies>
160160

@@ -191,12 +191,12 @@
191191
<plugin>
192192
<groupId>org.apache.maven.plugins</groupId>
193193
<artifactId>maven-resources-plugin</artifactId>
194-
<version>3.1.0</version>
194+
<version>3.3.1</version>
195195
</plugin>
196196
<plugin>
197197
<groupId>org.apache.maven.plugins</groupId>
198198
<artifactId>maven-compiler-plugin</artifactId>
199-
<version>3.7.0</version>
199+
<version>3.13.0</version>
200200
<configuration>
201201
<source>${java.version}</source>
202202
<target>${java.version}</target>
@@ -205,17 +205,17 @@
205205
<plugin>
206206
<groupId>org.apache.maven.plugins</groupId>
207207
<artifactId>maven-surefire-plugin</artifactId>
208-
<version>2.22.0</version>
208+
<version>3.5.0</version>
209209
</plugin>
210210
<plugin>
211211
<groupId>org.apache.maven.plugins</groupId>
212212
<artifactId>maven-jar-plugin</artifactId>
213-
<version>3.1.0</version>
213+
<version>3.4.2</version>
214214
</plugin>
215215
<plugin>
216216
<groupId>org.apache.maven.plugins</groupId>
217217
<artifactId>maven-javadoc-plugin</artifactId>
218-
<version>3.0.1</version>
218+
<version>3.10.0</version>
219219
<configuration>
220220
<show>public</show>
221221
<failOnError>false</failOnError>
@@ -233,7 +233,7 @@
233233
<plugin>
234234
<groupId>org.apache.maven.plugins</groupId>
235235
<artifactId>maven-source-plugin</artifactId>
236-
<version>3.0.1</version>
236+
<version>3.3.1</version>
237237
<executions>
238238
<execution>
239239
<id>attach-sources</id>
@@ -246,12 +246,12 @@
246246
<plugin>
247247
<groupId>org.apache.maven.plugins</groupId>
248248
<artifactId>maven-install-plugin</artifactId>
249-
<version>2.5.2</version>
249+
<version>3.1.3</version>
250250
</plugin>
251251
<plugin>
252252
<groupId>org.apache.maven.plugins</groupId>
253253
<artifactId>maven-shade-plugin</artifactId>
254-
<version>3.3.1-SNAPSHOT</version>
254+
<version>3.6.0</version>
255255
<configuration>
256256
<minimizeJar>true</minimizeJar>
257257
<artifactSet>
@@ -282,12 +282,12 @@
282282
<plugin>
283283
<groupId>org.apache.maven.plugins</groupId>
284284
<artifactId>maven-deploy-plugin</artifactId>
285-
<version>2.8.2</version>
285+
<version>3.1.3</version>
286286
</plugin>
287287
<plugin>
288288
<groupId>org.jacoco</groupId>
289289
<artifactId>jacoco-maven-plugin</artifactId>
290-
<version>0.8.10</version>
290+
<version>0.8.12</version>
291291
<configuration>
292292
<append>true</append>
293293
<excludes>

src/main/java/world/bentobox/farmersdance/FarmersDanceAddon.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import org.bukkit.Bukkit;
1010
import org.bukkit.Material;
11-
import org.bukkit.event.Listener;
1211

1312
import world.bentobox.bentobox.api.addons.Addon;
1413
import world.bentobox.bentobox.api.configuration.Config;
@@ -40,6 +39,7 @@ public void onLoad()
4039
this.saveDefaultConfig();
4140

4241
this.settings = new Config<>(this, Settings.class).loadConfigObject();
42+
this.saveSettings();
4343

4444
if (this.settings == null)
4545
{
@@ -73,12 +73,12 @@ public void onEnable()
7373
if (this.settings.isLazyDancing())
7474
{
7575
this.dancingHandler = new LazyDancingListener(this);
76-
this.registerListener((Listener) this.dancingHandler);
76+
this.registerListener(this.dancingHandler);
7777
}
7878
else
7979
{
8080
this.dancingHandler = new FastDancingListener(this);
81-
this.registerListener((Listener) this.dancingHandler);
81+
this.registerListener(this.dancingHandler);
8282
}
8383
}
8484

@@ -125,7 +125,9 @@ public void onReload()
125125
public void onDisable()
126126
{
127127
// Stop all running tasks.
128-
this.dancingHandler.stopTasks();
128+
if (this.dancingHandler != null) {
129+
this.dancingHandler.stopTasks();
130+
}
129131
}
130132

131133

src/main/java/world/bentobox/farmersdance/FarmersDancePladdon.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@
1313

1414
public class FarmersDancePladdon extends Pladdon
1515
{
16+
17+
private FarmersDanceAddon addon;
18+
1619
@Override
1720
public Addon getAddon()
1821
{
19-
return new FarmersDanceAddon();
22+
if (addon == null) {
23+
addon = new FarmersDanceAddon();
24+
}
25+
return addon;
2026
}
2127
}

src/main/java/world/bentobox/farmersdance/configs/Settings.java

+31-2
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,28 @@ public void setGrowBerries(boolean growBerries)
460460
}
461461

462462

463+
/**
464+
* Is grow spore blossom boolean.
465+
*
466+
* @return the boolean
467+
*/
468+
public boolean isGrowSporeBlossom()
469+
{
470+
return this.growSporeBlossom;
471+
}
472+
473+
474+
/**
475+
* Sets grow spore blossom.
476+
*
477+
* @param growSporeBlossom the grow spore blossom
478+
*/
479+
public void setGrowSporeBlossom(boolean growSporeBlossom)
480+
{
481+
this.growSporeBlossom = growSporeBlossom;
482+
}
483+
484+
463485
/**
464486
* Gets maximal cactus size.
465487
*
@@ -614,7 +636,7 @@ public void setMaximalSugarCaneSize(int maximalSugarCaneSize)
614636
private boolean growVines = true;
615637

616638
@ConfigComment("")
617-
@ConfigComment("Toggles if dancing will affect tall flowers.")
639+
@ConfigComment("Toggles if dancing will affect tall flowers and pink petals.")
618640
@ConfigComment("It means that tall flowers will drop their item, like using bone meal.")
619641
@ConfigComment("Default value = true.")
620642
@ConfigEntry(path = "groups.grow-tall-flowers")
@@ -647,6 +669,13 @@ public void setMaximalSugarCaneSize(int maximalSugarCaneSize)
647669
@ConfigEntry(path = "groups.grow-berries")
648670
private boolean growBerries = true;
649671

672+
@ConfigComment("")
673+
@ConfigComment("Toggles if dancing will affect spore blossoms.")
674+
@ConfigComment("Dancing near spore blossoms will drop new spore blossom.")
675+
@ConfigComment("Default value = false.")
676+
@ConfigEntry(path = "groups.spore-blossoms")
677+
private boolean growSporeBlossom = true;
678+
650679
@ConfigComment("")
651680
@ConfigComment("The maximal cactus size that it can grow to.")
652681
@ConfigComment("Default value = 3.")
@@ -657,5 +686,5 @@ public void setMaximalSugarCaneSize(int maximalSugarCaneSize)
657686
@ConfigComment("The maximal sugar cane size that it can grow to.")
658687
@ConfigComment("Default value = 3.")
659688
@ConfigEntry(path = "size.sugar-cane-size")
660-
private int maximalSugarCaneSize;
689+
private int maximalSugarCaneSize = 3;
661690
}

src/main/java/world/bentobox/farmersdance/listeners/DancingHandler.java

+16-6
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void stopTasks()
5555
* @param world World where dancing happens.
5656
* @param player The player who triggers dancing.
5757
*/
58-
protected void buildTask(final World world, final Player player)
58+
protected void buildTask(final World world, final @NotNull Player player)
5959
{
6060
boolean growSaplings = this.addon.getSettings().isGrowSaplings();
6161
boolean growCrops = this.addon.getSettings().isGrowCrops();
@@ -70,6 +70,7 @@ protected void buildTask(final World world, final Player player)
7070
boolean growKelpAndDripLeaf = this.addon.getSettings().isGrowKelpAndDripLeaf();
7171
boolean growChorusFlower = this.addon.getSettings().isGrowChorusFlower();
7272
boolean growBerries = this.addon.getSettings().isGrowBerries();
73+
boolean growSporeBlossom = this.addon.getSettings().isGrowSporeBlossom();
7374

7475
final int xRange = this.addon.getSettings().getAffectRadius();
7576
final int zRange = this.addon.getSettings().getAffectRadius();
@@ -84,7 +85,7 @@ protected void buildTask(final World world, final Player player)
8485
{
8586
Block block = world.getBlockAt(
8687
location.getBlockX() + this.random.nextInt(xRange * 2 + 1) - xRange,
87-
location.getBlockY() + this.random.nextInt(yRange * 2 + 1) - yRange,
88+
(int) Math.round(location.getY()) + this.random.nextInt(yRange * 2 + 1) - yRange,
8889
location.getBlockZ() + this.random.nextInt(zRange * 2 + 1) - zRange);
8990

9091
if (Tag.SAPLINGS.isTagged(block.getType()) ||
@@ -142,7 +143,7 @@ else if (Material.PUMPKIN_STEM.equals(block.getType()) || Material.MELON_STEM.eq
142143

143144
if (!blockList.isEmpty())
144145
{
145-
Block newPlant = blockList.iterator().next();
146+
Block newPlant = blockList.getFirst();
146147

147148
if (Material.PUMPKIN_STEM.equals(block.getType()))
148149
{
@@ -167,7 +168,7 @@ else if (Tag.CROPS.isTagged(block.getType()))
167168
this.spawnParticle(block.getLocation());
168169
}
169170
}
170-
else if (Tag.TALL_FLOWERS.isTagged(block.getType()))
171+
else if (Tag.TALL_FLOWERS.isTagged(block.getType()) || Material.PINK_PETALS.equals(block.getType()))
171172
{
172173
if (growTallFlowers)
173174
{
@@ -232,7 +233,7 @@ else if (Material.CACTUS.equals(block.getType()) || Material.SUGAR_CANE.equals(b
232233
rootBlock = rootBlock.getRelative(BlockFace.DOWN);
233234
}
234235

235-
int height = 1;
236+
int height = 0;
236237

237238
// Get max height based on block data.
238239
int maxHeight = Material.CACTUS.equals(block.getType()) ?
@@ -351,6 +352,15 @@ else if (Material.CHORUS_FLOWER.equals(block.getType()))
351352
}
352353
}
353354
}
355+
else if (Material.SPORE_BLOSSOM.equals(block.getType()))
356+
{
357+
if (growSporeBlossom)
358+
{
359+
// Apply bone meal to spore blossom
360+
block.getDrops().forEach(drop -> block.getWorld().dropItemNaturally(block.getLocation().add(0.5, 0.5, 0.5), drop));
361+
this.spawnParticle(block.getLocation());
362+
}
363+
}
354364
}
355365
}
356366

@@ -361,7 +371,7 @@ else if (Material.CHORUS_FLOWER.equals(block.getType()))
361371
*/
362372
private void spawnParticle(@NotNull Location location)
363373
{
364-
Objects.requireNonNull(location.getWorld()).spawnParticle(Particle.VILLAGER_HAPPY,
374+
Objects.requireNonNull(location.getWorld()).spawnParticle(Particle.HAPPY_VILLAGER,
365375
location.add(0.5, 0.5, 0.5),
366376
20,
367377
0.3D,

src/main/java/world/bentobox/farmersdance/listeners/LazyDancingListener.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.bukkit.event.player.PlayerToggleSneakEvent;
1616
import org.bukkit.scheduler.BukkitTask;
1717

18+
import org.jetbrains.annotations.NotNull;
1819
import world.bentobox.bentobox.util.Util;
1920
import world.bentobox.farmersdance.FarmersDanceAddon;
2021

@@ -40,7 +41,7 @@ public LazyDancingListener(FarmersDanceAddon addon)
4041
* @param event Player Toggle Sneak Event.
4142
*/
4243
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
43-
public void onDancing(PlayerToggleSneakEvent event)
44+
public void onDancing(@NotNull PlayerToggleSneakEvent event)
4445
{
4546
Player player = event.getPlayer();
4647
World world = player.getWorld();

src/main/resources/addon.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ main: world.bentobox.farmersdance.FarmersDanceAddon
55
# Version of your addon. Can use maven variables.
66
version: ${version}
77
# API version allows to specify minimal BentoBox version for your addon.
8-
api-version: 1.20.0
8+
api-version: 2.4.0
99
# Allow to send metric about this addon usage.
1010
metrics: true
1111
# GitHub version check. Will work only for GitHub.

src/main/resources/config.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ groups:
8282
# Default value = true.
8383
grow-vines: true
8484
#
85-
# Toggles if dancing will affect tall flowers.
85+
# Toggles if dancing will affect tall flowers and pink petals.
8686
# It means that tall flowers will drop their item, like using bone meal.
8787
# Default value = true.
8888
grow-tall-flowers: true
@@ -105,6 +105,11 @@ groups:
105105
# Dancing near berries will produce berries.
106106
# Default value = true.
107107
grow-berries: true
108+
#
109+
# Toggles if dancing will affect spore blossoms.
110+
# Dancing near spore blossoms will drop new spore blossom.
111+
# Default value = true.
112+
grow-spore-blossoms: false
108113
size:
109114
# The maximal cactus size that it can grow to.
110115
# Default value = 3.

src/main/resources/plugin.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: BentoBox-FarmersDance
22
main: world.bentobox.farmersdance.FarmersDancePladdon
33
version: ${project.version}${build.number}
4-
api-version: "1.19"
4+
api-version: "1.21"
55

66
authors: [BONNe]
77
contributors: ["The BentoBoxWorld Community"]

0 commit comments

Comments
 (0)