mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-28 10:21:22 +01:00
Improve java docs.
This commit is contained in:
parent
a4240dcb69
commit
6de0ea94bb
@ -200,7 +200,8 @@ public class BukkitLogManager extends AbstractLogManager implements INotifyReloa
|
||||
}
|
||||
|
||||
/**
|
||||
* Necessary logging to a primary thread task (TickTask).
|
||||
* Necessary logging to a primary thread task (TickTask) or asynchronously.
|
||||
* This can be called multiple times without causing damage.
|
||||
*/
|
||||
public void startTasks() {
|
||||
// TODO: Schedule / hide (redundant calls mean no harm, at present).
|
||||
|
@ -7,37 +7,41 @@ import fr.neatmonster.nocheatplus.components.TickListener;
|
||||
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||
|
||||
public class BukkitLogNodeDispatcher extends AbstractLogNodeDispatcher { // TODO: Name.
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Permanent TickListener for logging [TODO: on-demand scheduling, but thread-safe. With extra lock.]
|
||||
*/
|
||||
private final TickListener taskPrimary = new TickListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onTick(final int tick, final long timeLast) {
|
||||
if (runLogsPrimary()) {
|
||||
// TODO: Here or within runLogsPrimary, handle rescheduling.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Needed for scheduling.
|
||||
*/
|
||||
private final Plugin plugin;
|
||||
|
||||
|
||||
public BukkitLogNodeDispatcher(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Necessary logging to a primary thread task (TickTask) or asynchronously.
|
||||
* This can be called multiple times without causing damage.
|
||||
*/
|
||||
public void startTasks() {
|
||||
// TODO: This is a temporary solution. Needs on-demand scheduling [or a wrapper task].
|
||||
TickTask.addTickListener(taskPrimary);
|
||||
scheduleAsynchronous(); // Just in case.
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void scheduleAsynchronous() {
|
||||
synchronized (queueAsynchronous) {
|
||||
|
@ -183,6 +183,7 @@ public class TickTask implements Runnable {
|
||||
* <li>Thread safe.</li>
|
||||
* <li>Does not work if the TickTask is locked.</li>
|
||||
* <li>For OnDemandTickListenerS, setRegistered(true) will get called if not locked.</li>
|
||||
* <li>Will not add the same instance twice, but will call setRegistered each time for OnDemandTickListener instances.</li>
|
||||
* @param listener
|
||||
*/
|
||||
public static void addTickListener(TickListener listener) {
|
||||
|
Loading…
Reference in New Issue
Block a user