This package contains two abstract classes -- {@link com.programmerdan.minecraft.civspy.samplers.ServerMultiDataSampler} or {@link com.programmerdan.minecraft.civspy.samplers.ServerSingleDataSampler} -- one of which must be the superclass of any implementations you want automatically loaded by CivSpy. Each abstract class defines two constructors but you don't have to implement for both constructors; choose the one that suits your needs. Samplers can declare their own period, but no guarantee is made in terms of ordering of execution or alignment of samplers; their executions may be offset, in some cases intentionally, even if their period is the same.


A quick introduction to samplers:

Data Samplers

A Data Sampler should quickly sample one or more pieces of data and pass that data along to the {@link com.programmerdan.minecraft.civspy.DataManager}. This data does not need to be aggregate-able, although it is welcome to be so.

Requirements

All implementations of DataSampler must provide a sample implementation. All implementations of DataSampler must provide a constructor that takes a DataManager, Logger, String, and optionally a ConfigurationSection as input.

Usage

DataSamples are POJOs -- just construct them via their constructor and don't worry about anything else, they just hold and pass along data. One parameter on all DataSample constructors is "Server" -- you can get the plugin's configured "Server" name via getServer(). Be sure to include the server name in your DataSampler POJOs -- see the constructor on PointDataSample and PeriodicDataSample. If local or not specified in CivSpy config, this value will be the string literal "local". Your sampler can turn itself off by calling deactivate -- the sampler is still called on period, but your sample method won't be called, so only do so in case of exceptional circumstance; otherwise, leave activation and de-activation up to CivSpy's management routines.
That's basically it. Pick a Sampler base type to extend from -- either multi-sample or single-sample -- and enjoy.