use of com.solinia.solinia.Interfaces.ISoliniaPatch in project solinia3-core by mixxit.
the class Utils method patchNpcClasses.
private static void patchNpcClasses() {
try {
for (ISoliniaPatch patch : StateManager.getInstance().getConfigurationManager().getPatches()) {
// Lookup npc and edit class
String npcName = patch.getClasses().get(0);
int rawClassId = Integer.parseInt(patch.getClasses().get(1));
int convertedClass = convertRawClassToClass(rawClassId);
ISoliniaNPC npc = StateManager.getInstance().getConfigurationManager().getPetNPCByName(npcName);
if (npc == null)
continue;
npc.setClassid(convertedClass);
System.out.println("Updated NPC: " + npc.getName() + " to class " + convertedClass);
}
} catch (CoreStateInitException e) {
// skip
}
}
use of com.solinia.solinia.Interfaces.ISoliniaPatch in project solinia3-core by mixxit.
the class JsonPatchRepository method reload.
@Override
public void reload() {
List<ISoliniaPatch> file = new ArrayList<ISoliniaPatch>();
try {
Gson gson = new Gson();
BufferedReader br = new BufferedReader(new FileReader(filePath));
file = gson.fromJson(br, new TypeToken<List<SoliniaPatch>>() {
}.getType());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
patches.clear();
for (ISoliniaPatch i : file) {
patches.put(i.getId(), i);
}
System.out.println("Reloaded " + patches.size() + " Patchs");
}
Aggregations