[BUG] Bug with selection calculation
aurel85 opened this issue ยท 2 comments
Hi,
I use the last version of this plugin (310) and Paper 1.15.2.
My players have complained of problems with the size calculated when selecting the two claim points. So I decided to investigate and indeed there is a problem ... Here is the evidence on a straight line of 128 blocks :
Compared to where I go to make my selection the result is not the same, how is it ? There must be a calculation problem with the blocks where we click.
Thank you in advance.
Hi, i think i figured how it works.
I will try to be clear.
If you claim an area from x0/z0 to x9/z0. It's a 10*1=10 block claim.
But if you go x0/z0 to x-9/z0, it will be a 8*1=8 block claim, but we can count 10 blocks in the claim.
(Same problem when you go negative in X way or Z way)
So the problem come from area calculation with negatives coordinates.
My theory is that you calculate the X (and later Z) selection with coordinate then add 1 because from x0 to x9 there is 10 blocks.
In our example :
x0/z0 to x9/z0 gives (9-0)+1.
But when you're in negative coordinates, it goes (-9-0)+1 = 8. <- wrong size
You may use absolute value before add +1.
Here is how i think it works, hope i helped you!