Fix Save/Loading Profiles

This commit is contained in:
Julia Butenhoff 2022-07-19 17:24:07 -05:00
parent 45de7b5baa
commit 777fcd8ffb
4 changed files with 7 additions and 2 deletions

3
.gitignore vendored
View File

@ -35,3 +35,6 @@ build/
### VS Code ###
.vscode/
### Funkey Profiles ###
profiles/**/*

View File

@ -64,6 +64,7 @@ public class ArkOneSender {
public void SendToUser(UUID clientId, String message) {
for (Connection conn : server.getConnections()) {
if (conn.getClientIdentifier() == clientId) {
System.out.println("Found");
try {
// Append a 0x00 to the end of the response
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@ -70,7 +70,7 @@ public class GalaxyPlugin {
String saveID = rootSave.getAttribute("sid");
subElement.setAttribute("v", saveID);
}
resp.appendChild(subElement);
rootElement.appendChild(subElement);
// Build response
return ArkOneParser.RemoveXMLTag(resp);
@ -82,7 +82,6 @@ public class GalaxyPlugin {
public String SaveProfile(Element element, Connection connection) {
// Set the number of chunks left to save
//TODO: VERIFY THIS ATTRIBUTE NAME
connection.setChunksLeft(Integer.valueOf(element.getAttribute("c")));
// Clear save data

View File

@ -28,7 +28,9 @@ public class FileServiceImpl implements FileService {
@Override
public void save(MultipartFile file, String subDir) {
System.out.println("here");
try {
Files.createDirectories(fileStorageLocation.resolve(subDir));
Files.copy(file.getInputStream(), fileStorageLocation.resolve(subDir).resolve(file.getOriginalFilename()), StandardCopyOption.REPLACE_EXISTING);
} catch(Exception e) {
throw new RuntimeException("Could not store the file. Error: " + e.getMessage());