BentoBoxWorld / BentoBox

Expandable Minecraft server plugin for island-type games like SkyBlock or AcidIsland.
https://bentobox.world
Eclipse Public License 2.0
328 stars 137 forks source link

/is reset resetting chunks from other player's islands #405

Closed ProSl3nderMan closed 5 years ago

ProSl3nderMan commented 5 years ago

Description All islands with a positive x and negative x coords on the SAME island will loose 2 blocks in their negative x side if the player to their negative x side resets their island. This also happens with islands that have positive z and negative z coords on the SAME island, they will loose 2 blocks in their negative z side if the player to their negative z side resets their island. Now, I cannot explain this in greater detail because of how confusing it can be, please watch this video to get a good explanation of what is happening: https://www.youtube.com/watch?v=mSiEf-7lBRY&feature=youtu.be

Steps to reproduce the behavior:

  1. create an island at a position where the island will have one half as positive x and the other negative x.
  2. create another island next to it (has to be up against the negative x side of the island created in the previous step).
  3. The first island you created, build all the way up to the border of that island.
  4. Go to the second island created and reset that island.
  5. Go back to the first island you created and notice it deleted two blocks of the blocks you placed up against the border. To text for the positive z and negative z coords islands, do the same exact steps as above but replace x with z. Watch this video for a better explanation and a tutorial on how I produced these bugs: https://www.youtube.com/watch?v=mSiEf-7lBRY&feature=youtu.be

Expected behavior What I expect to happen is when the player resets their island, it does not take out 2 blocks into another player's island. Only islands with half positive and half negative coords loose 2 blocks, and they only loose the 2 blocks in the negative side of their island.

Screenshots Instead of screenshots, I made a video: https://www.youtube.com/watch?v=mSiEf-7lBRY&feature=youtu.be

Server Information:

I do believe this problem can be fixed in the util class "DeleteIslandChunks," the problem should be how the chunks are being calculated/found. I would try fixing myself but I am not good with that type of math.

tastybento commented 5 years ago

What config do you have? You can drag and drop it to this ticket (may need to zip it)

ProSl3nderMan commented 5 years ago

configs.zip

tastybento commented 5 years ago

@ProSl3nderMan You put the same config (BentoBox's) in both files :-) I'm really after your island size and protection size settings.

ProSl3nderMan commented 5 years ago

How embarrassing... here: configs.zip

tastybento commented 5 years ago

Also, to help, could you give me the center coordinates of the two islands in the first example shown in the video?

ProSl3nderMan commented 5 years ago

The island not being reset: x:0 y:120 z:-128 The island that was /is reset: x: -128 y: 120 z: -128

tastybento commented 5 years ago

Okay, thanks. I can replicate this now.

Poslovitch commented 5 years ago

Might be our chunk-based island-deleter working too well? :laugh: I hope you'll find a fix for that @tastybento.

@ProSl3nderMan Thanks for the explanatory video. That helps us a lot.

tastybento commented 5 years ago

The problem was with the way that chunk coordinates were being calculated. The correct way is to use signed right shift >> 4 but I was doing divide /16. Divide doesn't work with negative values correctly.

Poslovitch commented 5 years ago

Use bit shift instead of dividing? I didn't know we could use bit shifting in Java.

tastybento commented 5 years ago

Yes, that is how actually Minecraft calculates chunk values, by doing >> 4. I double checked Dinnerbone's own code after seeing the difference with negative coordinates.

tastybento commented 5 years ago

@ProSl3nderMan Thanks for the report and the video!