Fix Nether portals not disappearing when frame destroyed #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
The issue:
In the current build of this plugin, players are not able to destroy nether portals since when they destroy any part of the Obsidian frame, the Portal blocks don't vanish. (Vanilla/Spigot behaviour: Portal disappears when Obsidian destroyed) However, admins may wish to run this plugin on a server which allows normal players to destroy native Nether portals.
PR Breakdown:
This PR adds an extra check to the
BlockPhysicsEvent
handler which makes sure that we only cancel physics events actually relevant to WarpPortals. This PR blocks the following cases only:Potential problems:
This PR does take a blacklist approach to fix mentioned issue as opposed to my previous attempt (#26), which took a whitelist approach (It attempted to only allow portal block physics for intended Vanilla behaviour - I tried to expand this as far as to allow the whole portal to be destroyed when removing a single block, but the current Bukkit API (
BlockPhysicsEvent
) does not provide a clean way to accomplish this). This might cause issues with physics updates we want to block for WarpPortals that I couldn't think of.Testing materials:

I have tested that this change stops the issue mentioned above from happening (restoring full Vanilla behaviour, unlike #26). I have also verified that it does not interfere with the portal creation process as outlined in
README.md
for portals with nether portal block body. (I haven't tested any other bodies and I don't know of any other ways to create a WarpPortal) This PR has been tested in a clean environment. I can provide the artifact I used to test, if desired.This is a picture of my test setup for proof and to improve this PR description's layout:
The three portals to the left are actual WarpPortals which I tested to work correctly, even when manually changing some blocks inside or upon reconnecting. The rightmost portal is an actual Vanilla Nether Portal, which I tested to work as it would without this plugin installed.
Additional remarks:
This is a reimplementation of #26 with all known problems fixed. I initially tried to keep #26, but GitHub wouldn't allow me to reopen it with force-pushed commits.
Also, developing features and bugfixes for this project would be far easier if it would use a central build system, such as Apache Maven and/or if the compilation process were outlined somewhere. I, for example, could not locate the required
com.mccraftaholics.warpportalscommon
package, which is used by both classes incom.mccraftaholics.warpportals.remote
. (I temporarily removed those classes for my testing purposes)Frthermore, I'd like to apologize for the unnecessary whitespace diffs introduced into my patch. (my IDE wouldn't let me omit those) If desired, I take steps to remove those diffs from the patch.
Thanks!
TL;DR: Fixes Vanilla Nether Portals not disappearing when the frame is destroyed.