-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
046febd
commit 21d0bb4
Showing
15 changed files
with
425 additions
and
34 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,7 @@ | |
<artifactId>okhttp</artifactId> | ||
<version>4.9.0</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
package io.purecore.api.event; | ||
|
||
import io.purecore.api.versioning.Version; | ||
|
||
public interface Handler { | ||
|
||
void onConnected(); | ||
void onConnecting(); | ||
void onAuthenticating(); | ||
void onReconnecting(); | ||
void onConnectError(); | ||
void onSocketCreated(); | ||
void onDisconnected(); | ||
void onNewExecutions(); | ||
void onNewVersion(Version version); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package io.purecore.api.execution; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonObject; | ||
import io.purecore.api.Core; | ||
import io.purecore.api.call.ApiException; | ||
import io.purecore.api.call.Param; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ExecutionSuccess { | ||
|
||
public List<SimplifiedExecution> success; | ||
public List<SimplifiedExecution> fail; | ||
|
||
public ExecutionSuccess(JsonObject object){ | ||
this.success=new ArrayList<>(); | ||
for (JsonElement element: object.get("success").getAsJsonArray()){ | ||
this.success.add(new SimplifiedExecution(element.getAsJsonObject())); | ||
} | ||
|
||
this.fail=new ArrayList<>(); | ||
for (JsonElement element: object.get("fail").getAsJsonArray()){ | ||
this.fail.add(new SimplifiedExecution(element.getAsJsonObject())); | ||
} | ||
} | ||
|
||
public ExecutionSuccess(List<SimplifiedExecution> executions) throws IOException, ApiException { | ||
List<String> ids = new ArrayList<>(); | ||
for (SimplifiedExecution execution:executions){ | ||
ids.add(execution.getId()); | ||
} | ||
String jsonIds = new Gson().toJson(ids); | ||
JsonObject response = Core.call("/execution/batch/mark/").addParam(Param.SimplifiedCommandExecutions,jsonIds).commit().getAsJsonObject(); | ||
this.success=new ArrayList<>(); | ||
for (JsonElement element: response.get("success").getAsJsonArray()){ | ||
this.success.add(new SimplifiedExecution(element.getAsJsonObject())); | ||
} | ||
|
||
this.fail=new ArrayList<>(); | ||
for (JsonElement element: response.get("fail").getAsJsonArray()){ | ||
this.fail.add(new SimplifiedExecution(element.getAsJsonObject())); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.