From 6de0a2fa83e083266c6dfaf4e8b074d54877dfdf Mon Sep 17 00:00:00 2001 From: Andreas Troelsen Date: Tue, 21 Jul 2020 16:07:10 +0200 Subject: [PATCH] Fix `soft-restore` for blocks broken by players. This commit fixes the per-arena config setting `soft-restore`. Due to commit 92c4ce1a8ba5e441ca670bd3690c9db58a4d852f, the soft restore logic won't run on BlockBreakEvents, because to reach that specific part of the event handler, the `protect` flag has to be set to `true`. However, due to an early return in the soft restore logic if the `protect` flag _is_ set to `true`, it is effectively impossible for it to run. The fact that this functionality has been broken for over 6 years (!) with almost no reports of it is perhaps a testament to how little it is being used in the wild. --- changelog.md | 1 + src/main/java/com/garbagemule/MobArena/ArenaListener.java | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 7df1f5a..b76ca7e 100644 --- a/changelog.md +++ b/changelog.md @@ -18,6 +18,7 @@ These changes will (most likely) be included in the next version. - The Root Target ability now uses potion effects (slowness, slow falling, and negative jump boost) instead of repeated teleports. This should make for a smoother root experience. - Config-files with missing `pet-items` nodes no longer errors. A missing `pet-items` node in `global-settings` is treated as empty, i.e. no pet items will be registered. - The `player-time-in-arena` setting has been fixed. +- The `soft-restore` setting has been fixed for blocks broken by players. Note that the functionality is still unreliable for non-trivial blocks. - Config-file errors imposed by incorrect usage of `/ma setting` no longer cause "internal errors". Instead, the errors are properly communicated in the command output similar to how the `/ma reload` command works. - The MagicSpells integration has been removed. This means that the extra `magicspells.yml` config-file (if it exists) no longer does anything and can be removed. diff --git a/src/main/java/com/garbagemule/MobArena/ArenaListener.java b/src/main/java/com/garbagemule/MobArena/ArenaListener.java index 31a7a9a..4804196 100644 --- a/src/main/java/com/garbagemule/MobArena/ArenaListener.java +++ b/src/main/java/com/garbagemule/MobArena/ArenaListener.java @@ -230,9 +230,6 @@ public class ArenaListener return true; if (softRestore) { - if (arena.isProtected()) - return false; - BlockState state = b.getState(); Repairable r = null;