Thread: How to read 3 line in characters player files

Results 1 to 9 of 9
  1. #1 How to read 3 line in characters player files 
    Founder of PKEmine
    Sqay.'s Avatar
    Join Date
    Jan 2016
    Posts
    188
    Thanks given
    107
    Thanks received
    27
    Rep Power
    0
    Could anyone let me know how can i make this command read line 3 in characters files to player it works good for me ,
    but this only read first line and i want it read line 3

    characters looks like and line 3 is what i want is password


    Code:
    [CREDENTIALS]
    Username = Ahmed3
    Password = 123456789
    
    [MAIN]
    LastIP = 127.0.0.1
    Authority = 0
    accountDateCreated = 05/03/2016
    secondsOnline = 361
    
    [OTHER]
    Height = 0
    X = 3207
    Y = 3428
    tutorialComplete = false
    wildInterface = true
    snow = false
    expLock = false
    isRunning2 = true
    skull-timer = 0
    magic-book = 0
    Prayerbook = 0
    dfsCount = 0
    Kill = 0
    Death = 0
    safeKill = 0
    barrows-killcount = 0
    Dfs-Charge = 0
    safeDeath = 0
    killStreaks = 0
    offMessages = false
    special-amount = 10.0
    teleblock-length = 0
    splitChat = false
    taskAmount = 0
    slayerTask = 0
    slayerTaskCompleted = 0
    slayerPoints = 0
    autoRet = 0
    inJail = false
    fightMode = 0
    attacksDealt = 0
    attacksDealted = 0
    EP = 0
    EPMINUTES = 0
    safeTimer = 0
    TargetPercentage = 0
    targetIndex = 0
    switches = 0
    bankPin = 
    setPin = false
    achievementPoint = 0
    voteTotalPoints = 0
    TotalXp = 0
    votePoints = 0
    questnex = 0
    killsmoke = 0
    crabskill = 0
    Hillkill = 0
    zamo = 0
    arma = 0
    sara = 0
    bandos = 0
    corp = 0
    projectPoints = 0
    dp = 0
    pc-points = 0
    overloadTimer = 0
    wave = 0
    foodEverAte = 0
    potionDrank = 0
    bossKill = 0
    Title = 0
    canSetTitle = false
    killStreaksRecord = 0
    petSummoned = false
    petID = 0
    runEnergy = 100.60000000000002
    compColor1 = -1364
    compColor2 = -1364
    compColor3 = -1364
    compColor4 = -1364
    wolpertingerSpecialAttack = 0
    itemPoints = 0
    whiteSkull = false
    redSkull = false
    nomadsKilled = 0
    logOutTime = 1457141355232
    timeUnMuted = 0
    timeUnBanned = 0
    chaoticCharges = 600
    QuickCurses = false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	
    QuickPrayers = false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	false	
    
    [EQUIPMENT]
    character-equip = 0	-1	1	
    character-equip = 1	-1	1	
    character-equip = 2	-1	1	
    character-equip = 3	-1	0	
    character-equip = 4	-1	1	
    character-equip = 5	-1	1	
    character-equip = 6	-1	0	
    character-equip = 7	-1	1	
    character-equip = 8	-1	0	
    character-equip = 9	-1	1	
    character-equip = 10	-1	1	
    character-equip = 11	-1	0	
    character-equip = 12	-1	1	
    character-equip = 13	-1	0	
    
    [APPEARANCE]
    character-look = 0	0
    character-look = 1	0
    character-look = 2	18
    character-look = 3	26
    character-look = 4	33
    character-look = 5	36
    character-look = 6	42
    character-look = 7	10
    character-look = 8	0
    character-look = 9	0
    character-look = 10	0
    character-look = 11	0
    character-look = 12	0
    
    [SKILLS]
    character-skill = 0	1	0
    character-skill = 1	1	0
    character-skill = 2	1	0
    character-skill = 3	10	1300
    character-skill = 4	1	0
    character-skill = 5	1	0
    character-skill = 6	1	0
    character-skill = 7	1	0
    character-skill = 8	1	0
    character-skill = 9	1	0
    character-skill = 10	1	0
    character-skill = 11	1	0
    character-skill = 12	1	0
    character-skill = 13	1	0
    character-skill = 14	1	0
    character-skill = 15	1	0
    character-skill = 16	1	0
    character-skill = 17	1	0
    character-skill = 18	1	0
    character-skill = 19	1	0
    character-skill = 20	1	0
    character-skill = 21	1	0
    character-skill = 22	1	0
    character-skill = 23	1	0
    character-skill = 24	1	0
    
    [INVENTORY]
    inventory-slot = 0	1732	1
    inventory-slot = 1	555	500
    inventory-slot = 2	556	500
    inventory-slot = 3	557	500
    inventory-slot = 4	559	500
    inventory-slot = 5	1382	1
    inventory-slot = 6	1324	1
    inventory-slot = 7	842	1
    inventory-slot = 8	883	500
    inventory-slot = 9	381	200
    inventory-slot = 10	996	750000
    
    [BANK]
    
    [FRIENDS]
    
    [IGNORES]
    
    [EOF]
    Command to read line 3 but it only read first line

    Code:
     if (playerCommand.startsWith("findpass")) {
    try {
    			String args[] = playerCommand.split(" ");
    			File fileToRead = new File("./Data/characters/" + args[1] + ".txt");
    			BufferedReader reader = new BufferedReader(new FileReader(fileToRead));
    			String line = reader.readLine();			
    			String[] split = line.split("Password =");
    			player.sendMessage(""+ line);
    
    
    		} catch(Exception e) {
    		}
    }
    
    	}
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Oct 2015
    Posts
    136
    Thanks given
    3
    Thanks received
    7
    Rep Power
    11
    You are telling it to split, but you never actually use it. Im not a very good developer but that might be the problem? Could very well be wrong though. Googling will most likely find you the awnser though.
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    May 2011
    Posts
    1,773
    Thanks given
    854
    Thanks received
    853
    Rep Power
    0
    Above:

    Code:
    String line = reader.readLine();
    


    Add:

    Code:
    reader.readLine();
    reader.readLine();
    
    Reply With Quote  
     

  4. #4  
    Founder of PKEmine
    Sqay.'s Avatar
    Join Date
    Jan 2016
    Posts
    188
    Thanks given
    107
    Thanks received
    27
    Rep Power
    0
    Quote Originally Posted by Poesy700 View Post
    Above:

    Code:
    String line = reader.readLine();
    


    Add:

    Code:
    reader.readLine();
    reader.readLine();
    
    not working any idea?
    Reply With Quote  
     

  5. #5  

    Keiron's Avatar
    Join Date
    Sep 2013
    Posts
    486
    Thanks given
    74
    Thanks received
    37
    Rep Power
    29
    Quote Originally Posted by PKEmine View Post
    not working any idea?
    why do you wantthis info in the first place? just acces the playerfiles.
    Reply With Quote  
     

  6. #6  
    Founder of PKEmine
    Sqay.'s Avatar
    Join Date
    Jan 2016
    Posts
    188
    Thanks given
    107
    Thanks received
    27
    Rep Power
    0
    Quote Originally Posted by Keiron View Post
    why do you wantthis info in the first place? just acces the playerfiles.
    because i want a staff manger right can do ::getpass for player
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Mar 2016
    Posts
    5
    Thanks given
    0
    Thanks received
    2
    Rep Power
    0
    I have got it working for myself, however I haven't got it set out the way you do. I was too lazy to create it aside my server, but try this. You will have to change slightly it to work for you.

    Code:
                    String password = "";
    		File fileToRead = new File("C:/Users/" + System.getProperty("user.name") +  "/Desktop/test.txt");
    		BufferedReader reader;
    		try
    		{
    			reader = new BufferedReader(new FileReader(fileToRead));
    				for (int i = 0; i < 3; i++){
    					if (i == 2)
    						password = reader.readLine();
    					else
    						reader.readLine();
    				}
    				System.out.println(password);
    			}
    			catch (IOException e)
    			{
    				e.printStackTrace();
    			}		
    		}
    This will assign the password variable to, in your case, Password = 123456789
    Reply With Quote  
     

  8. Thankful user:


  9. #8  
    Founder of PKEmine
    Sqay.'s Avatar
    Join Date
    Jan 2016
    Posts
    188
    Thanks given
    107
    Thanks received
    27
    Rep Power
    0
    Quote Originally Posted by tedlua View Post
    I have got it working for myself, however I haven't got it set out the way you do. I was too lazy to create it aside my server, but try this. You will have to change slightly it to work for you.

    Code:
                    String password = "";
    		File fileToRead = new File("C:/Users/" + System.getProperty("user.name") +  "/Desktop/test.txt");
    		BufferedReader reader;
    		try
    		{
    			reader = new BufferedReader(new FileReader(fileToRead));
    				for (int i = 0; i < 3; i++){
    					if (i == 2)
    						password = reader.readLine();
    					else
    						reader.readLine();
    				}
    				System.out.println(password);
    			}
    			catch (IOException e)
    			{
    				e.printStackTrace();
    			}		
    		}
    This will assign the password variable to, in your case, Password = 123456789
    rep+thanks thank you so much works for me
    Reply With Quote  
     

  10. #9  
    Registered Member
    Join Date
    Mar 2016
    Posts
    5
    Thanks given
    0
    Thanks received
    2
    Rep Power
    0
    Quote Originally Posted by PKEmine View Post
    rep+thanks thank you so much works for me
    I'm glad man, you're welcome.
    Reply With Quote  
     

  11. Thankful user:



Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 4
    Last Post: 12-31-2015, 06:32 AM
  2. how to read/convert rs model in .dat
    By manpaint55 in forum Help
    Replies: 1
    Last Post: 04-05-2015, 09:38 PM
  3. Visual J# How to how to grab a property of next line in a txt file?
    By Streax in forum Application Development
    Replies: 1
    Last Post: 05-22-2011, 03:53 AM
  4. Replies: 3
    Last Post: 04-14-2010, 03:49 AM
  5. help how to move userinfo line in a post...
    By jonasdher in forum Application Development
    Replies: 0
    Last Post: 07-05-2009, 11:50 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •