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);
}
}
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);
}
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());
}
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();
}
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);
}
Aggregations