atoo Posted January 18, 2017 Share Posted January 18, 2017 (edited) this is my deposit code when @bank, it deposit's my dragon axe too worked like 2 days ago but now i dont fkn know. getBank().depositAllExcept(item -> item.getName().contains("axe")); Edited January 18, 2017 by atoo Quote Link to comment Share on other sites More sharing options...
Sysm Posted January 18, 2017 Share Posted January 18, 2017 if (this.bank.isOpen()) { this.bank.depositAllExcept("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Dragon axe"); Havent tested it so not sure if it woks, but it should 1 Quote Link to comment Share on other sites More sharing options...
aeondenied Posted January 18, 2017 Share Posted January 18, 2017 (edited) xd Edited January 18, 2017 by aeondenied Quote Link to comment Share on other sites More sharing options...
atoo Posted January 18, 2017 Author Share Posted January 18, 2017 if (this.bank.isOpen()) { this.bank.depositAllExcept("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Dragon axe"); Havent tested it so not sure if it woks, but it should I wrote that too, but i just thought if we include "axe" it wouldnt deposit it. Thanks though Quote Link to comment Share on other sites More sharing options...
Sysm Posted January 18, 2017 Share Posted January 18, 2017 I wrote that too, but i just thought if we include "axe" it wouldnt deposit it. Thanks though think it looks for a item "axe" instead of looking for a item containing the word i always type it out and that work so may aswell Quote Link to comment Share on other sites More sharing options...
Hayase Posted January 18, 2017 Share Posted January 18, 2017 (edited) Strange if it worked before and suddenly stops working. Also not too important in this situation but I think using .contains() could be bad practice if you were dealing with strings that used other words with the sequence "axe" but were not axes. Again there's no case in this situation but if you were dealing with axel logs, .endsWith() would be better in this case since we know our axes always ends with "axe" Edited January 18, 2017 by Hayase 1 Quote Link to comment Share on other sites More sharing options...
DocMatson Posted January 18, 2017 Share Posted January 18, 2017 (edited) best thing to do is make a constant that lists your axe names. public static final String AXES = ("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Dragon axe"); if (this.bank.isOpen()) { this.bank.depositAllExcept(AXES); This will always call the list of axes (which i doubt will ever change) this is a helpful technique and makes the code much more readable and modular. Edited January 18, 2017 by DocMatson 1 Quote Link to comment Share on other sites More sharing options...
atoo Posted January 18, 2017 Author Share Posted January 18, 2017 best thing to do is make a constant that lists your axe names. public static final String AXES = ("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Dragon axe"); if (this.bank.isOpen()) { this.bank.depositAllExcept(AXES); This will always call the list of axes (which i doubt will ever change) this is a helpful technique and makes the code much more readable and modular. Thanks mate I always code messy lol, this will help a bit. Quote Link to comment Share on other sites More sharing options...
Explv Posted January 18, 2017 Share Posted January 18, 2017 this is my deposit code when @bank, it deposit's my dragon axe too worked like 2 days ago but now i dont fkn know. getBank().depositAllExcept(item -> item.getName().contains("axe")); getBank().depositAllExcept(item -> item.getName().endsWith(" axe")); 2 Quote Link to comment Share on other sites More sharing options...