public class MemoryService extends java.lang.Object implements HistoryService
HistoryService.LookupSpeed
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
Constructor and Description |
---|
MemoryService(int timeout)
Constructs a simple memory-based history.
|
MemoryService(int maximumSize,
int timeout)
Constructs a simple memory-based history.
|
Modifier and Type | Method and Description |
---|---|
HistoryService.LookupSpeed |
getLookupSpeed()
Retrieve the lookup (read) speed.
|
java.lang.String |
getServiceName()
Retrieves a unique string identifying this service.
|
boolean |
hasFalseNegatives()
Whether or not this service returns false negatives.
|
boolean |
hasFalsePositives()
Whether or not this service may return false positives.
|
java.lang.Boolean |
hasPlayerHistory(org.bukkit.Location blockLocation)
Determines whether or not a block has been placed by a player.
|
void |
onBlockPlaceEvent(org.bukkit.event.block.BlockPlaceEvent event)
Called by ExperienceBlockListener when a block has been placed by a plyer.
|
public static final java.lang.String NAME
public MemoryService(int maximumSize, int timeout)
maximumSize
- - maximum number of block changes to store.timeout
- - number of seconds until a location is removed from the history.public MemoryService(int timeout)
timeout
- - number of seconds until a location is removed from the history.public java.lang.String getServiceName()
Service
Note that this identifier must conform to an ENUM convention: upper case only, underscore for space.
A service MUST not alter its identifier once it has been registered.
getServiceName
in interface Service
public void onBlockPlaceEvent(org.bukkit.event.block.BlockPlaceEvent event)
event
- - even to be notified about.public java.lang.Boolean hasPlayerHistory(org.bukkit.Location blockLocation) throws HistoryException
HistoryService
A service should return NULL if it cannot decide on a value, OR report that its return value is
always probabilistic (using HistoryService.hasFalsePositives()
or HistoryService.hasFalseNegatives()
).
hasPlayerHistory
in interface HistoryService
blockLocation
- - location of the block in question.HistoryException
public HistoryService.LookupSpeed getLookupSpeed()
HistoryService
getLookupSpeed
in interface HistoryService
public boolean hasFalsePositives()
HistoryService
If it does, HistoryProviders
may decide to inquire other services, if at all possible.
hasFalsePositives
in interface HistoryService
public boolean hasFalseNegatives()
HistoryService
hasFalseNegatives
in interface HistoryService