Skip to content

Commit 0e4dc8c

Browse files
authored
Merge pull request #185 from rheimus/master
Sync changes
2 parents e1ca753 + f8b9dda commit 0e4dc8c

File tree

4 files changed

+39
-42
lines changed

4 files changed

+39
-42
lines changed

src/main/java/com/superzanti/serversync/client/ClientWorker.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
import com.superzanti.serversync.SyncConfig;
66
import com.superzanti.serversync.config.IgnoredFilesMatcher;
77
import com.superzanti.serversync.filemanager.FileManager;
8-
import com.superzanti.serversync.util.enums.EFileProccessingStatus;
98
import com.superzanti.serversync.server.Server;
109
import com.superzanti.serversync.util.Logger;
10+
import com.superzanti.serversync.util.enums.EFileProccessingStatus;
1111

1212
import java.io.IOException;
1313
import java.nio.file.*;
1414
import java.nio.file.attribute.BasicFileAttributes;
15-
import java.util.*;
15+
import java.util.ArrayList;
16+
import java.util.HashMap;
17+
import java.util.List;
18+
import java.util.Map;
1619
import java.util.concurrent.atomic.AtomicInteger;
1720
import java.util.stream.Collectors;
1821

@@ -37,7 +40,6 @@ public class ClientWorker implements Runnable {
3740
private List<String> managedDirectories = new ArrayList<>(0);
3841

3942
private SyncConfig config = SyncConfig.getConfig();
40-
private FileManager fileManager = new FileManager();
4143

4244
@Override
4345
public void run() {

src/main/java/com/superzanti/serversync/gui/GUI_Client.java

+1-35
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ TitledBorder.LEADING, TitledBorder.TOP, null, new Color(255, 255, 255)
130130

131131
add(root);
132132

133-
// Listeners
134-
B_sync.addActionListener(e -> publishSyncPressed());
135-
136133
TF_ipAddress.addKeyListener(new KeyListener() {
137134

138135
@Override
@@ -161,7 +158,6 @@ public void keyTyped(java.awt.event.KeyEvent e) {
161158
public void keyReleased(java.awt.event.KeyEvent e) {
162159
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
163160
requestFocus();
164-
publishSyncPressed();
165161
}
166162
}
167163

@@ -249,44 +245,14 @@ public void updateFileProgress(String message, int progress) {
249245
public void enableSyncButton() {
250246
SwingUtilities.invokeLater(() -> {
251247
B_sync.setEnabled(true);
252-
B_sync.setText("Sync");
248+
B_sync.setText(ServerSync.strings.getString("go_button"));
253249
});
254250
}
255251

256252
public void disableSyncButton() {
257253
SwingUtilities.invokeLater(() -> B_sync.setEnabled(false));
258254
}
259255

260-
public void toggleSyncButton() {
261-
SwingUtilities.invokeLater(() -> {
262-
if (B_sync.isEnabled()) {
263-
B_sync.setEnabled(false);
264-
} else {
265-
B_sync.setEnabled(true);
266-
B_sync.setText("Sync");
267-
}
268-
});
269-
}
270-
271-
public interface SyncPressedListener {
272-
void onSyncPressed();
273-
}
274-
275-
private SyncPressedListener listener;
276-
277-
public void setSyncPressedListener(SyncPressedListener listener) {
278-
this.listener = listener;
279-
}
280-
281-
private boolean publishSyncPressed() {
282-
if (this.listener != null) {
283-
this.listener.onSyncPressed();
284-
return true;
285-
}
286-
287-
return false;
288-
}
289-
290256
public String getIPAddress() {
291257
return this.TF_ipAddress.getText();
292258
}

src/main/java/com/superzanti/serversync/gui/GUI_Client_Mock.java

-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ public void enableSyncButton() {
2828
public void disableSyncButton() {
2929
}
3030

31-
@Override
32-
public void toggleSyncButton() {
33-
}
34-
3531
@Override
3632
public String getIPAddress() {
3733
return SyncConfig.getConfig().SERVER_IP;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
title=ServerSync
2+
server_address=IP Address
3+
server_port=Port
4+
go_button=Sync
5+
button_tooltip=Synchronize client & server
6+
console_title=Information
7+
ignoring=Ignoring
8+
delete_success=deleted
9+
message_file_failed_to_sync=One or more files failed to sync!
10+
message_file_failed_to_delete=One or more files failed to delete!
11+
message_file_failed_to_access=Failed to access file
12+
message_attempting_sync_retry=Attempting to retry sync...
13+
message_attempting_delete_retry=Attempting to retry delete...
14+
message_manual_action_required=Failed to process files, manual action required!
15+
message_client_refused_file=Refused file
16+
connection_message=Connecting to server
17+
connection_failed_host=Could not connect to host
18+
connection_failed_server=Could not connect to server at
19+
connection_attempt_server=Establishing a socket connection to the server...
20+
update_not_needed=No update needed, for a full log check the logs folder in the minecraft directory
21+
update_happened=Files updated
22+
update_start=Starting Update Process
23+
update_complete=Update Complete! Have a nice day!
24+
update_success=Successfully updated
25+
update_error=Errors occurred, please check ip/port details are correct. For a detailed log check the logs folder in your minecraft directory
26+
delete_start=Starting deletion process
27+
debug_IO_streams=Creating input/output streams...
28+
debug_IO_streams_failed=Failed to obtain input/output streams from client
29+
debug_server_exit=Telling server to exit...
30+
debug_server_close=Closing connections...
31+
debug_server_close_success=All of ServerSync's sockets to the server have been closed
32+
server_message_file_missing=File: %s has gone missing!
33+
server_message_file_permission_denied=File: %s says permission denied

0 commit comments

Comments
 (0)