Search in sources :

Example 1 with BigBrotherAC

use of fr.glowstoner.fireapi.bigbrother.ac.BigBrotherAC in project FireAPI by FireBlade-Serv.

the class BukkitMain method onEnable.

@Override
public void onEnable() {
    super.getLogger().info("FireAPI actif !");
    sql = new FireSQL();
    this.sql.connection();
    this.sql.startSqlRefreshScheduler(1800L);
    this.sql.putConsole();
    rank = new FireRank(this.sql);
    this.chat = new FireChat(this);
    this.tag = new FireTag(this);
    this.tag.registerRanks();
    FireBukkitID id = new FireBukkitID(this);
    try {
        id.loadConfiguration();
    } catch (IOException | InvalidConfigurationException e1) {
        e1.printStackTrace();
    }
    this.id = id.getID();
    this.log = new BigBrotherLoginGetter();
    try {
        this.log.load();
    } catch (Exception e1) {
        e1.printStackTrace();
    }
    super.getLogger().info("ID serveur utilisé : " + this.id);
    this.injector = new FireInjector();
    this.ac = new BigBrotherAC(this);
    this.ac.init();
    this.ac.startKillAuraChecks((long) (30 * 20));
    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(), this.log.getPassword()));
        ch.sendPacket(new PacketVersion(VersionType.SPIGOT_VERSION));
        ch.sendPacket(new PacketCommand("name " + this.id));
        BigBrotherConnectionCheck check = new BigBrotherConnectionCheck(this, BigBrotherConnectionCheckType.GLOBAL_CHECK, BigBrotherConnectionInfos.builder().id(this.id).key(this.log.getKey()).password(this.log.getPassword()).versionType(VersionType.SPIGOT_VERSION).build());
        check.startChecks();
        this.setChecker(check);
    } catch (Exception ex) {
        BigBrotherConnectionCheck check = new BigBrotherConnectionCheck(this, BigBrotherConnectionCheckType.ERROR_CHECK, BigBrotherConnectionInfos.builder().id(this.id).key(this.log.getKey()).password(this.log.getPassword()).versionType(VersionType.SPIGOT_VERSION).build());
        check.startChecks();
    }
    ConnectionsAPI.getListeners().registerClientListener(new ClientListener() {

        @Override
        public void onPacketReceive(Packet packet) {
            if (packet instanceof PacketExecute) {
                BukkitMain.super.getServer().dispatchCommand(BukkitMain.super.getServer().getConsoleSender(), ((PacketExecute) packet).getServerCommand());
            } else if (packet instanceof PacketFriends) {
                PacketFriends pf = (PacketFriends) packet;
                if (pf.getAction() instanceof FriendsActionTransmetterGUI) {
                    FriendsActionTransmetterGUI fa = (FriendsActionTransmetterGUI) pf.getAction();
                    if (fa.to().equals(VersionType.SPIGOT_VERSION)) {
                        FriendsActionInventoryGUI faig = new FriendsActionInventoryGUI(fa.getName(), fa.getFriends(), fa.getConnected());
                        faig.initPlayer(BukkitMain.this);
                        faig.generateInventory();
                        faig.openInventory();
                    }
                }
            }
        }
    });
    Events events = new Events(this);
    super.getServer().getPluginManager().registerEvents(events, this);
    super.getServer().getPluginManager().registerEvents(new EventsAT(this), this);
    this.check.registerListener(events);
    super.getCommand("ping").setExecutor(new PingCommand(this));
    super.getCommand("at").setExecutor(new AdminToolsCmd(this));
    api = this;
}
Also used : EventsAT(be.goldocelot.admintools.EventsAT) PacketCommand(fr.glowstoner.connectionsapi.network.packets.command.PacketCommand) BigBrotherConnectionCheck(fr.glowstoner.fireapi.bigbrother.console.check.BigBrotherConnectionCheck) PacketVersion(fr.glowstoner.fireapi.bigbrother.console.packets.PacketVersion) FireSQL(fr.glowstoner.fireapi.sql.FireSQL) InvalidConfigurationException(org.bukkit.configuration.InvalidConfigurationException) PacketExecute(fr.glowstoner.fireapi.bigbrother.console.packets.PacketExecute) BigBrotherLoginGetter(fr.glowstoner.fireapi.bigbrother.console.login.BigBrotherLoginGetter) Client(fr.glowstoner.connectionsapi.network.client.Client) FireRank(fr.glowstoner.fireapi.rank.FireRank) Packet(fr.glowstoner.connectionsapi.network.packets.Packet) BigBrotherAC(fr.glowstoner.fireapi.bigbrother.ac.BigBrotherAC) FriendsActionInventoryGUI(fr.glowstoner.fireapi.bukkit.friends.FriendsActionInventoryGUI) FriendsActionTransmetterGUI(fr.glowstoner.fireapi.bungeecord.friends.packets.action.FriendsActionTransmetterGUI) FireBukkitID(fr.glowstoner.fireapi.bukkit.id.FireBukkitID) IOException(java.io.IOException) PacketLogin(fr.glowstoner.connectionsapi.network.packets.login.PacketLogin) PacketFriends(fr.glowstoner.fireapi.bungeecord.friends.packets.PacketFriends) IOException(java.io.IOException) InvalidConfigurationException(org.bukkit.configuration.InvalidConfigurationException) ClientListener(fr.glowstoner.connectionsapi.network.events.ClientListener) PingCommand(fr.glowstoner.fireapi.bukkit.commands.PingCommand) FireTag(fr.glowstoner.fireapi.bukkit.tag.FireTag) ConnectionHandler(fr.glowstoner.connectionsapi.network.ConnectionHandler) FireChat(fr.glowstoner.fireapi.chat.FireChat) AdminToolsCmd(be.goldocelot.admintools.AdminToolsCmd) FireInjector(fr.glowstoner.fireapi.bukkit.nms.packetlistener.FireInjector)

Aggregations

AdminToolsCmd (be.goldocelot.admintools.AdminToolsCmd)1 EventsAT (be.goldocelot.admintools.EventsAT)1 ConnectionHandler (fr.glowstoner.connectionsapi.network.ConnectionHandler)1 Client (fr.glowstoner.connectionsapi.network.client.Client)1 ClientListener (fr.glowstoner.connectionsapi.network.events.ClientListener)1 Packet (fr.glowstoner.connectionsapi.network.packets.Packet)1 PacketCommand (fr.glowstoner.connectionsapi.network.packets.command.PacketCommand)1 PacketLogin (fr.glowstoner.connectionsapi.network.packets.login.PacketLogin)1 BigBrotherAC (fr.glowstoner.fireapi.bigbrother.ac.BigBrotherAC)1 BigBrotherConnectionCheck (fr.glowstoner.fireapi.bigbrother.console.check.BigBrotherConnectionCheck)1 BigBrotherLoginGetter (fr.glowstoner.fireapi.bigbrother.console.login.BigBrotherLoginGetter)1 PacketExecute (fr.glowstoner.fireapi.bigbrother.console.packets.PacketExecute)1 PacketVersion (fr.glowstoner.fireapi.bigbrother.console.packets.PacketVersion)1 PingCommand (fr.glowstoner.fireapi.bukkit.commands.PingCommand)1 FriendsActionInventoryGUI (fr.glowstoner.fireapi.bukkit.friends.FriendsActionInventoryGUI)1 FireBukkitID (fr.glowstoner.fireapi.bukkit.id.FireBukkitID)1 FireInjector (fr.glowstoner.fireapi.bukkit.nms.packetlistener.FireInjector)1 FireTag (fr.glowstoner.fireapi.bukkit.tag.FireTag)1 PacketFriends (fr.glowstoner.fireapi.bungeecord.friends.packets.PacketFriends)1 FriendsActionTransmetterGUI (fr.glowstoner.fireapi.bungeecord.friends.packets.action.FriendsActionTransmetterGUI)1