January 18, 20179 yr 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, 20179 yr by atoo
January 18, 20179 yr 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
January 18, 20179 yr Author 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
January 18, 20179 yr 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
January 18, 20179 yr 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, 20179 yr by Hayase
January 18, 20179 yr 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, 20179 yr by DocMatson
January 18, 20179 yr Author 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.
January 18, 20179 yr 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"));
Create an account or sign in to comment