From c88f20c46f591dfd99d7c6dba51f733ad15dbbad Mon Sep 17 00:00:00 2001 From: Andreas Troelsen Date: Sun, 13 Feb 2022 00:27:34 +0100 Subject: [PATCH] Add per-arena setting `auto-ignite-fuse`. This new setting allows changing the fuse time for auto-ignited TNT, which is normally a hardcoded 80 ticks in Minecraft. Note the somewhat weak safeguarding without any sort of error message - with great power comes great responsibility... Closes #715 --- changelog.md | 1 + src/main/java/com/garbagemule/MobArena/ArenaListener.java | 3 +++ src/main/resources/res/settings.yml | 1 + 3 files changed, 5 insertions(+) diff --git a/changelog.md b/changelog.md index 4851ef7..a12f2b9 100644 --- a/changelog.md +++ b/changelog.md @@ -17,6 +17,7 @@ These changes will (most likely) be included in the next version. - Pet names are now per-class configurable via the optional `pet-name` property, which defaults to `'s pet` (the `` variable is also supported). - New per-arena setting `auto-leave-on-end` can be used to automatically "kick" spectators when the current session ends. - New per-arena setting `clear-wave-leeway` allows for tweaking the number of mobs allowed to be alive before the next wave spawns. The setting affects `clear-wave-before-next`, `clear-wave-before-boss`, and the final wave check, and it defaults to 0. +- New per-arena setting `auto-ignite-fuse` makes the fuse time for auto-ignited TNT configurable. The unit is ticks and defaults to 80. - Added boss abilities `disorient-all`, `fetch-all`, `pull-all`, and `throw-all`. These abilities work like their target-specific and distance-based counterparts, but affect all players in the arena. - (API) MobArena's internal command handler now supports registering pre-instantiated subcommand instances. This should make it easier for extensions to avoid the Singleton anti-pattern for command dependencies. - (API) MobArena now fires MobArenaPreReloadEvent and MobArenaReloadEvent before and after, respectively, reloading its config-file. This should allow extensions and other plugins to better respond to configuration changes. diff --git a/src/main/java/com/garbagemule/MobArena/ArenaListener.java b/src/main/java/com/garbagemule/MobArena/ArenaListener.java index 3e157a3..6c7efce 100644 --- a/src/main/java/com/garbagemule/MobArena/ArenaListener.java +++ b/src/main/java/com/garbagemule/MobArena/ArenaListener.java @@ -123,6 +123,7 @@ public class ArenaListener private boolean allowTeleport, canShare, autoIgniteTNT; + private int autoIgniteFuse; private Set banned; @@ -146,6 +147,7 @@ public class ArenaListener this.allowTeleport = s.getBoolean("allow-teleporting", false); this.canShare = s.getBoolean("share-items-in-arena", true); this.autoIgniteTNT = s.getBoolean("auto-ignite-tnt", false); + this.autoIgniteFuse = s.getInt("auto-ignite-fuse", 80); this.useClassChests = s.getBoolean("use-class-chests", false); this.classLimits = arena.getClassLimitManager(); @@ -284,6 +286,7 @@ public class ArenaListener stack.setAmount(stack.getAmount() - 1); TNTPrimed tnt = b.getWorld().spawn(b.getRelative(BlockFace.UP).getLocation(), TNTPrimed.class); tnt.setSource(event.getPlayer()); + tnt.setFuseTicks(Math.max(0, autoIgniteFuse)); return; } } diff --git a/src/main/resources/res/settings.yml b/src/main/resources/res/settings.yml index 49035c3..b2a7f37 100644 --- a/src/main/resources/res/settings.yml +++ b/src/main/resources/res/settings.yml @@ -33,6 +33,7 @@ food-regen: false lock-food-level: true player-time-in-arena: world auto-ignite-tnt: false +auto-ignite-fuse: 80 auto-start-timer: 0 start-delay-timer: 0 auto-ready: false