John000708 / Barrels

A plugin which replicates the popular barrels found in modpacks.
GNU General Public License v3.0
4 stars 18 forks source link

Fixing issue #6 and code cleanup. #11

Closed LinoxGH closed 5 years ago

LinoxGH commented 5 years ago
LinoxGH commented 5 years ago

Did the requested changes.

TheBusyBiscuit commented 5 years ago

Not all.

LinoxGH commented 5 years ago

Now all.

LinoxGH commented 5 years ago

I am not sure if they are related to my changes but issues #8 and #9 seem like fixed too.

I tried to replicate them in my build but I couldn't.

LinoxGH commented 5 years ago

Removed the comment and tried to replicate the issue #7 too but it seems that it has been fixed already before in Barrel.java(373:9)

TheBusyBiscuit commented 5 years ago

Okay, could you please remove the redundant return-statement too?

LinoxGH commented 5 years ago

Is it redundant though? I mean if we don't return true in there it'll return false afterwards.

TheBusyBiscuit commented 5 years ago

Yeah but as I said to you before. You added it twice... You have two return true; statements after another...

TheBusyBiscuit commented 5 years ago

Oh now I see what you meant with the return false; Sorry, I was looking at the wrong return-statement;

We still only need one return true; statement at the very end though.

LinoxGH commented 5 years ago

So we return true whatever happens? Even if the block isn't a barrel owned by the player and the item isn't an ID Card?

TheBusyBiscuit commented 5 years ago

No... The statement at the very top already checks that the item was an ID card. Otherwise it returns false...

So we can return true; afterwards, no matter what.

Code

LinoxGH commented 5 years ago

Ah it's my fault. I always thought the boolean parts of handlers was like the boolean part of CommandExecutor.(You need to return true if you did sth successfully.)

TheBusyBiscuit commented 5 years ago

Nah, it's a messy system.

True = This Action was handled False = This Action is not applicable

On right click it loops through all Handlers until one return true.

LinoxGH commented 5 years ago

Return statements should be better now.