mirror of
https://github.com/Leahnaya/UBFunkeysServer.git
synced 2026-04-21 07:57:30 -05:00
Fixed many User Plugin issues
Remaining problems: - Add Buddy - GetLeaderboardStats (TEST)
This commit is contained in:
parent
777fcd8ffb
commit
91bf75c040
|
|
@ -166,6 +166,7 @@ public class ArkOneController implements TcpHandler {
|
|||
if (user != null) {
|
||||
// Update the online status to offline and clear the connection ID
|
||||
user.setIsOnline(0);
|
||||
user.setChatStatus(0);
|
||||
user.setConnectionId(null);
|
||||
|
||||
// Update the user in the DB
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ public class ArkOneSender {
|
|||
|
||||
public void SendStatusUpdate(String statusHeader, String shortHeader, String status, Integer userUUID)
|
||||
throws ParserConfigurationException, TransformerException {
|
||||
// No need to announce with no buddies
|
||||
if (userService.getBuddyList(userUUID) == null) {
|
||||
return;
|
||||
}
|
||||
ArrayList<String> buddyList = new ArrayList<>(Arrays.asList(userService.getBuddyList(userUUID).split(",")));
|
||||
|
||||
for (String buddy : buddyList) {
|
||||
|
|
@ -63,7 +67,7 @@ public class ArkOneSender {
|
|||
|
||||
public void SendToUser(UUID clientId, String message) {
|
||||
for (Connection conn : server.getConnections()) {
|
||||
if (conn.getClientIdentifier() == clientId) {
|
||||
if (conn.getClientIdentifier().equals(clientId)) {
|
||||
System.out.println("Found");
|
||||
try {
|
||||
// Append a 0x00 to the end of the response
|
||||
|
|
|
|||
|
|
@ -188,6 +188,10 @@ public class BasePlugin {
|
|||
// Store the UUID for our connection to the server to the DB
|
||||
user.setConnectionId(connectionId);
|
||||
|
||||
// Set they are online now
|
||||
user.setChatStatus(0);
|
||||
user.setIsOnline(1);
|
||||
|
||||
// Save to local map and update DB
|
||||
userService.updateUserOnServer(connectionId, user);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -375,7 +375,12 @@ public class UserPlugin {
|
|||
} else {
|
||||
buddy.setRawBuddyList("");
|
||||
}
|
||||
userService.updateUserOnServer(buddy.getConnectionId(), buddy);
|
||||
if (buddy.getIsOnline() == 1) {
|
||||
userService.updateUserOnServer(buddy.getConnectionId(), buddy);
|
||||
} else {
|
||||
userService.save(buddy);
|
||||
}
|
||||
|
||||
|
||||
ArrayList<String> buddyList2 = new ArrayList<>(Arrays.asList(thisUser.getRawBuddyList().split(",")));
|
||||
buddyList2.remove(String.valueOf(buddy.getUUID()));
|
||||
|
|
|
|||
|
|
@ -63,8 +63,16 @@ public class User {
|
|||
|
||||
// Buddy Lists
|
||||
@Column(name = "buddyList")
|
||||
private String rawBuddyList;
|
||||
private String rawBuddyList = "";
|
||||
|
||||
// Connection ID to send data to from other Users
|
||||
private java.util.UUID connectionId;
|
||||
private String connectionId = "";
|
||||
|
||||
public java.util.UUID getConnectionId() {
|
||||
return java.util.UUID.fromString(connectionId);
|
||||
}
|
||||
|
||||
public void setConnectionId(java.util.UUID newUUID) {
|
||||
connectionId = newUUID.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ 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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user