I also need this ...
|
Starters should get saved in the starter folder, but it doesn't the folder is empty.
Here is the code in PlayerConstants.java
In PlayerSaveUtil.java:Code:public static void doStarter(Player player) { player.setAppearanceUpdateRequired(true); player.getEquipment().onLogin(); PlayerSaveUtil.setReceivedStarter(player); player.getRunEnergy().setRunning(true); player.setProfilePrivacy(false); }
Code:public static void setReceivedStarter(Player p) { BufferedWriter writer = null; BufferedReader reader = null; final String directory = STARTER_TRACK_FILE + p.getClient().getHost() + ".txt"; try { int amount = 1; if (new File(directory).exists()) { reader = new BufferedReader(new FileReader(directory)); try { amount += Integer.parseInt(reader.readLine()); } catch (Exception e) { e.printStackTrace(); } reader.close(); new File(directory).delete(); } writer = new BufferedWriter(new FileWriter(directory, true)); writer.write("" + amount); writer.close(); } catch (Exception e) { e.printStackTrace(); if (writer != null) { try { writer.close(); } catch (IOException e1) { e1.printStackTrace(); } } if (reader != null) { try { reader.close(); } catch (IOException e1) { e1.printStackTrace(); } } } finally { if (writer != null) try { writer.close(); } catch (IOException e) { e.printStackTrace(); } } }
I also need this ...
Bump
Any errors?
Add this method somewhere in Player.java
Code:public void saveStarterHostToFile() { BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter("./data/logs/starters/" + getClient().getHost() + ".txt", true)); writer.write("" + 1); writer.close(); } catch (Exception e) { } }
Find this in Player.java:
Code:if (starter) {
Remove everything inside that if block, and then add this instead:
Code:PlayerConstants.doStarter(this); saveStarterHostToFile();
Go to PlayerConstants.java and add this:
underCode:player.start(new Tutorial(player));
Code:player.setProfilePrivacy(false);
There is probably a way better/efficient way of doing this, but this works. Feel free to improve this in anyway you want.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |