I decided about an hour ago to come back to RsPs haha, leaving the 317 scene for this revision where I hopefully won't have to hardcode client content into lower revision clients. Been planning a collaboration/repository update system for development, needed some way of standardizing patch notes/authors.
Here is what I did for my server:
Code:
package com.rs;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
/**
* @author Benji
* Stores commit-specific data and handles revision-related queries
*/
public final class Runehub {
/** constant value, set per revision */
public static final String revisionID = "1.0";
/** constant, referenceable HashMap with a String key (in this case, the revision ID) tied to an arraylist of strings - patch notes for that revision id, contributor for that revision id, etc)*/
private static final Map<String, ArrayList<String>> updateNotes = new HashMap<String, ArrayList<String>>();
public static final void init() {
/** Load patch notes into string collection */
/** loadNotes is put in try-catch because the method throws IOException if it runs into errors */
try {
loadNotes();
System.out.println(updateNotes);
} catch(IOException io) {
System.out.println("Unable to load patch note files.");
}
}
private static void loadNotes() throws IOException {
/** first three lines takes the revision string, e.g. "1.0" and splits the string around the period, giving us a string array with two strings, "1" and "0", or the revision or version values */
String[] values = revisionID.split("\\.");
int revisionnumber = Integer.parseInt(values[0]);
int versionnumber = Integer.parseInt(values[1]);
/** two nested for loops follow, looping through all the revisions (1, 2, 3, and so on) and the individual version of each revision (1.2, 1.24, 3.6, and so on)
for(int r = 1; r <= revisionnumber; r++) {
for(int i = 0; i <= versionnumber; i++) {
String versionIndex = Integer.toString(r) + "." + Integer.toString(i);
File notetxt = new File("resources/notes/" + versionIndex + ".txt");
if(notetxt.exists()) {
ArrayList<String> info = new ArrayList<String>();
String currentline;
BufferedReader bufferedReader = new BufferedReader(new FileReader(notetxt));
/** loops through every line fed to us by the bufferedReader of the txt and adds it to the expandable arraylist we declared earlier */
while ((currentline = bufferedReader.readLine()) != null) {
info.add(currentline);
}
/** stuffs the loaded arraylist into our original hashmap with the revision id serving as the key, or the initial slot */
updateNotes.put(versionIndex, info);
bufferedReader.close();
} else {
/** this is in case there is no patch note txt for the particular version, so we skip this iteration of the version number for the next, e.g from 1.0 to 1.1 */
continue;
}
}
}
}
public static final String currentNotes() {
return updateNotes.get(revisionID).get(0);
}
public static final String retrieveNote(String revision) {
return updateNotes.get(revision).get(0);
}
public static final String currentContributor() {
return updateNotes.get(revisionID).get(1);
}
public static final String specificContributor(String revision) {
return updateNotes.get(revision).get(1);
}
}
Remove your latest update crap in class Settings and replace the login stuff with something nice (I used that interface ids someone released in this section) that references the static values current/specific author and current/retrieveNote notes.
Oh yea and create a folder resources, another folder notes inside that, then txt files with revision history number titles.
Since I used an arraylist/while loop for loading the files, you can add as many lines of extra info (I was thinking repository commit comments for mine) in the txt and just reference them with get (line index).
Pictures:

using println to output the contents of the arraylist, the raw output

patch notes themselves
P.S. can someone tell me where projectile handling is done in Matrix? downloaded the source/got into 503+ devo today and I'm still getting used to the structure