Attempt to fix #678 by changing RegisterProcessor to a task

This commit is contained in:
Rsl1122 2018-08-10 09:26:14 +03:00
parent e525e0c5db
commit 23c8c0769f
3 changed files with 8 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import com.djrapitops.plan.system.processing.processors.info.PlayerPageUpdatePro
import com.djrapitops.plan.system.processing.processors.player.*; import com.djrapitops.plan.system.processing.processors.player.*;
import com.djrapitops.plugin.api.systems.NotificationCenter; import com.djrapitops.plugin.api.systems.NotificationCenter;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.task.RunnableFactory;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -96,7 +97,7 @@ public class PlayerOnlineListener implements Listener {
SessionCache.getInstance().cacheSession(uuid, new Session(uuid, time, world, gm)); SessionCache.getInstance().cacheSession(uuid, new Session(uuid, time, world, gm));
Processing.submit( RunnableFactory.createNew("Player Register: " + uuid,
new RegisterProcessor(uuid, player::getFirstPlayed, playerName, new RegisterProcessor(uuid, player::getFirstPlayed, playerName,
new IPUpdateProcessor(uuid, address, time), new IPUpdateProcessor(uuid, address, time),
new NameProcessor(uuid, playerName, displayName), new NameProcessor(uuid, playerName, displayName),

View File

@ -8,6 +8,7 @@ import com.djrapitops.plan.system.processing.processors.info.PlayerPageUpdatePro
import com.djrapitops.plan.system.processing.processors.player.*; import com.djrapitops.plan.system.processing.processors.player.*;
import com.djrapitops.plugin.api.systems.NotificationCenter; import com.djrapitops.plugin.api.systems.NotificationCenter;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.task.RunnableFactory;
import org.spongepowered.api.Sponge; import org.spongepowered.api.Sponge;
import org.spongepowered.api.data.key.Keys; import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
@ -99,7 +100,7 @@ public class SpongePlayerListener {
SessionCache.getInstance().cacheSession(uuid, new Session(uuid, time, world, gm)); SessionCache.getInstance().cacheSession(uuid, new Session(uuid, time, world, gm));
Processing.submit( RunnableFactory.createNew("Player Register: " + uuid,
new RegisterProcessor(uuid, () -> time, playerName, new RegisterProcessor(uuid, () -> time, playerName,
new IPUpdateProcessor(uuid, address, time), new IPUpdateProcessor(uuid, address, time),
new NameProcessor(uuid, playerName, displayName), new NameProcessor(uuid, playerName, displayName),

View File

@ -5,8 +5,8 @@
package com.djrapitops.plan.system.processing.processors.player; package com.djrapitops.plan.system.processing.processors.player;
import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.processing.CriticalRunnable;
import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.processing.Processing;
import com.djrapitops.plugin.task.AbsRunnable;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import java.util.UUID; import java.util.UUID;
@ -17,7 +17,7 @@ import java.util.function.Supplier;
* *
* @author Rsl1122 * @author Rsl1122
*/ */
public class RegisterProcessor implements CriticalRunnable { public class RegisterProcessor extends AbsRunnable {
private final UUID uuid; private final UUID uuid;
private final Supplier<Long> registered; private final Supplier<Long> registered;
@ -25,6 +25,7 @@ public class RegisterProcessor implements CriticalRunnable {
private final Runnable[] afterProcess; private final Runnable[] afterProcess;
public RegisterProcessor(UUID uuid, Supplier<Long> registered, String name, Runnable... afterProcess) { public RegisterProcessor(UUID uuid, Supplier<Long> registered, String name, Runnable... afterProcess) {
super(RegisterProcessor.class.getSimpleName());
this.uuid = uuid; this.uuid = uuid;
this.registered = registered; this.registered = registered;
this.name = name; this.name = name;
@ -46,6 +47,7 @@ public class RegisterProcessor implements CriticalRunnable {
for (Runnable runnable : afterProcess) { for (Runnable runnable : afterProcess) {
Processing.submit(runnable); Processing.submit(runnable);
} }
cancel();
} }
} }
} }