ChanceSD / AncientGates

Create regular or bungee portals on your server. Updated for 1.8 up to 1.20
https://dev.bukkit.org/projects/ancient-gates/
GNU General Public License v3.0
15 stars 5 forks source link

Treat CAVE_AIR just like normal AIR blocks #92

Closed fuhry closed 5 months ago

fuhry commented 2 years ago

Recently, Minecraft began using CAVE_AIR for air blocks inside of caves, however AncientGates presently does not recognize this as air and refuses to construct portals inside of caves.

This PR resolves this issue. It has been successfully tested on a server running Minecraft 1.20 with no issues.

sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

ChanceSD commented 2 years ago

Thank you, unfortunately that probably stops the plugin from working in older versions where Material.CAVE_AIR doesn't exist. If you could replace that with something from XMaterial, I'm not sure if XMaterial.AIR already includes cave air or not, if so it would be the easiest way to support all versions.

If you can't change that I will try to test it and adjust your PR,, thank you either way though since getting a new PR is very rare

fuhry commented 1 year ago

@ChanceSD Thanks for this, sorry that I didn't see your comment until now!

I'll look into adapting this to XMaterial and update the PR.

fuhry commented 1 year ago

Update - I made the changes but still need to test them, I'll get that done this week.

ChanceSD commented 1 year ago

@fuhry Any update on this? No problem if not

fuhry commented 1 year ago

@ChanceSD I haven't had a chance to actually test this yet. Do you still need that done?

ChanceSD commented 1 year ago

I didn't try it either tbh

fuhry commented 1 year ago

I've finally gotten around to testing this now that 1.20 is released. I'm getting the "the from location is not air" message with both XBlock.isAir() and XMaterial.AIR.matchXMaterial(). The isAir() function looks particularly simple, so I don't know what's going on. Here's my squashed code versus the latest state of master..

Edit: I was missing a ! operator. Update incoming.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

fuhry commented 1 year ago

@ChanceSD Just wanted to let you know this should now be ready to merge!

I've noticed a couple of other issues, which I'm fairly certain are separate. If you think any could be regressions introduced by this PR, can you let me know? Otherwise I'll file separate issues and pull requests for them.

  1. Decorative non-obstructing block types, like grass, flowers, etc. can't be placed around a gate
  2. Water, sugar cane and potentially other block types aren't replaced with air when a gate closes. Particularly problematic for water as this causes flooding
  3. A room with several gates that use water as a material can experience flooding in all gates when one gate is closed

Have a feeling 2 and 3 are related, and maybe 1 is intended to prevent 2 and 3 from happening, will peek into the Bukkit/Spigot APIs to see if flow recalc can be inhibited directly.

CatTeaA commented 5 months ago

bump

ChanceSD commented 5 months ago

Sorry, it's been so long, I will fix the conflicts and merge it soon. And yes, I believe there are some issues with water currently, not sure if possible to fix.

sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

ChanceSD commented 5 months ago

Should be good, merging now, thank you for your contribution!