PlotSquared
PlotSquared copied to clipboard
plot merge count only contains the number of connected plots for the plot the players is located in
Server Implementation
Paper
Server Version
1.15.2
Describe the bug
Copy of https://issues.intellectualsites.com/issue/PS-30 by ofunny
#Usability problem
Plot merge count argument in world.yml (economy.prices.merge) only contains the number of connected plots for the plot the players is located at the moment.
You can either define a double or custom JavaScript In the worlds.yml (economy.prices.merge). The JavaScript will be executed via eval and gets one argument on call. The return of the JavaScript will be the merge price. This will allow detailed price calculation.
In the Merge.java you will find the eval on line 144 "final double price = priceExr == null ? 0d : priceExr.evaluate((double) size);" The size argument will be assigned on line 126 "final int size = plot.getConnectedPlots().size();"
The problem: ConnectedPlots().size(); will just retrieve the count of connected plots for the plot in which the player is located at the moment. This will allow the player to bypass higher merge price by simply merging to a bigger (merged) plot from a smaller plot since the smaller one will have less or no connected plots.
Instead of passing the size of actually connected plots passing the total size of the merge process would fix this issue. Since the total amount will be retrieved earlier to check the permission "plots.merge.x" this value should already exist.
Optional: pass a second double containing the total amount of merges a player already owns in/on the world/server.
To Reproduce
Create dynamic merge prices, example "merge: "(function(count) { if(count >= 1) count--; var base = 10000.0 * count; return base; }).call(new Object(), {arg});" in the world.yml. Now perform multiple merges on the same plot.
- always merge from the already merged plots in the direction of single (unmerged) plots (one by one).
- check the merge prices, it will always increase.
- delete the merges.
- Now do the same thing, but always merge from the single (unmerged) plots in the direction of the already merged plots.
- you will see, it is always the start price.
Expected behaviour
Screenshots / Videos
No response
Error log (if applicable)
No response
Plot Debugpaste
PlotSquared Version
5.12.0
Checklist
- [X] I have included a Plot debugpaste.
- [X] I am using the newest build from https://www.spigotmc.org/resources/77506/ and the issue still persists.
Anything else?
No response
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If the issue is still present and can be reproduced, please let the team know. Thank you for your contributions.