Search in sources :

Example 1 with Type

use of com.github.games647.fastlogin.core.message.LoginActionMessage.Type in project ChangeSkin by games647.

the class CheckPermissionListener method handlePayload.

@Override
public void handlePayload(ChannelBuf data, RemoteConnection connection, Type side) {
    ByteArrayDataInput dataInput = ByteStreams.newDataInput(data.array());
    CheckPermMessage checkMessage = new CheckPermMessage();
    checkMessage.readFrom(dataInput);
    CheckPermMessage message = new CheckPermMessage();
    message.readFrom(dataInput);
    checkPermissions((Player) connection, message);
}
Also used : CheckPermMessage(com.github.games647.changeskin.core.message.CheckPermMessage) ByteArrayDataInput(com.google.common.io.ByteArrayDataInput)

Example 2 with Type

use of com.github.games647.fastlogin.core.message.LoginActionMessage.Type in project FastLogin by games647.

the class ForceLoginTask method onForceActionSuccess.

@Override
public void onForceActionSuccess(LoginSession session) {
    // sub channel name
    Type type = Type.LOGIN;
    if (session.needsRegistration()) {
        type = Type.REGISTER;
    }
    UUID proxyId = core.getPlugin().getProxyId();
    ChannelMessage loginMessage = new LoginActionMessage(type, player.getUsername(), proxyId);
    core.getPlugin().sendPluginMessage(server, loginMessage);
}
Also used : Type(com.github.games647.fastlogin.core.message.LoginActionMessage.Type) LoginActionMessage(com.github.games647.fastlogin.core.message.LoginActionMessage) UUID(java.util.UUID) ChannelMessage(com.github.games647.fastlogin.core.message.ChannelMessage)

Example 3 with Type

use of com.github.games647.fastlogin.core.message.LoginActionMessage.Type in project FastLogin by games647.

the class BungeeListener method readMessage.

private void readMessage(Player player, LoginActionMessage message) {
    String playerName = message.getPlayerName();
    Type type = message.getType();
    InetSocketAddress address = player.getAddress();
    plugin.getLog().info("Player info {} command for {} from proxy", type, playerName);
    if (type == Type.LOGIN) {
        onLoginMessage(player, playerName, address);
    } else if (type == Type.REGISTER) {
        onRegisterMessage(player, playerName, address);
    } else if (type == Type.CRACKED) {
        // we don't start a force login task here so update it manually
        plugin.getPremiumPlayers().put(player.getUniqueId(), PremiumStatus.CRACKED);
    }
}
Also used : Type(com.github.games647.fastlogin.core.message.LoginActionMessage.Type) InetSocketAddress(java.net.InetSocketAddress)

Example 4 with Type

use of com.github.games647.fastlogin.core.message.LoginActionMessage.Type in project ChangeSkin by games647.

the class UpdateSkinListener method handlePayload.

@Override
public void handlePayload(ChannelBuf data, RemoteConnection connection, Type side) {
    ByteArrayDataInput dataInput = ByteStreams.newDataInput(data.array());
    SkinUpdateMessage updateMessage = new SkinUpdateMessage();
    updateMessage.readFrom(dataInput);
    String playerName = updateMessage.getPlayerName();
    Optional<Player> receiver = Sponge.getServer().getPlayer(playerName);
    if (receiver.isPresent()) {
        Runnable skinUpdater = new SkinApplier(plugin, (CommandSource) connection, receiver.get(), null, false);
        Task.builder().execute(skinUpdater).submit(plugin);
    }
}
Also used : Player(org.spongepowered.api.entity.living.player.Player) SkinUpdateMessage(com.github.games647.changeskin.core.message.SkinUpdateMessage) SkinApplier(com.github.games647.changeskin.sponge.task.SkinApplier) ByteArrayDataInput(com.google.common.io.ByteArrayDataInput)

Example 5 with Type

use of com.github.games647.fastlogin.core.message.LoginActionMessage.Type in project FastLogin by games647.

the class ForceLoginTask method onForceActionSuccess.

@Override
public void onForceActionSuccess(LoginSession session) {
    // sub channel name
    Type type = Type.LOGIN;
    if (session.needsRegistration()) {
        type = Type.REGISTER;
    }
    UUID proxyId = UUID.fromString(ProxyServer.getInstance().getConfig().getUuid());
    ChannelMessage loginMessage = new LoginActionMessage(type, player.getName(), proxyId);
    core.getPlugin().sendPluginMessage(server, loginMessage);
}
Also used : Type(com.github.games647.fastlogin.core.message.LoginActionMessage.Type) LoginActionMessage(com.github.games647.fastlogin.core.message.LoginActionMessage) UUID(java.util.UUID) ChannelMessage(com.github.games647.fastlogin.core.message.ChannelMessage)

Aggregations

Type (com.github.games647.fastlogin.core.message.LoginActionMessage.Type)3 ChannelMessage (com.github.games647.fastlogin.core.message.ChannelMessage)2 LoginActionMessage (com.github.games647.fastlogin.core.message.LoginActionMessage)2 ByteArrayDataInput (com.google.common.io.ByteArrayDataInput)2 UUID (java.util.UUID)2 CheckPermMessage (com.github.games647.changeskin.core.message.CheckPermMessage)1 SkinUpdateMessage (com.github.games647.changeskin.core.message.SkinUpdateMessage)1 SkinApplier (com.github.games647.changeskin.sponge.task.SkinApplier)1 InetSocketAddress (java.net.InetSocketAddress)1 Player (org.spongepowered.api.entity.living.player.Player)1