Search in sources :

Example 1 with NoCheatPlusAPI

use of fr.neatmonster.nocheatplus.components.NoCheatPlusAPI in project NoCheatPlus by NoCheatPlus.

the class PlayerDataManager method onEnable.

/**
 * Initializing with online players.
 */
public void onEnable() {
    TickTask.addTickListener(tickListener);
    final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
    for (final MiniListener<?> listener : miniListeners) {
        api.addComponent(listener, false);
    }
    for (final Player player : BridgeMisc.getOnlinePlayers()) {
        addOnlinePlayer(player);
    }
}
Also used : NoCheatPlusAPI(fr.neatmonster.nocheatplus.components.NoCheatPlusAPI) Player(org.bukkit.entity.Player)

Example 2 with NoCheatPlusAPI

use of fr.neatmonster.nocheatplus.components.NoCheatPlusAPI in project NoCheatPlus by NoCheatPlus.

the class WorldDataManager method onEnable.

/**
 * Initializing with online players.
 */
public void onEnable() {
    final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
    for (final MiniListener<?> listener : miniListeners) {
        api.addComponent(listener, false);
    }
    api.addComponent(this);
}
Also used : NoCheatPlusAPI(fr.neatmonster.nocheatplus.components.NoCheatPlusAPI)

Example 3 with NoCheatPlusAPI

use of fr.neatmonster.nocheatplus.components.NoCheatPlusAPI in project NoCheatPlus by NoCheatPlus.

the class NetStatic method registerTypes.

@SuppressWarnings("unchecked")
public static void registerTypes() {
    final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
    api.register(api.newRegistrationContext().registerConfigWorld(NetConfig.class).factory(new IFactoryOne<WorldFactoryArgument, NetConfig>() {

        @Override
        public NetConfig getNewInstance(WorldFactoryArgument arg) {
            return new NetConfig(arg.worldData);
        }
    }).registerConfigTypesPlayer().context().registerDataPlayer(NetData.class).factory(new IFactoryOne<PlayerFactoryArgument, NetData>() {

        @Override
        public NetData getNewInstance(PlayerFactoryArgument arg) {
            return new NetData(arg.playerData.getGenericInstance(NetConfig.class));
        }
    }).addToGroups(CheckType.NET, true, IData.class, ICheckData.class).context());
}
Also used : NoCheatPlusAPI(fr.neatmonster.nocheatplus.components.NoCheatPlusAPI) PlayerFactoryArgument(fr.neatmonster.nocheatplus.players.PlayerFactoryArgument) WorldFactoryArgument(fr.neatmonster.nocheatplus.worlds.WorldFactoryArgument) IFactoryOne(fr.neatmonster.nocheatplus.components.registry.factory.IFactoryOne)

Example 4 with NoCheatPlusAPI

use of fr.neatmonster.nocheatplus.components.NoCheatPlusAPI in project NoCheatPlus by NoCheatPlus.

the class ProtocolLibComponent method unregister.

private void unregister() {
    final ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
    final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
    for (PacketAdapter adapter : registeredPacketAdapters) {
        try {
            protocolManager.removePacketListener(adapter);
            // Bit heavy, but consistent.
            api.removeComponent(adapter);
        } catch (Throwable t) {
            StaticLog.logWarning("Failed to unregister packet level hook: " + adapter.getClass().getName());
        }
    // TODO Auto-generated method stub
    }
    registeredPacketAdapters.clear();
}
Also used : NoCheatPlusAPI(fr.neatmonster.nocheatplus.components.NoCheatPlusAPI) ProtocolManager(com.comphenix.protocol.ProtocolManager) PacketAdapter(com.comphenix.protocol.events.PacketAdapter)

Example 5 with NoCheatPlusAPI

use of fr.neatmonster.nocheatplus.components.NoCheatPlusAPI in project NoCheatPlus by NoCheatPlus.

the class Text method init.

private void init() {
    // Set some things from the global config.
    final ConfigFile config = ConfigManager.getConfigFile();
    final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
    if (engine != null) {
        engine.clear();
        api.removeComponent(engine);
    }
    engine = new LetterEngine(config);
    api.addComponent(engine);
}
Also used : NoCheatPlusAPI(fr.neatmonster.nocheatplus.components.NoCheatPlusAPI) LetterEngine(fr.neatmonster.nocheatplus.checks.chat.analysis.engine.LetterEngine) ConfigFile(fr.neatmonster.nocheatplus.config.ConfigFile)

Aggregations

NoCheatPlusAPI (fr.neatmonster.nocheatplus.components.NoCheatPlusAPI)5 ProtocolManager (com.comphenix.protocol.ProtocolManager)1 PacketAdapter (com.comphenix.protocol.events.PacketAdapter)1 LetterEngine (fr.neatmonster.nocheatplus.checks.chat.analysis.engine.LetterEngine)1 IFactoryOne (fr.neatmonster.nocheatplus.components.registry.factory.IFactoryOne)1 ConfigFile (fr.neatmonster.nocheatplus.config.ConfigFile)1 PlayerFactoryArgument (fr.neatmonster.nocheatplus.players.PlayerFactoryArgument)1 WorldFactoryArgument (fr.neatmonster.nocheatplus.worlds.WorldFactoryArgument)1 Player (org.bukkit.entity.Player)1