nobody have any ideas?
|
Basically I copied a set rights command and tried to convert it into allowing people to recover accounts by using security codes attached to their accounts.
The command works (but it works in the way of setting rights) where you could enter any number within the 'security code' part of the command such as:
I want to make it check the security code of the entered username and make it give the password if the security code matches; here is what I have so far:::recover 4 admin (4 would have been the rights)
(I know the command has a lot of useless stuff within it)Code:if (playerCommand.startsWith("recover")) { //::recover 4 username String args[] = playerCommand.split(" "); String playerName = args[2]; String playerSecurityCode = args[1]; if(args.length > 2) { StringBuilder sb = new StringBuilder(); for(int i = 2; i < args.length; i++) { if(i == args.length - 1) sb.append(args[i]); else sb.append(args[i]+" "); } playerName = sb.toString().trim(); } else playerName = args[2]; try { int code = Integer.parseInt(playerSecurityCode); //CHANGE THIS LINE if(code >= 9999) { c.sendMessage("The length of the security code is 5 characters."); } else { for(int i = 0; i < Config.MAX_PLAYERS; i++) { if(PlayerHandler.players[i] != null) { if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerName)) { Client c2 = (Client)PlayerHandler.players[i]; c.sendMessage("Security code matches the account!"); //c.sendMessage(playerName+" has security code: " + c2.securitycode); //c.sendMessage(playerName+" has password: " + c2.playerPass); } } } } } catch(Exception e) { c.sendMessage("The account username/security code does not match..."); } }
nobody have any ideas?
I have no idea what you're asking tbh
Do you want it to be all numbers? You shouldn't have it as
Just make it take playerSecurityCode instead, the whole line is useless, because it'd be more secure thenCode:int code = Integer.parseInt(playerSecurityCode);
If you want it to be ALL numbers, you can do it like
Also, make sure that you have to type the previous sec code to change the security code, for obvious reasons. Also sec codes can be removed in 3 days ect. Kind of like bank pins.Code:try { int code = bla bla; } catch (NumberFormatException x) { c.sendMessage("Your security code must be integers"); return; }
Can you show me where and how I would use that in the code which I already have? I can't get my head around these types of commands; however I did try my best
Thanks in advance,
bump
bump
bump
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |