slipcor / TreeAssist

https://www.spigotmc.org/resources/treeassist.67436/
GNU General Public License v3.0
34 stars 19 forks source link

Sapling protection is broken #53

Closed iperrealistico closed 4 years ago

iperrealistico commented 4 years ago

This is my config

Dropped: Active: true Probability: 100 Delay Ticks: 100 Enforce: false Force Protect: true Material: minecraft:air Requires Tools: true Only When Bottom Block Broken First: false When Tree Burns Down: true Protect For Seconds: 60 Delay Growth Seconds: 240

If enable enforce protect, when i break a single sapling, it prints 2 times "You cannot break saplings in this server!" image

And the sapling is not protected at all, it can be removed easily with an axe TreeAssist version 7.0.112 git-Paper-134 (MC: 1.16.1)

slipcor commented 4 years ago

Wow! Thanks for pointing this out, this totally flew over my head during the rewrite... I wonder what else I forgot to re-do :/ I will release an update for now

iperrealistico commented 4 years ago

Thanks for the quick fix, however we have still some problems:

if Force Protect is set to false, you can still break the sapling before the Protect For Seconds timer goes off

If Force Protect is set to true, you can't break saplings at all, ever

slipcor commented 4 years ago

I will try to debug this now. Can you check that none of the specific tree definitions might still have an override of "Seconds: 0" ?

At least code wise it looks like it should work!

slipcor commented 4 years ago

Yeah on my test server it works as intended, I just had a sapling successfully protected for 20 seconds :) I will put together a debug version that will show when the protection is added, for how long, and if not, maybe why not 🗡️

slipcor commented 4 years ago

@Leonardo-Fiori can you please do a debug with this version?

https://ci.craftyn.com/job/TreeAssist/

And then check your /plugins/TreeAssist/debug folder , please pastebin :D

iperrealistico commented 4 years ago

Ok testing now! Do i need to keep Force Protect on true?

iperrealistico commented 4 years ago

Wait a moment! I figured the problem out before using the test version!

The protect sapling timer, does not take into consideration the replanting delay

I did set it to protect it for 20 seconds, but the sapling got replanted only after 60 seconds when the sapling was replanted, the protection was gone long time before

simply increased protection time to be replant delay + actual protection time!

Thanks for all the effort you are putting into this plugin! Best tree assistance software out there <3

slipcor commented 4 years ago

Oh! Got it! :D Yeah we totally should wait with the protection, for the replanting to happen. Thanks for pointing that out, I did not have a replanting delay in there. Easy fix, there will be a new build out soon :)

Thanks for helping out by testing! It would be much much harder without people like you :)

iperrealistico commented 4 years ago

Good morning vietnam, there is just a small bug left here! :) just updated to 7.0.123 and noticed this:

break a tree at 1 block ABOVE the base block. try to break the base block.

it says "This sapling is protected!" and it does not allow you to break the base block

Instead if you break the base block first, it goes smoothly.

There is probably an error in the order you check for things in the code :) checking too early for sapling protection, also when the sapling is not there yet! or maybe you are not checking the id of the block correctly, don't know

default.txt

edit: also happens when i set Protect For Seconds: 0

slipcor commented 4 years ago

Oh yeah this was probably a lazy fix, too. Thinking of instant-destruction, not "later-destruction" - this should be an easy fix :)