Skip to content

Commit 3172fc2

Browse files
committed
Add support for projectiles to break spleef layers (Closes #5)
1 parent 952843a commit 3172fc2

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/main/java/org/battleplugins/arena/spleef/SpleefConfig.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@
88

99
public class SpleefConfig {
1010

11+
@ArenaOption(name = "projectiles-break-blocks", description = "Whether snowballs should break blocks.")
12+
private boolean projectilesBreakBlocks = false;
13+
1114
@ArenaOption(name = "shovels", description = "The shovels for this spleef game.", required = true)
1215
private Map<String, ItemStack> shovels;
1316

17+
public boolean shouldProjectilesBreakBlocks() {
18+
return this.projectilesBreakBlocks;
19+
}
20+
1421
@Nullable
1522
public ItemStack getShovel(String name) {
1623
return this.shovels == null ? null : this.shovels.get(name).clone();

src/main/java/org/battleplugins/arena/spleef/SpleefEventResolvers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public final class SpleefEventResolvers {
3939
return null;
4040
}
4141

42-
if (!egg.hasMetadata("splegg")) {
42+
if (!egg.hasMetadata("splegg") && !ArenaSpleef.getInstance().getMainConfig().shouldProjectilesBreakBlocks()) {
4343
return null;
4444
}
4545

src/main/resources/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
# -----------------
88
config-version: 2.0 # The config version, do not change!
99

10+
# Whether projectiles (i.e. snowballs) should break blocks or not.
11+
projectiles-break-blocks: false
12+
1013
# The shovels to use for Spleef.
1114
shovels:
1215
classic: diamond_shovel{display-name=<yellow>Spleef Shovel}
1316
super-shovel: golden_shovel{display-name=<aqua><bold>Super Spleef Shovel;enchantments=[unbreaking:10,efficiency:5]}
1417
egg-cannon: netherite_shovel{display-name=<gold><bold>Egg Cannon;enchantments=[unbreaking:10,efficiency:5];item-flags=[hide_enchants]}
15-
bow: bow{display-name=<red><bold>Fire Bow;enchantments=[unbreaking:10,infinity:1,flame:1]}
18+
bow: bow{display-name=<red><bold>Fire Bow;enchantments=[unbreaking:10,infinity:1,flame:1]}

0 commit comments

Comments
 (0)