Skip to content

Commit 99b1d65

Browse files
authored
Merge pull request #23 from Christian-Schefe/format-all-java
chore: format java code
2 parents a960a2e + 987a8c2 commit 99b1d65

26 files changed

+1567
-1688
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
playtakdb/
22

33
run
4-
run/**
4+
run/**
5+
6+
.idea

server/.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
7+
[*.java]
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
indent_style = tab
11+
indent_size = 4
12+
tab_width = 4
13+
max_line_length = 120
14+
ij_java_align_multiline_chained_methods = false
15+
ij_java_method_call_chain_wrap = on_every_item
16+
ij_java_prefer_parameters_wrap = false
17+
ij_java_array_initializer_wrap = split_into_lines
18+
ij_java_array_initializer_new_line_after_left_brace = true
19+
ij_java_array_initializer_right_brace_on_new_line = true
20+
ij_java_space_before_array_initializer_left_brace = true

server/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ WORKDIR /app
99
# Logged in users (not guests) will reconnected by the UI within ~12s.
1010

1111
# consider removing clean for slightly faster compilation
12-
ENTRYPOINT amvn clean package exec:java --watch
12+
ENTRYPOINT exec amvn clean package exec:java --watch
1313

1414
FROM base as production
1515
VOLUME /tmp

server/src/main/java/tak/ChatRoom.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,67 +5,67 @@
55
*/
66
package tak;
77

8-
import java.util.concurrent.ConcurrentHashMap;
98
import tak.utils.BadWordFilter;
109
import tak.utils.ConcurrentHashSet;
11-
import java.util.concurrent.locks.*;
10+
11+
import java.util.concurrent.ConcurrentHashMap;
12+
import java.util.concurrent.locks.Lock;
13+
import java.util.concurrent.locks.ReentrantLock;
1214

1315
/**
1416
*
1517
* @author chaitu
1618
*/
1719
public class ChatRoom {
1820
static final ConcurrentHashMap<String, ChatRoom> chatRooms = new ConcurrentHashMap<>();
19-
static Lock roommaplock=new ReentrantLock();
20-
21+
static Lock roommaplock = new ReentrantLock();
22+
2123
ConcurrentHashSet<Client> members;
22-
24+
2325
ChatRoom() {
24-
members = new ConcurrentHashSet<Client>();
26+
members = new ConcurrentHashSet<>();
2527
}
26-
27-
public static ChatRoom joinRoom(String name, Client client){
28+
29+
public static ChatRoom joinRoom(String name, Client client) {
2830
roommaplock.lock();
29-
try{
30-
ChatRoom room=chatRooms.get(name);
31-
if(room==null){
31+
try {
32+
ChatRoom room = chatRooms.get(name);
33+
if (room == null) {
3234
room = new ChatRoom();
3335
chatRooms.put(name, room);
3436
}
3537
room.members.add(client);
3638
return room;
37-
}
38-
finally{
39+
} finally {
3940
roommaplock.unlock();
4041
}
4142
}
42-
43-
public static void shout(String name, Client client, String msg) {
44-
ChatRoom room=chatRooms.get(name);
45-
if(room!=null){
46-
String compiledmessage="ShoutRoom "+name+" <"+client.player.getName()+"> "+ BadWordFilter.filterText(msg);
47-
if(!client.player.isGagged()) {
43+
44+
public static void shout(String name, Client client, String msg) {
45+
ChatRoom room = chatRooms.get(name);
46+
if (room != null) {
47+
String compiledmessage = "ShoutRoom " + name + " <" + client.player.getName() + "> " + BadWordFilter.filterText(msg);
48+
if (!client.player.isGagged()) {
4849
for (Client cc : room.members) {
4950
cc.sendWithoutLogging(compiledmessage);
5051
}
5152
} else {
52-
client.sendWithoutLogging("ShoutRoom "+name+" <"+client.player.getName()+"> <Server: You have been muted for inappropriate chat behavior.>");
53+
client.sendWithoutLogging("ShoutRoom " + name + " <" + client.player.getName() + "> <Server: You have been muted for inappropriate chat behavior.>");
5354
}
5455
}
5556
}
56-
57-
public static void leaveRoom(String name, Client client){
57+
58+
public static void leaveRoom(String name, Client client) {
5859
roommaplock.lock();
59-
try{
60-
ChatRoom room=chatRooms.get(name);
61-
if(room!=null){
60+
try {
61+
ChatRoom room = chatRooms.get(name);
62+
if (room != null) {
6263
room.members.remove(client);
63-
if(room.members.isEmpty()){
64+
if (room.members.isEmpty()) {
6465
chatRooms.remove(name);
6566
}
6667
}
67-
}
68-
finally{
68+
} finally {
6969
roommaplock.unlock();
7070
}
7171
}

0 commit comments

Comments
 (0)