Helper Method extracted CraftInventoryCustom.java#14
Helper Method extracted CraftInventoryCustom.java#14Ottomoeller wants to merge 13 commits intoNicMcPhee:masterfrom
Conversation
method callded D1.
it easier for a pull request to be accepted.
Conflicts: src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
method callded D1.
equals and checks through if statements that were in the Equals method.
was similar between two different methods, splitStack and splitWithoutUpdate.
|
Review of non-code components: Review of code components: |
|
I concur with Athear, the Pull Request is rather difficult to understand. For example, the sentence "And put in an if statement right after the if statement checking if the stack is null asking if the second int value is Interger.MAX_VALUE" has to be read a few times through, and as such is a good indicator for rewriting the sentence. The justification portion could have also touched on making code modification easier. Lack of test acknowledgement would make me hesitant to accept this refactoring. Also, looking at the code, instead of having two method that sort of do the same thing, you've added a third and shrived up the other two; while there isnt anything necessarily wrong with that, introducing a third method in this case seems a bit smelly. |
If you are reviewing this pull request you will only need to look at this one Ottomoeller@3066aba. We had some problems with other commits copying over with the pull request and that's why you can ignore any other commits made.
The Issue:
In CraftInventoryCustom.java there were two methods that were basically the same except for a few parts.
Justification:
Helps increase readability and reduces some duplicate code.
Break Down:
I extracted the method from splitStack and so takes two int values. And put in an if statement right after the if statement checking if the stack is null asking if the second int value is Interger.MAX_VALUE; which i set the j for splitWihoutUpdate. When the if statement passes then it uses the if/else from splitWithoutUpdate else it uses the if/else from splitStack. Depending on which it ran it returns that ones results.