Search in sources :

Example 11 with ProxiedPlayer

use of net.md_5.bungee.api.connection.ProxiedPlayer in project FireAPI by FireBlade-Serv.

the class BungeeMain method onEnable.

@Override
public void onEnable() {
    super.getLogger().info("FireAPI actif !");
    this.sql.connection();
    this.sql.startSqlRefreshScheduler(1800L);
    this.sql.putConsole();
    this.rank = new FireRank(this.sql);
    super.getProxy().registerChannel("fireapi");
    this.log = new BigBrotherLoginGetter();
    try {
        this.log.load();
    } catch (Exception e1) {
        e1.printStackTrace();
    }
    try {
        ConnectionsAPI.init();
        Client c = new Client("62.4.31.183", 2566);
        c.start();
        this.c = c;
        ConnectionHandler ch = c;
        ch.eval();
        ch.sendPacket(new PacketLogin(this.log.getKey(), log.getPassword()));
        ch.sendPacket(new PacketVersion(VersionType.BUNGEECORD_VERSION));
        ch.sendPacket(new PacketCommand("name main-bungeecord"));
        BigBrotherConnectionCheck check = new BigBrotherConnectionCheck(this, BigBrotherConnectionCheckType.GLOBAL_CHECK, BigBrotherConnectionInfos.builder().id("main-bungeecord").key(this.log.getKey()).password(this.log.getPassword()).versionType(VersionType.BUNGEECORD_VERSION).build());
        check.startChecks();
        this.setChecker(check);
    } catch (Exception ex) {
        BigBrotherConnectionCheck check = new BigBrotherConnectionCheck(this, BigBrotherConnectionCheckType.ERROR_CHECK, BigBrotherConnectionInfos.builder().id("main-bungeecord").key(this.log.getKey()).password(this.log.getPassword()).versionType(VersionType.BUNGEECORD_VERSION).build());
        check.startChecks();
    }
    ConnectionsAPI.getListeners().registerClientListener(new ClientListener() {

        @Override
        public void onPacketReceive(Packet packet) {
            if (packet instanceof PacketExecute) {
                BungeeMain.super.getLogger().info("(BigBrother) Execution de la commande : " + ((PacketExecute) packet).getServerCommand() + ".");
                BungeeMain.super.getProxy().getPluginManager().dispatchCommand(BungeeMain.super.getProxy().getConsole(), ((PacketExecute) packet).getServerCommand());
            } else if (packet instanceof PacketPlayerPing) {
                PacketPlayerPing pp = (PacketPlayerPing) packet;
                BungeeMain.super.getProxy().getPlayer(pp.getName()).sendMessage(new TextComponent("§6[§ePing§6]§r Ton ping §eproxy§r est de §e" + BungeeMain.super.getProxy().getPlayer(pp.getName()).getPing() + " ms§r !"));
            } else if (packet instanceof PacketBigBrotherAC) {
                PacketBigBrotherAC gacp = (PacketBigBrotherAC) packet;
                if (gacp.getType().equals(BigBrotherTypeAC.CHEAT_DETECTION)) {
                    if (gacp.getTODO().equals(BigBrotherActionAC.INFORM_STAFF)) {
                        for (ProxiedPlayer ps : getProxy().getPlayers()) {
                            if (api.getRankSystem().hasRankAndSup(ps.getName(), Rank.ASSISTANT)) {
                                ps.sendMessage(new TextComponent("§c[BigBrother] [Cheat] §4" + gacp.getPlayerName() + " §r~ " + gacp.getMessage() + " §c" + gacp.getPing() + "ms"));
                            }
                        }
                    }
                }
            }
        }
    });
    this.friends = new FireFriends(this);
    this.friends.initFolder();
    try {
        this.friends.loadConfiguration();
    } catch (IOException e) {
        e.printStackTrace();
    }
    this.auth = new FireAuth(this);
    try {
        this.auth.loadConfiguration();
    } catch (IOException e) {
        e.printStackTrace();
    }
    this.chat = new FireChat(this);
    this.wl = new FireWL(this);
    this.wl.loadConfiguration();
    super.getLogger().info("Clé de sécurité utilisée : " + this.auth.getSecurityKey());
    PluginManager man = super.getProxy().getPluginManager();
    man.registerCommand(this, new CoinsCheckerCommand(this, "coins"));
    man.registerCommand(this, new Website("site"));
    man.registerCommand(this, new Discord("discord"));
    man.registerCommand(this, new FriendsCommand(this, "amis"));
    man.registerCommand(this, new FireRankCommand(this, "firerank"));
    man.registerCommand(this, new RegisterCommand(this, "register"));
    man.registerCommand(this, new LoginCommand(this, "login"));
    man.registerCommand(this, new FireWhiteListCommand("firewl", this));
    StaffChatCommand scc = new StaffChatCommand(this, "firestaffchat");
    man.registerCommand(this, scc);
    Events events = new Events(this, scc);
    man.registerListener(this, events);
    this.check.registerListener(events);
    api = this;
}
Also used : ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer) PacketCommand(fr.glowstoner.connectionsapi.network.packets.command.PacketCommand) BigBrotherConnectionCheck(fr.glowstoner.fireapi.bigbrother.console.check.BigBrotherConnectionCheck) Website(fr.glowstoner.fireapi.bungeecord.commands.misc.Website) PacketVersion(fr.glowstoner.fireapi.bigbrother.console.packets.PacketVersion) RegisterCommand(fr.glowstoner.fireapi.bungeecord.commands.RegisterCommand) PacketPlayerPing(fr.glowstoner.fireapi.bigbrother.console.packets.ping.PacketPlayerPing) PluginManager(net.md_5.bungee.api.plugin.PluginManager) PacketExecute(fr.glowstoner.fireapi.bigbrother.console.packets.PacketExecute) Events(fr.glowstoner.fireapi.bungeecord.events.Events) FireRankCommand(fr.glowstoner.fireapi.bungeecord.commands.FireRankCommand) BigBrotherLoginGetter(fr.glowstoner.fireapi.bigbrother.console.login.BigBrotherLoginGetter) FireWL(fr.glowstoner.fireapi.wl.FireWL) Discord(fr.glowstoner.fireapi.bungeecord.commands.misc.Discord) Client(fr.glowstoner.connectionsapi.network.client.Client) FireRank(fr.glowstoner.fireapi.rank.FireRank) TextComponent(net.md_5.bungee.api.chat.TextComponent) Packet(fr.glowstoner.connectionsapi.network.packets.Packet) LoginCommand(fr.glowstoner.fireapi.bungeecord.commands.LoginCommand) FireAuth(fr.glowstoner.fireapi.bungeecord.auth.FireAuth) PacketLogin(fr.glowstoner.connectionsapi.network.packets.login.PacketLogin) IOException(java.io.IOException) IOException(java.io.IOException) ClientListener(fr.glowstoner.connectionsapi.network.events.ClientListener) StaffChatCommand(fr.glowstoner.fireapi.bungeecord.commands.StaffChatCommand) ConnectionHandler(fr.glowstoner.connectionsapi.network.ConnectionHandler) FriendsCommand(fr.glowstoner.fireapi.bungeecord.commands.FriendsCommand) FireFriends(fr.glowstoner.fireapi.bungeecord.friends.FireFriends) FireWhiteListCommand(fr.glowstoner.fireapi.bungeecord.commands.FireWhiteListCommand) FireChat(fr.glowstoner.fireapi.chat.FireChat) PacketBigBrotherAC(fr.glowstoner.fireapi.bigbrother.ac.packet.PacketBigBrotherAC) CoinsCheckerCommand(fr.glowstoner.fireapi.bungeecord.commands.CoinsCheckerCommand)

Example 12 with ProxiedPlayer

use of net.md_5.bungee.api.connection.ProxiedPlayer in project FireAPI by FireBlade-Serv.

the class Events method onLoginSuccefull.

@EventHandler
public void onLoginSuccefull(LoginSuccessEvent e) {
    ProxiedPlayer pp = e.getPlayer();
    this.stillconnected.remove(pp);
    pp.connect(this.instance.getBungeePlugin().getProxy().getServerInfo("hub"));
    this.friends.sendFriendsAlert(pp);
    try {
        this.c.sendPacket(new PacketSpyAction(pp.getName(), pp.getAddress().getAddress().getHostAddress(), "Le joueur vient de passer les sécurités du login.", SpyAction.PLAYER_LOGGED));
    } catch (IOException e1) {
        e1.printStackTrace();
    }
}
Also used : ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer) PacketSpyAction(fr.glowstoner.fireapi.bigbrother.spy.packets.PacketSpyAction) IOException(java.io.IOException) EventHandler(net.md_5.bungee.event.EventHandler)

Example 13 with ProxiedPlayer

use of net.md_5.bungee.api.connection.ProxiedPlayer in project FireAPI by FireBlade-Serv.

the class FireFriends method acceptRequest.

public void acceptRequest(ProxiedPlayer receiver, ProxiedPlayer sender) throws IOException {
    if (this.outdated.containsKey(receiver)) {
        if (this.outdated.get(receiver).equals(sender)) {
            if (!isAlreadyFriends(receiver, sender)) {
                // accepted
                receiver.sendMessage(new TextComponent(this.pre + "§aVous êtes maintenant ami avec §2" + sender.getName() + "§a !"));
                sender.sendMessage(new TextComponent(this.pre + "§aVous êtes maintenant ami avec §2" + receiver.getName() + "§a !"));
                addFriend(sender, receiver);
                return;
            } else {
                receiver.sendMessage(new TextComponent(this.pre + "§cErreur, vous êtes déjà " + "ami avec " + sender.getName() + " !"));
                return;
            }
        }
    }
    receiver.sendMessage(new TextComponent(this.pre + "§cErreur, vous n'avez reçu aucune demande récente de ce §cjoueur !"));
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent)

Example 14 with ProxiedPlayer

use of net.md_5.bungee.api.connection.ProxiedPlayer in project LuckPerms by lucko.

the class BungeePermissionCheckListener method onOtherTristateCheck.

@EventHandler(priority = EventPriority.HIGHEST)
public void onOtherTristateCheck(TristateCheckEvent e) {
    if (e.getSender() instanceof ProxiedPlayer) {
        return;
    }
    Objects.requireNonNull(e.getPermission(), "permission");
    Objects.requireNonNull(e.getSender(), "sender");
    String permission = e.getPermission();
    Tristate result = e.getResult();
    String name = "internal/" + e.getSender().getName();
    this.plugin.getVerboseHandler().offerCheckData(CheckOrigin.PLATFORM_LOOKUP_CHECK, name, ContextSet.empty(), permission, result);
    this.plugin.getPermissionVault().offer(permission);
}
Also used : ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer) Tristate(me.lucko.luckperms.api.Tristate) EventHandler(net.md_5.bungee.event.EventHandler)

Example 15 with ProxiedPlayer

use of net.md_5.bungee.api.connection.ProxiedPlayer in project Parties by AlessioDP.

the class BungeeListener method onConnect.

@EventHandler
public void onConnect(ServerConnectEvent event) {
    /*
		 * Connect chain starts here,
		 * this method will sent a PartiesPacket to the player server
		 */
    if (event.isCancelled())
        return;
    ProxiedPlayer proxyPlayer = event.getPlayer();
    // Return if its not a player
    if (proxyPlayer.getServer() == null)
        return;
    // Return if the player is already in the server
    if (proxyPlayer.getServer().getInfo().equals(event.getTarget()))
        return;
    // Return if the server is not into the follow list
    if (!listContains(ConfigMain.follow_listserver, proxyPlayer.getServer().getInfo().getName()))
        return;
    /*
		 * 
		 */
    try {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        DataOutputStream out = new DataOutputStream(stream);
        // Initialize packet
        Packet packet = new Packet(plugin.getDescription().getVersion(), event.getTarget().getName(), ConfigMain.follow_neededrank, ConfigMain.follow_minimumrank);
        // Write to the DataOutputStream the data
        packet.write(out);
        if (proxyPlayer.getServer() != null) {
            PartiesBungee.debugLog("Parties packet sent to " + proxyPlayer.getServer().getInfo().getName());
            proxyPlayer.getServer().sendData(partiesChannel, stream.toByteArray());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer) Packet(com.alessiodp.parties.bungeecord.utils.Packet) DataOutputStream(java.io.DataOutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) EventHandler(net.md_5.bungee.event.EventHandler)

Aggregations

ProxiedPlayer (net.md_5.bungee.api.connection.ProxiedPlayer)50 EventHandler (net.md_5.bungee.event.EventHandler)20 TextComponent (net.md_5.bungee.api.chat.TextComponent)17 IOException (java.io.IOException)10 ArrayList (java.util.ArrayList)10 Configuration (net.md_5.bungee.config.Configuration)6 YamlConfiguration (net.md_5.bungee.config.YamlConfiguration)6 UserPreference (com.github.games647.changeskin.core.model.UserPreference)5 Message (at.pcgamingfreaks.Bungee.Message.Message)4 User (me.lucko.luckperms.common.model.User)4 ComponentBuilder (net.md_5.bungee.api.chat.ComponentBuilder)4 Test (org.junit.Test)4 SkinModel (com.github.games647.changeskin.core.model.skin.SkinModel)3 ByteArrayDataInput (com.google.common.io.ByteArrayDataInput)3 PacketSpyAction (fr.glowstoner.fireapi.bigbrother.spy.packets.PacketSpyAction)3 Tristate (me.lucko.luckperms.api.Tristate)3 Chat (net.md_5.bungee.protocol.packet.Chat)3 ServerInfo (de.dytanic.cloudnet.lib.server.info.ServerInfo)2 FirePlayer (fr.glowstoner.fireapi.player.FirePlayer)2 Message (io.github.lxgaming.discordbot.entries.Message)2