BentoBoxWorld / Limits

Limits blocks and entities on islands - for BentoBox
Eclipse Public License 2.0
8 stars 17 forks source link

Count PISTON_HEAD and MOVING_PISTON + Config option to ignore custom limits perms #108

Closed YellowZaki closed 3 years ago

YellowZaki commented 3 years ago

When players break pistons which are extended or moving, they are not removed from the limit.

In order to resolve this, I had to change fixMaterial(Material) to fixMaterial(Block). Then get the BlockData "TechnicalPiston" in order to know if the PISTON_HEAD/MOVING_PISTON is from NORMAL or STICKY.

Then I realised fixMaterial was being used for others things (https://github.com/BentoBoxWorld/Limits/blob/develop/src/main/java/world/bentobox/limits/listeners/BlockLimitsListener.java#L336) so I couldn't just change the argument from Material to Block, so I set it to Object. Then I cast it to know if it is Block or Material.

I don't really understand why "changeTo" exists. I guess because of this line: https://github.com/BentoBoxWorld/Limits/blob/develop/src/main/java/world/bentobox/limits/listeners/BlockLimitsListener.java#L173 but I don't know how is it possible to break seeds.

tastybento commented 3 years ago

There are some conflicts that need fixing before merging. Could you look at them?

For the seeds - these are the results of the breaking - so you break growing wheat for example, and the result is WHEAT_SEEDS. Those need to be back-converted to WHEAT. Same with BEETROOT.

YellowZaki commented 3 years ago

I don't understand why fixMaterial is not enough for seeds. Input SEEDS, output WHEAT . When you break the seeds, you remove WHEAT from the db. I this line wheat would be added to db: https://github.com/BentoBoxWorld/Limits/blob/develop/src/main/java/world/bentobox/limits/listeners/BlockLimitsListener.java#L343

The changeTo argument wouldn't be necessary anymore.

YellowZaki commented 3 years ago

I've created a new PR