mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-10-31 09:13:43 +01:00 
			
		
		
		
	save() added to PlayerProfile, won't compile as is. But this should do the trick for us.
This commit is contained in:
		| @@ -235,6 +235,33 @@ class PlayerList | |||||||
| 	        } catch (Exception e) { | 	        } catch (Exception e) { | ||||||
| 	            log.log(Level.SEVERE, "Exception while reading " + location + " (Are you sure you formatted it correctly?)", e); | 	            log.log(Level.SEVERE, "Exception while reading " + location + " (Are you sure you formatted it correctly?)", e); | ||||||
| 	        } | 	        } | ||||||
|  |             //===================================================================== | ||||||
|  |         // Function:    save | ||||||
|  |         // Input:       none | ||||||
|  |         // Output:      Writes current values of PlayerProfile to disk | ||||||
|  |         // Use:         Call this function to save current values | ||||||
|  |         //===================================================================== | ||||||
|  |         public void save(){ | ||||||
|  |             try { | ||||||
|  |                 String location = "vminecraftusers.txt"; | ||||||
|  |                 BufferedWriter bw = new BufferedWriter(new FileWriter(location, true)); | ||||||
|  |                 Scanner scanner = new Scanner(new File(location)); | ||||||
|  |                 while (scanner.hasNextLine()) { | ||||||
|  | 	                String line = scanner.nextLine(); | ||||||
|  | 	                if (line.startsWith("#") || line.equals("") || line.startsWith("")) { | ||||||
|  | 	                    continue; | ||||||
|  | 	                } | ||||||
|  | 	                String[] split = line.split(":"); | ||||||
|  | 	                if (!split[0].equalsIgnoreCase(playerName.toString())) { | ||||||
|  | 	                    continue; | ||||||
|  | 	                } | ||||||
|  | 	                bw.write(playerName + ":" + nickName + ":" + suffix + ":" + tag + ":" + ignoreList + ":" + aliasList); | ||||||
|  | 	            } | ||||||
|  | 	            scanner.close(); | ||||||
|  | 	        } catch (Exception e) { | ||||||
|  | 	            String location = "vminecraftusers.txt"; | ||||||
|  |                     log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e); | ||||||
|  | 	        } | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		//===================================================================== | 		//===================================================================== | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 nossr50
					nossr50