mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-02-05 16:30:24 +08:00
[#1029] Move bukkit bStats registration to server thread
This commit is contained in:
parent
d2391755df
commit
eb78468f01
@ -26,6 +26,7 @@ import com.djrapitops.plan.system.settings.theme.PlanColorScheme;
|
|||||||
import com.djrapitops.plugin.BukkitPlugin;
|
import com.djrapitops.plugin.BukkitPlugin;
|
||||||
import com.djrapitops.plugin.benchmarking.Benchmark;
|
import com.djrapitops.plugin.benchmarking.Benchmark;
|
||||||
import com.djrapitops.plugin.command.ColorScheme;
|
import com.djrapitops.plugin.command.ColorScheme;
|
||||||
|
import com.djrapitops.plugin.task.AbsRunnable;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@ -52,8 +53,6 @@ public class Plan extends BukkitPlugin implements PlanPlugin {
|
|||||||
locale = system.getLocaleSystem().getLocale();
|
locale = system.getLocaleSystem().getLocale();
|
||||||
system.enable();
|
system.enable();
|
||||||
|
|
||||||
new BStatsBukkit(this).registerMetrics();
|
|
||||||
|
|
||||||
logger.debug("Verbose debug messages are enabled.");
|
logger.debug("Verbose debug messages are enabled.");
|
||||||
String benchTime = " (" + timings.end("Enable").map(Benchmark::toDurationString).orElse("-") + ")";
|
String benchTime = " (" + timings.end("Enable").map(Benchmark::toDurationString).orElse("-") + ")";
|
||||||
logger.info(locale.getString(PluginLang.ENABLED) + benchTime);
|
logger.info(locale.getString(PluginLang.ENABLED) + benchTime);
|
||||||
@ -80,6 +79,19 @@ public class Plan extends BukkitPlugin implements PlanPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerMetrics() {
|
||||||
|
Plan plugin = this;
|
||||||
|
// Spigot 1.14 requires Sync events to be fired from a server thread.
|
||||||
|
// Registering a service fires a sync event, and bStats registers a service,
|
||||||
|
// so this has to be run on the server thread.
|
||||||
|
runnableFactory.create("Register Metrics task", new AbsRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
new BStatsBukkit(plugin).registerMetrics();
|
||||||
|
}
|
||||||
|
}).runTask();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ColorScheme getColorScheme() {
|
public ColorScheme getColorScheme() {
|
||||||
return PlanColorScheme.create(system.getConfigSystem().getConfig(), logger);
|
return PlanColorScheme.create(system.getConfigSystem().getConfig(), logger);
|
||||||
|
Loading…
Reference in New Issue
Block a user