Skip to content

Commit eb24dd9

Browse files
committed
fix: remove ID checks
just throws random errors from inconsistencies with CC's API, no reason for them really
1 parent a13b8d7 commit eb24dd9

3 files changed

Lines changed: 0 additions & 13 deletions

File tree

pojos/src/main/java/dev/qixils/crowdcontrol/socket/Request.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ public class Request implements JsonObject, Respondable {
8686
private Request(Request.@NotNull Builder builder) throws IllegalArgumentException {
8787
// validate request ID
8888
this.id = builder.id;
89-
if (this.id < 0)
90-
throw new IllegalArgumentException("ID cannot be negative");
9189

9290
// validate type & related arguments
9391
this.type = ExceptionUtil.validateNotNull(builder.type, "type");
@@ -126,10 +124,6 @@ private Request(Request.@NotNull Builder builder) throws IllegalArgumentExceptio
126124
throw new IllegalArgumentException("duration cannot be negative");
127125
this.duration = builder.duration;
128126
this.parameters = builder.parameters;
129-
if (this.id == 0 && this.type.usesIncrementalIds() == TriState.TRUE)
130-
throw new IllegalArgumentException("ID cannot be 0 for effect packets");
131-
if (this.id != 0 && this.type.usesIncrementalIds() == TriState.FALSE)
132-
throw new IllegalArgumentException("ID must be 0 for non-effect packets");
133127
if (this.type != Type.REMOTE_FUNCTION_RESULT && builder.value != null)
134128
throw new IllegalArgumentException("value cannot be non-null for non-remote function result packets");
135129
this.value = builder.value;

pojos/src/main/java/dev/qixils/crowdcontrol/socket/Response.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,6 @@ public class Response implements JsonObject {
113113
throw new IllegalArgumentException("type must not be a status if packetType is not EFFECT_STATUS");
114114
if (this.packetType == PacketType.EFFECT_STATUS && builder.ids.isEmpty())
115115
throw new IllegalArgumentException("ids cannot be empty if packetType is EFFECT_STATUS");
116-
if (this.packetType != PacketType.EFFECT_RESULT && this.id != 0)
117-
throw new IllegalArgumentException("id must be 0 if packetType is not EFFECT_RESULT");
118-
if (this.packetType == PacketType.EFFECT_RESULT && this.id == 0)
119-
throw new IllegalArgumentException("id must be non-zero if packetType is EFFECT_RESULT");
120116

121117
if (this.packetType == PacketType.REMOTE_FUNCTION && this.method == null)
122118
throw new IllegalArgumentException("method cannot be null if packetType is REMOTE_FUNCTION");

pojos/src/test/java/dev/qixils/crowdcontrol/socket/RequestTests.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ public void postProcessorTest() {
1919
public void constructorTest() {
2020
// new constructor tests //
2121

22-
// negative ID test
23-
Assertions.assertThrows(IllegalArgumentException.class,
24-
() -> new Request.Builder().id(-1).type(Request.Type.START).effect("summon").viewer("qixils").build());
2522
// null effect test
2623
Assertions.assertThrows(IllegalArgumentException.class,
2724
() -> new Request.Builder().id(1).type(Request.Type.START).viewer("qixils").build());

0 commit comments

Comments
 (0)