Search in sources :

Example 1 with SecretContainer

use of com.wynntils.modules.richpresence.profiles.SecretContainer in project Wynntils by Wynntils.

the class RPCJoinHandler method apply.

public void apply(Pointer eventData, String joinSecret) {
    lastSecret = new SecretContainer(joinSecret);
    if (lastSecret.getOwner().isEmpty() || lastSecret.getRandomHash().isEmpty() || lastSecret.getWorldType().equals("HB") && WebManager.getPlayerProfile() != null && WebManager.getPlayerProfile().getTag() != PlayerTag.HERO)
        return;
    RichPresenceModule.getModule().getRichPresence().setJoinSecret(lastSecret);
    if (!Reference.onServer) {
        ServerData serverData = ServerUtils.getWynncraftServerData(true);
        ServerUtils.connect(serverData);
        waitingLobby = true;
        return;
    }
    if (Reference.onWorld) {
        if (Reference.getUserWorld().replace("WC", "").replace("HB", "").equals(Integer.toString(lastSecret.getWorld())) && Reference.getUserWorld().replaceAll("\\d+", "").equals(lastSecret.getWorldType())) {
            sentInvite = true;
            McIf.player().sendChatMessage("/msg " + lastSecret.getOwner() + " " + lastSecret.getRandomHash());
            return;
        }
        McIf.player().sendChatMessage("/hub");
        waitingLobby = true;
        return;
    }
    joinWorld(lastSecret.getWorldType(), lastSecret.getWorld());
    waitingInvite = true;
}
Also used : SecretContainer(com.wynntils.modules.richpresence.profiles.SecretContainer) ServerData(net.minecraft.client.multiplayer.ServerData)

Aggregations

SecretContainer (com.wynntils.modules.richpresence.profiles.SecretContainer)1 ServerData (net.minecraft.client.multiplayer.ServerData)1