telling same thing to you as I did to afk5min XD Leave him and answer to my PM xDZoey76 wrote:
Don't "dude" me, I just gave you a proper answer from someone that has been doing this for a long time.
Provide a patch that actually proves the code is duplicated/useless and then we can continue talking about it.
doAttack Method...
Forum rules
READ NOW: L2j Forums Rules of Conduct
READ NOW: L2j Forums Rules of Conduct
- lord_rex
- Posts: 78
- Joined: Sat Jun 06, 2009 2:38 pm
- Location: Hell, 9th circle, centre
- Contact:
Re: doAttack Method...
You're right. I have forgotten how to act like a normal human being. And I play games and I lie and I trick people to avoid the truth of how I feel.
-
- Posts: 38
- Joined: Tue Jan 31, 2012 4:02 pm
- Location: Away From Keyboard
Re: doAttack Method...
Sure, when you are the only developer, you can say thatSpooKNoF wrote:the point for null checks is THE NULL if somehting is null in 1 code how you will bypass it? we using 1 check for all methods
'HO HO HO, merry xmas! this method does not need a null check, because all callers do a null check themselves! I know, because I wrote the code all by myself. Also, noone will ever add any code that violates these conditions, because I AM THE ONLY DEVELOPER'

Compute sequentially, true or false?
Code: Select all
p :- p.p. ?- p.
-
- Posts: 24
- Joined: Fri Mar 13, 2009 11:22 am
Re: doAttack Method...
afk5min wrote:Sure, when you are the only developer, you can say thatSpooKNoF wrote:the point for null checks is THE NULL if somehting is null in 1 code how you will bypass it? we using 1 check for all methods
'HO HO HO, merry xmas! this method does not need a null check, because all callers do a null check themselves! I know, because I wrote the code all by myself. Also, noone will ever add any code that violates these conditions, because I AM THE ONLY DEVELOPER'
1 method call another method to continue the hit so if we will put the check on start so...
-
- Posts: 38
- Joined: Tue Jan 31, 2012 4:02 pm
- Location: Away From Keyboard
Re: doAttack Method...
Honestly, I am tired of your whining, your broken english and the fact that you dismiss everyone who is trying to help you. That's why every time you post a message in this thread, I am going to reply with this:SpooKNoF wrote:1 method call another method to continue the hit so if we will put the check on start so...

Compute sequentially, true or false?
Code: Select all
p :- p.p. ?- p.
- jurchiks
- Posts: 6769
- Joined: Sat Sep 19, 2009 4:16 pm
- Location: Eastern Europe
Re: doAttack Method...
I believe this belongs in this thread:

on point, I believe it's good to do the null checks only in the places where the parameters are used, so, for example, if a method simply passes a parameter to another method but doesn't use the value itself, no check is necassary.
But there are exceptions to this just like there are exceptions to everything else, for example, if you have a method designed to check parameters (doesn't use the values, just checks them and returns boolean).

on point, I believe it's good to do the null checks only in the places where the parameters are used, so, for example, if a method simply passes a parameter to another method but doesn't use the value itself, no check is necassary.
But there are exceptions to this just like there are exceptions to everything else, for example, if you have a method designed to check parameters (doesn't use the values, just checks them and returns boolean).
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
-
- Posts: 24
- Joined: Fri Mar 13, 2009 11:22 am
Re: doAttack Method...
So yes is ussules!
that is custom logs when i start to attack
AutoAnnoucements: Loaded 0 Auto Annoucement Data.
GameServer: Telnet server is currently disabled.
Registered on login as Server 1 : Bartz
L2CharacterAi onIntentionAttack System Check target: Spook.Gremlin
lets check that code...(onIntentionAttack)
L2Character doAttack System Check target: Spook.Gremlin
lets check that code...(doAttack)
L2Character onHitTimer System Check target: Spook.Gremlin
lets check that code...(onHitTimer)
L2Character doAttack System Check target: Spook.Gremlin
L2Character onHitTimer System Check target: Spook.Gremlin
L2CharacterAi onIntentionAttack System Check target: Gremlin.Spook
L2Character doAttack System Check target: Gremlin.Spook
L2Character onHitTimer System Check target: Gremlin.Spook //END THE SAME HERE..
L2Character doAttack System Check target: Gremlin.Spook
L2Character onHitTimer System Check target: Gremlin.Spook
L2Character doAttack System Check target: Gremlin.Spook
that is custom logs when i start to attack
AutoAnnoucements: Loaded 0 Auto Annoucement Data.
GameServer: Telnet server is currently disabled.
Registered on login as Server 1 : Bartz
L2CharacterAi onIntentionAttack System Check target: Spook.Gremlin
lets check that code...(onIntentionAttack)
Code: Select all
@Override protected void onIntentionAttack(L2Character target) { if (target == null) //First null check... { System.out.println("L2CharacterAi onIntentionAttack System Check null target: " + _actor.getName() + "."); clientActionFailed(); return; } System.out.println("L2CharacterAi onIntentionAttack System Check target: " + _actor.getName() + "." + target.getName());
lets check that code...(doAttack)
Code: Select all
protected void doAttack(L2Character target) { if (target == null) //second null check { System.out.println("L2Character doAttack System Check null target: " + getName() + "."); return; } if (isAttackingDisabled() || !getEvents().onAttack(target)) { return; } System.out.println("L2Character doAttack System Check target: " + getName() + "." + target.getName());
lets check that code...(onHitTimer)
Code: Select all
public void onHitTimer(L2Character target, int damage, boolean crit, boolean miss, boolean soulshot, byte shld) { if (target == null) //third null check { System.out.println("L2Character onHitTimer System Check null target: " + getName() + "."); getAI().notifyEvent(CtrlEvent.EVT_CANCEL); return; } System.out.println("L2Character onHitTimer System Check target: " + getName() + "." + target.getName());
L2Character onHitTimer System Check target: Spook.Gremlin
L2CharacterAi onIntentionAttack System Check target: Gremlin.Spook
L2Character doAttack System Check target: Gremlin.Spook
L2Character onHitTimer System Check target: Gremlin.Spook //END THE SAME HERE..
L2Character doAttack System Check target: Gremlin.Spook
L2Character onHitTimer System Check target: Gremlin.Spook
L2Character doAttack System Check target: Gremlin.Spook
- lord_rex
- Posts: 78
- Joined: Sat Jun 06, 2009 2:38 pm
- Location: Hell, 9th circle, centre
- Contact:
Re: doAttack Method...
just do me a favor and run that:
Code: Select all
/** * @author lord_rex */public final class PiffPuff{ public static void main(String[] args) { final SpooKNoF player = new SpooKNoF(); startSuffering(player); } static void startSuffering(final SpooKNoF player) { while (!player.hasSufferedEnough()) player.suffer(); } static class SpooKNoF { public void suffer() { System.out.println("SpooKNoF is Suffering!"); } public boolean hasSufferedEnough() { return false; // constant, never returns true } }}
You're right. I have forgotten how to act like a normal human being. And I play games and I lie and I trick people to avoid the truth of how I feel.
-
- Posts: 24
- Joined: Fri Mar 13, 2009 11:22 am
Re: doAttack Method...
lord_rex wrote:just do me a favor and run that:
Code: Select all
/** * @author lord_rex */public final class PiffPuff{ public static void main(String[] args) { final SpooKNoF player = new SpooKNoF(); startSuffering(player); } static void startSuffering(final SpooKNoF player) { while (!player.hasSufferedEnough()) player.suffer(); } static class SpooKNoF { public void suffer() { System.out.println("SpooKNoF is Suffering!"); } public boolean hasSufferedEnough() { return false; // constant, never returns true } }}
you are bad

-
- L2j Veteran
- Posts: 1228
- Joined: Thu Jan 17, 2013 9:46 am
Re: doAttack Method...
null checks are more then usefull. what if that method sometime will be used directly and may be passed a null variable? then you will cry we got Npes.
- lord_rex
- Posts: 78
- Joined: Sat Jun 06, 2009 2:38 pm
- Location: Hell, 9th circle, centre
- Contact:
Re: doAttack Method...
everyone telling it to him for a week, but anyway good luck to explain him, but if I were u I woudn't waste my time with him... I just started the time wasting because he was breakin' my precious discussions with his stupid null checksxban1x wrote:null checks are more then usefull. what if that method sometime will be used directly and may be passed a null variable? then you will cry we got Npes.

You're right. I have forgotten how to act like a normal human being. And I play games and I lie and I trick people to avoid the truth of how I feel.
-
- Posts: 24
- Joined: Fri Mar 13, 2009 11:22 am
Re: doAttack Method...
lord_rex wrote:everyone telling it to him for a week, but anyway good luck to explain him, but if I were u I woudn't waste my time with him... I just started the time wasting because he was breakin' my precious discussions with his stupid null checksxban1x wrote:null checks are more then usefull. what if that method sometime will be used directly and may be passed a null variable? then you will cry we got Npes.
dude come on you think you are good now because you say null check is usefull there?
its my opinion to say null check is ussules there so what did you try to explain me?
just open logs you will never use null check point in doAttack method..
Last edited by SpooKNoF on Fri Aug 02, 2013 5:38 pm, edited 1 time in total.
- lord_rex
- Posts: 78
- Joined: Sat Jun 06, 2009 2:38 pm
- Location: Hell, 9th circle, centre
- Contact:
Re: doAttack Method...
1. saying same as Zoey, don't "dude me"SpooKNoF wrote:lord_rex wrote:everyone telling it to him for a week, but anyway good luck to explain him, but if I were u I woudn't waste my time with him... I just started the time wasting because he was breakin' my precious discussions with his stupid null checksxban1x wrote:null checks are more then usefull. what if that method sometime will be used directly and may be passed a null variable? then you will cry we got Npes.
dude come on you think you are good now because you say null check is usefull there?
its my opinion to say null check is ussules there so what did you try to explain me?
2. I am not "good", I am Divine.
3. you don't understand the whole way how developers work....
You're right. I have forgotten how to act like a normal human being. And I play games and I lie and I trick people to avoid the truth of how I feel.
- UnAfraid
- L2j Veteran
- Posts: 4199
- Joined: Mon Jul 23, 2007 4:25 pm
- Location: Bulgaria
- Contact:
Re: doAttack Method...
I am not gonna remove that null check from there, not because current l2j code can cause NPEs but because all the community is applying patches which are not codded that good and they can get into NPE wall of errors because of that simple NPE removed check.
It doesn't causes any performance affections with/without u won't notice anything even with 10k players.
jurchiks already explain u few pages back that this is one of most light-weight checks that can be made.
We got so many null checks all over the code should we spend our time to remove them?
NO i wouldn't do that i got better things to do instead of wasting my time to change things that wouldn't matters at all.
Topic is closed.
@jurchiks, @lord_rex, @Zoey76 open new topic if u gonna continue your talk.
It doesn't causes any performance affections with/without u won't notice anything even with 10k players.
jurchiks already explain u few pages back that this is one of most light-weight checks that can be made.
We got so many null checks all over the code should we spend our time to remove them?
NO i wouldn't do that i got better things to do instead of wasting my time to change things that wouldn't matters at all.
Topic is closed.
@jurchiks, @lord_rex, @Zoey76 open new topic if u gonna continue your talk.