RuneSuite1337j 0 Posted May 17, 2022 Report Share Posted May 17, 2022 Thanks for contributing to the community ! Link to comment Share on other sites More sharing options...
0117be 66 Posted June 2, 2022 Report Share Posted June 2, 2022 Added. Link to comment Share on other sites More sharing options...
test710 0 Posted June 3, 2022 Report Share Posted June 3, 2022 Thanks for the help Link to comment Share on other sites More sharing options...
onetake 0 Posted October 13, 2022 Report Share Posted October 13, 2022 Very thanks.. Link to comment Share on other sites More sharing options...
Sadie 2 Posted October 15, 2022 Report Share Posted October 15, 2022 thanks for the contribution Link to comment Share on other sites More sharing options...
Matts0172 1 Posted October 15, 2022 Report Share Posted October 15, 2022 Thanks! Link to comment Share on other sites More sharing options...
Another1djkhalled 0 Posted October 18, 2022 Report Share Posted October 18, 2022 Easy! ty Link to comment Share on other sites More sharing options...
mire 0 Posted October 29, 2022 Report Share Posted October 29, 2022 Wow thank you for this! Link to comment Share on other sites More sharing options...
mire 0 Posted October 29, 2022 Report Share Posted October 29, 2022 Wow thank you for this! Link to comment Share on other sites More sharing options...
siepel 1 Posted November 12, 2022 Report Share Posted November 12, 2022 thank you gonna try it Link to comment Share on other sites More sharing options...
oakmills 1 Posted March 8, 2023 Report Share Posted March 8, 2023 thank you Link to comment Share on other sites More sharing options...
Rogue 1 Posted April 14, 2023 Report Share Posted April 14, 2023 Thanks! Link to comment Share on other sites More sharing options...
DruggedCamels 0 Posted April 19, 2023 Report Share Posted April 19, 2023 Assuming your source is compatable with Java 13 you could use enhanced Switch as shown below and if your using java 17 LTS you could move to using Switch Expressions they are very beautiful even more so if you are using Arrays with named types. Fun fact for anyone that is Beginner to Intermediate with the Java Programming Language did you know that Switch Cases are typically faster once compiled into byte code assuming you are using java conventions and using a modern JVM similar to Java 17. Just using one or two if statements will be faster than using Switch or Switch Expressions but if you look at most Server Applications they are riddled with if statements paired with ugly outdated and depressingly complex for a simple task. Meet Easier public boolean isDemon() { switch (Defender.npcType) { case 1531, 3134, 2006, 2026, 7244, 1432, 415, 7410, 135, 3133, 484, 1619, 7276, 3138, 7397, 7398, 11, 22978 -> { //Dragon Hunter Lance if (attacker.lastWeaponUsed == 22978 && defender.isDragon()) { damage *= 1.2; accuracy *= 1.2; } } } The First Part public boolean isDemon() { return switch (npcType) { case 1531, 3134, 2006, 2026, 7244, 1432, 415, 7410, 135, 3133, 484, 1619, 7276, 3138, 7397, 7398, 11 -> true; default -> false; }; } This assumes you have added anything useful yet here is the first switch statement switch (Defender.npcType) { case 1531: case 3134: case 2006: case 2026: case 7244: case 1432: case 415: case 7410: case 135: case 3133: case 484: case 1619: case 7276: case 3138: case 7397: case 7398: case 11: case 2978: { //Dragon Hunter Lance if (attacker.lastWeaponUsed == 22978 && defender.isDragon()) { damage *= 1.2; accuracy *= 1.2; } } return true; } return false; } yes this works just fine but its freaking ugly also not using break; or return; on each case also slows down the byte code optimizations as it skips and moves threw each case. Link to comment Share on other sites More sharing options...
jam3zross 1 Posted July 10, 2023 Report Share Posted July 10, 2023 Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now