Skip to content

Commit 5d3836c

Browse files
committed
fix: Id lacking equals/hashCode
1 parent bbb35fc commit 5d3836c

7 files changed

Lines changed: 40 additions & 16 deletions

File tree

USAGE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Add to the `dependencies` section of your `pom.xml` file:
4242
<dependency>
4343
<groupId>dev.qixils.crowdcontrol</groupId>
4444
<artifactId>crowd-control-receiver</artifactId>
45-
<version>3.7.0</version>
45+
<version>3.7.1</version>
4646
</dependency>
4747
```
4848

@@ -54,13 +54,13 @@ Add to the `dependencies` section of your `pom.xml` file:
5454
Add to the `dependencies` section of your `build.gradle` file:
5555

5656
```gradle
57-
compileOnly 'dev.qixils.crowdcontrol:crowd-control-receiver:3.7.0'
57+
compileOnly 'dev.qixils.crowdcontrol:crowd-control-receiver:3.7.1'
5858
```
5959

6060
Or, if using Kotlin (`build.gradle.kts`):
6161

6262
```kts
63-
compileOnly("dev.qixils.crowdcontrol:crowd-control-receiver:3.7.0")
63+
compileOnly("dev.qixils.crowdcontrol:crowd-control-receiver:3.7.1")
6464
```
6565

6666
</details>
@@ -281,7 +281,7 @@ Add to the `dependencies` section of your `pom.xml` file:
281281
<dependency>
282282
<groupId>dev.qixils.crowdcontrol</groupId>
283283
<artifactId>crowd-control-sender</artifactId>
284-
<version>3.7.0</version>
284+
<version>3.7.1</version>
285285
</dependency>
286286
```
287287

@@ -293,13 +293,13 @@ Add to the `dependencies` section of your `pom.xml` file:
293293
Add to the `dependencies` section of your `build.gradle` file:
294294

295295
```gradle
296-
compileOnly 'dev.qixils.crowdcontrol:crowd-control-sender:3.7.0'
296+
compileOnly 'dev.qixils.crowdcontrol:crowd-control-sender:3.7.1'
297297
```
298298

299299
Or, if using Kotlin (`build.gradle.kts`):
300300

301301
```kts
302-
compileOnly("dev.qixils.crowdcontrol:crowd-control-sender:3.7.0")
302+
compileOnly("dev.qixils.crowdcontrol:crowd-control-sender:3.7.1")
303303
```
304304

305305
</details>

pojos/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>java-crowd-control</artifactId>
77
<groupId>dev.qixils.crowdcontrol</groupId>
8-
<version>3.7.0</version>
8+
<version>3.7.1</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

@@ -19,7 +19,7 @@
1919
<developerConnection>scm:git:https://github.com/qixils/java-crowd-control
2020
</developerConnection>
2121
<url>https://github.com/qixils/java-crowd-control.git</url>
22-
<tag>v3.7.0</tag>
22+
<tag>v3.7.1</tag>
2323
</scm>
2424
<licenses>
2525
<license>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>dev.qixils.crowdcontrol</groupId>
99
<artifactId>java-crowd-control</artifactId>
10-
<version>3.7.0</version> <!-- don't forget to update scm tags & submodule versions -->
10+
<version>3.7.1</version> <!-- don't forget to update scm tags & submodule versions -->
1111
<packaging>pom</packaging>
1212

1313
<modules>
@@ -25,7 +25,7 @@
2525
<developerConnection>scm:git:https://github.com/qixils/java-crowd-control
2626
</developerConnection>
2727
<url>https://github.com/qixils/java-crowd-control.git</url>
28-
<tag>v3.7.0</tag>
28+
<tag>v3.7.1</tag>
2929
</scm>
3030
<licenses>
3131
<license>

receiver/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>java-crowd-control</artifactId>
77
<groupId>dev.qixils.crowdcontrol</groupId>
8-
<version>3.7.0</version>
8+
<version>3.7.1</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

@@ -20,7 +20,7 @@
2020
<developerConnection>scm:git:https://github.com/qixils/java-crowd-control
2121
</developerConnection>
2222
<url>https://github.com/qixils/java-crowd-control.git</url>
23-
<tag>v3.7.0</tag>
23+
<tag>v3.7.1</tag>
2424
</scm>
2525
<licenses>
2626
<license>

receiver/src/main/java/dev/qixils/crowdcontrol/socket/Id.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import org.jetbrains.annotations.Nullable;
66

77
import java.util.Locale;
8+
import java.util.Objects;
9+
10+
import static dev.qixils.crowdcontrol.util.StringUtils.repr;
811

912
class Id {
1013
public final @NotNull String id;
@@ -14,4 +17,25 @@ public Id(@NotNull String id, @Nullable IdType type) {
1417
this.id = id.toLowerCase(Locale.ENGLISH);
1518
this.type = ExceptionUtil.validateNotNullElse(type, IdType.EFFECT);
1619
}
20+
21+
@Override
22+
public boolean equals(Object o) {
23+
if (this == o) return true;
24+
if (o == null || getClass() != o.getClass()) return false;
25+
Id other = (Id) o;
26+
return id.equals(other.id) && type == other.type;
27+
}
28+
29+
@Override
30+
public int hashCode() {
31+
return Objects.hash(id, type);
32+
}
33+
34+
@Override
35+
public String toString() {
36+
return "Id{" +
37+
"id=" + repr(id) +
38+
", type=" + type +
39+
'}';
40+
}
1741
}

sender/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>java-crowd-control</artifactId>
77
<groupId>dev.qixils.crowdcontrol</groupId>
8-
<version>3.7.0</version>
8+
<version>3.7.1</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

@@ -20,7 +20,7 @@
2020
<developerConnection>scm:git:https://github.com/qixils/java-crowd-control
2121
</developerConnection>
2222
<url>https://github.com/qixils/java-crowd-control.git</url>
23-
<tag>v3.7.0</tag>
23+
<tag>v3.7.1</tag>
2424
</scm>
2525
<licenses>
2626
<license>

tests/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>java-crowd-control</artifactId>
77
<groupId>dev.qixils.crowdcontrol</groupId>
8-
<version>3.7.0</version>
8+
<version>3.7.1</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

@@ -20,7 +20,7 @@
2020
<developerConnection>scm:git:https://github.com/qixils/java-crowd-control
2121
</developerConnection>
2222
<url>https://github.com/qixils/java-crowd-control.git</url>
23-
<tag>v3.7.0</tag>
23+
<tag>v3.7.1</tag>
2424
</scm>
2525
<licenses>
2626
<license>

0 commit comments

Comments
 (0)