command.equalsIgnoreCase problem

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
Starter
Posts: 484
Joined: Sat Jan 23, 2010 4:42 pm

command.equalsIgnoreCase problem

Post by Starter »

L2J Revision 4720
L2JDP Revision 8129

Hello everyone,

I got a very wierd problem again and I just dont know why this is why it is and where to start fixing it. I tried several stuff and read the java documentation and everything seems just fine but nooooo, it doesnt work as it should and it can only be related to the l2j server core so please help meh. :D

The problem is as follows:

Typing a voice command like .tvt (the voice command to check the tvt event status - TvTVoicedInfo.java to be concrete) triggers the correct action - if the required conditions are met - but if I type .TVT it doesnt work even though - and thats the wierd part now - its stated in the appropriate handler file that it should trigger via that input too -> command.equalsIgnoreCase("tvt"). oO

Someone got an idea why it doesnt work and since when? I think it worked someday but im not sure atm..
I have promises to keep and miles to go before I sleep.
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: command.equalsIgnoreCase problem

Post by jurchiks »

The command in the array of available commands is defined in lowercase and it only compares that in core, after that in the handler equalsIgnoreCase is useless.
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.
Starter
Posts: 484
Joined: Sat Jan 23, 2010 4:42 pm

Re: command.equalsIgnoreCase problem

Post by Starter »

jurchiks wrote:The command in the array of available commands is defined in lowercase and it only compares that in core, after that in the handler equalsIgnoreCase is useless.
Thats what I found out as well but how can that be changed? There must be a way. -.-
I have promises to keep and miles to go before I sleep.
User avatar
Zoey76
L2j Inner Circle
L2j Inner Circle
Posts: 7008
Joined: Tue Aug 11, 2009 3:36 am

Re: command.equalsIgnoreCase problem

Post by Zoey76 »

This doesn't happen anymore in BETA since you cannot use uppercase for them.
Anyway you can use command = command.toLowerCase(); before the check. and change equalsIgnoreCase() for equals().
Powered by Eclipse 4.34 ๐ŸŒŒ | Eclipse Temurin 21 โ˜• | MariaDB 11.3.2 ๐Ÿ—ƒ๏ธ | L2J Server 2.6.3.0 - High Five ๐Ÿš€

๐Ÿ”— Join our Discord! ๐ŸŽฎ๐Ÿ’ฌ
Starter
Posts: 484
Joined: Sat Jan 23, 2010 4:42 pm

Re: command.equalsIgnoreCase problem

Post by Starter »

Zoey76 wrote:This doesn't happen anymore in BETA since you cannot use uppercase for them.
Anyway you can use command = command.toLowerCase(); before the check. and change equalsIgnoreCase() for equals().
Oh rly? What changed regarding this?

I tried that as well - same as every possible solution - but nothing worked. And ofc it cant be the solution as otherwise the equalsIgnoreCase option would work as well..
I have promises to keep and miles to go before I sleep.
User avatar
Zoey76
L2j Inner Circle
L2j Inner Circle
Posts: 7008
Joined: Tue Aug 11, 2009 3:36 am

Re: command.equalsIgnoreCase problem

Post by Zoey76 »

I'm talking about this:
You do not have the required permissions to view the files attached to this post.
Powered by Eclipse 4.34 ๐ŸŒŒ | Eclipse Temurin 21 โ˜• | MariaDB 11.3.2 ๐Ÿ—ƒ๏ธ | L2J Server 2.6.3.0 - High Five ๐Ÿš€

๐Ÿ”— Join our Discord! ๐ŸŽฎ๐Ÿ’ฌ
Starter
Posts: 484
Joined: Sat Jan 23, 2010 4:42 pm

Re: command.equalsIgnoreCase problem

Post by Starter »

Zoey76 wrote:I'm talking about this:
Hah, I knew all starts in this handler, tried several toLowerCase actions there as well but I will try your patch and tell if it works but if you say that its working as it should in the BETA branch then I guess I can trust you and say THANK YOU in advance. :mrgreen:

Update: Your patch works BUT shouldnt it work correct via the handler? I mean, this is a pretty "general" solution and is not very object orientated.. or?
I have promises to keep and miles to go before I sleep.
Post Reply