Search in sources :

Example 1 with ChannelMessage

use of com.github.games647.fastlogin.core.message.ChannelMessage 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 2 with ChannelMessage

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

the class BungeeManager method sendPluginMessage.

public void sendPluginMessage(PluginMessageRecipient player, ChannelMessage message) {
    if (player != null) {
        ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
        message.writeTo(dataOutput);
        NamespaceKey channel = new NamespaceKey(plugin.getName(), message.getChannelName());
        player.sendPluginMessage(plugin, channel.getCombinedName(), dataOutput.toByteArray());
    }
}
Also used : NamespaceKey(com.github.games647.fastlogin.core.message.NamespaceKey) ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput)

Example 3 with ChannelMessage

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

the class ChangeSkinBukkit method sendPluginMessage.

public void sendPluginMessage(PluginMessageRecipient sender, ChannelMessage message) {
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    message.writeTo(out);
    NamespaceKey channel = new NamespaceKey(getName(), message.getChannelName());
    sender.sendPluginMessage(this, channel.getCombinedName(), out.toByteArray());
}
Also used : NamespaceKey(com.github.games647.changeskin.core.message.NamespaceKey) ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput)

Example 4 with ChannelMessage

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

the class SkinApplier method run.

@Override
public void run() {
    if (!isConnected()) {
        return;
    }
    UUID receiverUUID = receiver.getUniqueId();
    if (invoker instanceof ProxiedPlayer) {
        if (targetSkin != null && core.getConfig().getBoolean("bukkit-permissions")) {
            Server server = ((ProxiedPlayer) invoker).getServer();
            boolean skinPerm = core.getConfig().getBoolean("skinPermission");
            ChannelMessage message = new CheckPermMessage(targetSkin, receiverUUID, skinPerm, bukkitOp);
            plugin.sendPluginMessage(server, message);
            return;
        }
        // uuid was successful resolved, we could now make a cooldown check
        core.getCooldownService().trackPlayer(((ProxiedPlayer) invoker).getUniqueId());
    }
    // check if that specific player is online
    UserPreference preferences = plugin.getLoginSession(receiver.getPendingConnection());
    if (preferences == null) {
        preferences = plugin.getStorage().getPreferences(receiverUUID);
    }
    save(preferences);
    applySkin();
}
Also used : ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer) Server(net.md_5.bungee.api.connection.Server) CheckPermMessage(com.github.games647.changeskin.core.message.CheckPermMessage) UserPreference(com.github.games647.changeskin.core.model.UserPreference) UUID(java.util.UUID) ChannelMessage(com.github.games647.changeskin.core.message.ChannelMessage)

Example 5 with ChannelMessage

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

the class ChangeSkinBungee method sendPluginMessage.

public void sendPluginMessage(Server server, ChannelMessage message) {
    if (server != null) {
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        message.writeTo(out);
        NamespaceKey channel = new NamespaceKey(getName(), message.getChannelName());
        server.sendData(channel.getCombinedName(), out.toByteArray());
    }
}
Also used : NamespaceKey(com.github.games647.changeskin.core.message.NamespaceKey) ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput)

Aggregations

ByteArrayDataOutput (com.google.common.io.ByteArrayDataOutput)4 ChannelMessage (com.github.games647.fastlogin.core.message.ChannelMessage)3 UUID (java.util.UUID)3 ChannelMessage (com.github.games647.changeskin.core.message.ChannelMessage)2 NamespaceKey (com.github.games647.changeskin.core.message.NamespaceKey)2 LoginActionMessage (com.github.games647.fastlogin.core.message.LoginActionMessage)2 Type (com.github.games647.fastlogin.core.message.LoginActionMessage.Type)2 NamespaceKey (com.github.games647.fastlogin.core.message.NamespaceKey)2 Player (org.bukkit.entity.Player)2 CheckPermMessage (com.github.games647.changeskin.core.message.CheckPermMessage)1 ForwardMessage (com.github.games647.changeskin.core.message.ForwardMessage)1 UserPreference (com.github.games647.changeskin.core.model.UserPreference)1 ChangePremiumMessage (com.github.games647.fastlogin.core.message.ChangePremiumMessage)1 ProxiedPlayer (net.md_5.bungee.api.connection.ProxiedPlayer)1 Server (net.md_5.bungee.api.connection.Server)1 PluginMessageRecipient (org.bukkit.plugin.messaging.PluginMessageRecipient)1