mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
[FEATURE] Реализация ResultInterface классами RequestEvent
This commit is contained in:
parent
92cb0b0628
commit
8726988291
13 changed files with 71 additions and 14 deletions
|
@ -4,6 +4,7 @@
|
|||
import com.google.gson.GsonBuilder;
|
||||
import ru.gravit.launcher.hasher.HashedEntry;
|
||||
import ru.gravit.launcher.hasher.HashedEntryAdapter;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ru.gravit.launcher.request.websockets;
|
||||
|
||||
import com.google.gson.*;
|
||||
import ru.gravit.launcher.request.update.LauncherRequest;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package ru.gravit.launcher.request.websockets;
|
||||
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class WaitEventHandler implements ClientWebSocketService.EventHandler {
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
|
||||
import ru.gravit.launcher.ClientPermissions;
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class AuthRequestEvent implements EventInterface {
|
||||
public class AuthRequestEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID uuid = UUID.fromString("77e1bfd7-adf9-4f5d-87d6-a7dd068deb74");
|
||||
public AuthRequestEvent() {
|
||||
}
|
||||
|
@ -20,4 +21,9 @@ public AuthRequestEvent() {
|
|||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "auth";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BatchProfileByUsernameRequestEvent implements EventInterface
|
||||
public class BatchProfileByUsernameRequestEvent implements EventInterface, ResultInterface
|
||||
{
|
||||
private static final UUID uuid = UUID.fromString("c1d6729e-be2c-48cc-b5ae-af8c012232c3");
|
||||
public String requesttype = "batchProfileByUsername";
|
||||
|
@ -15,4 +16,9 @@ public class BatchProfileByUsernameRequestEvent implements EventInterface
|
|||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "batchProfileByUsername";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class CheckServerEvent implements EventInterface {
|
||||
public class CheckServerEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID _uuid = UUID.fromString("8801d07c-51ba-4059-b61d-fe1f1510b28a");
|
||||
public String type = "success";
|
||||
public String requesttype = "checkServer";
|
||||
|
@ -15,4 +16,9 @@ public class CheckServerEvent implements EventInterface {
|
|||
public UUID getUUID() {
|
||||
return _uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "checkServe";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class JoinServerRequestEvent implements EventInterface {
|
||||
public class JoinServerRequestEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID uuid = UUID.fromString("2a12e7b5-3f4a-4891-a2f9-ea141c8e1995");
|
||||
public String type = "success";
|
||||
public String requesttype = "checkServer";
|
||||
public String requesttype = "joinServer";
|
||||
|
||||
public JoinServerRequestEvent(boolean allow) {
|
||||
this.allow = allow;
|
||||
|
@ -18,4 +19,9 @@ public JoinServerRequestEvent(boolean allow) {
|
|||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "joinServer";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class LauncherRequestEvent implements EventInterface {
|
||||
public class LauncherRequestEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID uuid = UUID.fromString("d54cc12a-4f59-4f23-9b10-f527fdd2e38f");
|
||||
public String type = "success";
|
||||
public String requesttype = "launcherUpdate";
|
||||
public String requesttype = "launcher";
|
||||
public String url;
|
||||
|
||||
public LauncherRequestEvent(boolean needUpdate, String url) {
|
||||
|
@ -20,4 +21,9 @@ public LauncherRequestEvent(boolean needUpdate, String url) {
|
|||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "launcher";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ProfileByUUIDRequestEvent implements EventInterface
|
||||
public class ProfileByUUIDRequestEvent implements EventInterface, ResultInterface
|
||||
{
|
||||
private static final UUID uuid = UUID.fromString("b9014cf3-4b95-4d38-8c5f-867f190a18a0");
|
||||
String requesttype = "profileByUUID";
|
||||
|
@ -19,4 +20,9 @@ public ProfileByUUIDRequestEvent(PlayerProfile playerProfile) {
|
|||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "profileByUUID";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ProfileByUsernameRequestEvent implements EventInterface
|
||||
public class ProfileByUsernameRequestEvent implements EventInterface, ResultInterface
|
||||
{
|
||||
private static final UUID uuid = UUID.fromString("06204302-ff6b-4779-b97d-541e3bc39aa1");
|
||||
String requesttype = "profileByUsername";
|
||||
|
@ -19,4 +20,9 @@ public ProfileByUsernameRequestEvent(PlayerProfile playerProfile) {
|
|||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "profileByUsername";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.profiles.ClientProfile;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ProfilesRequestEvent implements EventInterface
|
||||
public class ProfilesRequestEvent implements EventInterface, ResultInterface
|
||||
{
|
||||
private static final UUID uuid = UUID.fromString("2f26fbdf-598a-46dd-92fc-1699c0e173b1");
|
||||
List<ClientProfile> profiles;
|
||||
|
@ -15,10 +16,15 @@ public ProfilesRequestEvent(List<ClientProfile> profiles) {
|
|||
this.profiles = profiles;
|
||||
}
|
||||
|
||||
String requesttype = "profilesList";
|
||||
String requesttype = "profiles";
|
||||
String error;
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "profiles";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.hasher.HashedDir;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class UpdateListRequestEvent implements EventInterface {
|
||||
public class UpdateListRequestEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID uuid = UUID.fromString("5fa836ae-6b61-401c-96ac-d8396f07ec6b");
|
||||
public final String type;
|
||||
public final String requesttype;
|
||||
|
@ -20,4 +21,9 @@ public UpdateListRequestEvent(HashedDir dir) {
|
|||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "updateList";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package ru.gravit.launcher.request.websockets;
|
||||
package ru.gravit.launcher.request;
|
||||
|
||||
public interface ResultInterface {
|
||||
String getType();
|
Loading…
Reference in a new issue