mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-25 12:05:13 +01:00
Fix some issues with the sponge api version and loading the plugin
This commit is contained in:
parent
82ab8c2c7c
commit
705f97dabf
@ -1,5 +1,5 @@
|
||||
dependencies {
|
||||
shadow "org.spongepowered:spongeapi:7.2.0-SNAPSHOT"
|
||||
shadow "org.spongepowered:spongeapi:7.1.0-SNAPSHOT"
|
||||
compile group: 'org.bstats', name: 'bstats-sponge-lite', version: '1.5'
|
||||
compile project(':BlueMapCore')
|
||||
}
|
@ -83,6 +83,14 @@ public CommandSpec createRootCommand() {
|
||||
.build();
|
||||
}
|
||||
|
||||
public CommandSpec createStandaloneReloadCommand() {
|
||||
return CommandSpec.builder()
|
||||
.description(Text.of("BlueMaps root command"))
|
||||
.childArgumentParseExceptionFallback(false)
|
||||
.child(createReloadCommand(), "reload")
|
||||
.build();
|
||||
}
|
||||
|
||||
public CommandSpec createReloadCommand() {
|
||||
return CommandSpec.builder()
|
||||
.description(Text.of("Reloads all resources and configuration-files"))
|
||||
|
@ -34,7 +34,6 @@
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
@ -50,9 +49,7 @@
|
||||
import org.spongepowered.api.event.game.state.GameStartingServerEvent;
|
||||
import org.spongepowered.api.event.game.state.GameStoppingEvent;
|
||||
import org.spongepowered.api.plugin.Plugin;
|
||||
import org.spongepowered.api.plugin.PluginContainer;
|
||||
import org.spongepowered.api.scheduler.SpongeExecutorService;
|
||||
import org.spongepowered.api.util.Tristate;
|
||||
|
||||
import com.flowpowered.math.vector.Vector2i;
|
||||
import com.google.common.collect.Lists;
|
||||
@ -140,6 +137,11 @@ public synchronized void load() throws IOException, NoSuchResourceException {
|
||||
|
||||
if (!defaultResourceFile.exists()) {
|
||||
handleMissingResources(defaultResourceFile, configFile);
|
||||
unload();
|
||||
|
||||
//only register reload command
|
||||
Sponge.getCommandManager().register(this, new Commands(this).createStandaloneReloadCommand(), "bluemap");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -246,15 +248,10 @@ public synchronized void load() throws IOException, NoSuchResourceException {
|
||||
//metrics
|
||||
Sponge.getScheduler().createTaskBuilder()
|
||||
.async()
|
||||
.delay(0, TimeUnit.MINUTES)
|
||||
.delay(1, TimeUnit.MINUTES)
|
||||
.interval(30, TimeUnit.MINUTES)
|
||||
.execute(() -> {
|
||||
Optional<PluginContainer> plugin = Sponge.getPluginManager().fromInstance(this);
|
||||
if (!plugin.isPresent()) return;
|
||||
|
||||
Tristate metricsEnabled = Sponge.getMetricsConfigManager().getCollectionState(plugin.get());
|
||||
if (metricsEnabled == Tristate.UNDEFINED) metricsEnabled = Sponge.getMetricsConfigManager().getGlobalCollectionState();
|
||||
if (metricsEnabled == Tristate.TRUE) Metrics.sendReport("Sponge");
|
||||
if (Sponge.getMetricsConfigManager().areMetricsEnabled(this)) Metrics.sendReport("Sponge");
|
||||
})
|
||||
.submit(this);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user