Search in sources :

Example 1 with WorldFactoryArgument

use of fr.neatmonster.nocheatplus.worlds.WorldFactoryArgument 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)

Aggregations

NoCheatPlusAPI (fr.neatmonster.nocheatplus.components.NoCheatPlusAPI)1 IFactoryOne (fr.neatmonster.nocheatplus.components.registry.factory.IFactoryOne)1 PlayerFactoryArgument (fr.neatmonster.nocheatplus.players.PlayerFactoryArgument)1 WorldFactoryArgument (fr.neatmonster.nocheatplus.worlds.WorldFactoryArgument)1