mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-02-26 00:31:44 +01:00
use CommandRegistrationCallback
This commit is contained in:
parent
86f5179ce1
commit
23306329af
@ -4,6 +4,7 @@ import com.mojang.brigadier.CommandDispatcher;
|
|||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||||
|
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents;
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||||
@ -103,6 +104,7 @@ public class DynmapPlugin {
|
|||||||
plugin = this;
|
plugin = this;
|
||||||
// Fabric events persist between server instances
|
// Fabric events persist between server instances
|
||||||
ServerLifecycleEvents.SERVER_STARTING.register(this::serverStart);
|
ServerLifecycleEvents.SERVER_STARTING.register(this::serverStart);
|
||||||
|
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> registerCommands(dispatcher));
|
||||||
CustomServerLifecycleEvents.SERVER_STARTED_PRE_WORLD_LOAD.register(this::serverStarted);
|
CustomServerLifecycleEvents.SERVER_STARTED_PRE_WORLD_LOAD.register(this::serverStarted);
|
||||||
ServerLifecycleEvents.SERVER_STOPPING.register(this::serverStop);
|
ServerLifecycleEvents.SERVER_STOPPING.register(this::serverStop);
|
||||||
}
|
}
|
||||||
@ -297,7 +299,6 @@ public class DynmapPlugin {
|
|||||||
this.server = server;
|
this.server = server;
|
||||||
this.fserver = new FabricServer(this, server);
|
this.fserver = new FabricServer(this, server);
|
||||||
this.onEnable();
|
this.onEnable();
|
||||||
plugin.onStarting(server.getCommandManager().getDispatcher());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void serverStarted(MinecraftServer server) {
|
private void serverStarted(MinecraftServer server) {
|
||||||
@ -481,9 +482,7 @@ public class DynmapPlugin {
|
|||||||
private DmarkerCommand dmarkerCmd;
|
private DmarkerCommand dmarkerCmd;
|
||||||
private DynmapExpCommand dynmapexpCmd;
|
private DynmapExpCommand dynmapexpCmd;
|
||||||
|
|
||||||
public void onStarting(CommandDispatcher<ServerCommandSource> cd) {
|
public void registerCommands(CommandDispatcher<ServerCommandSource> cd) {
|
||||||
/* Register command hander */
|
|
||||||
// TODO: Use CommandRegistrationCallback
|
|
||||||
dynmapCmd = new DynmapCommand(this);
|
dynmapCmd = new DynmapCommand(this);
|
||||||
dmapCmd = new DmapCommand(this);
|
dmapCmd = new DmapCommand(this);
|
||||||
dmarkerCmd = new DmarkerCommand(this);
|
dmarkerCmd = new DmarkerCommand(this);
|
||||||
|
@ -4,6 +4,7 @@ import com.mojang.brigadier.CommandDispatcher;
|
|||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||||
|
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents;
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||||
@ -103,6 +104,7 @@ public class DynmapPlugin {
|
|||||||
plugin = this;
|
plugin = this;
|
||||||
// Fabric events persist between server instances
|
// Fabric events persist between server instances
|
||||||
ServerLifecycleEvents.SERVER_STARTING.register(this::serverStart);
|
ServerLifecycleEvents.SERVER_STARTING.register(this::serverStart);
|
||||||
|
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> registerCommands(dispatcher));
|
||||||
CustomServerLifecycleEvents.SERVER_STARTED_PRE_WORLD_LOAD.register(this::serverStarted);
|
CustomServerLifecycleEvents.SERVER_STARTED_PRE_WORLD_LOAD.register(this::serverStarted);
|
||||||
ServerLifecycleEvents.SERVER_STOPPING.register(this::serverStop);
|
ServerLifecycleEvents.SERVER_STOPPING.register(this::serverStop);
|
||||||
}
|
}
|
||||||
@ -283,7 +285,6 @@ public class DynmapPlugin {
|
|||||||
this.server = server;
|
this.server = server;
|
||||||
this.fserver = new FabricServer(this, server);
|
this.fserver = new FabricServer(this, server);
|
||||||
this.onEnable();
|
this.onEnable();
|
||||||
plugin.onStarting(server.getCommandManager().getDispatcher());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void serverStarted(MinecraftServer server) {
|
private void serverStarted(MinecraftServer server) {
|
||||||
@ -469,9 +470,7 @@ public class DynmapPlugin {
|
|||||||
private DmarkerCommand dmarkerCmd;
|
private DmarkerCommand dmarkerCmd;
|
||||||
private DynmapExpCommand dynmapexpCmd;
|
private DynmapExpCommand dynmapexpCmd;
|
||||||
|
|
||||||
public void onStarting(CommandDispatcher<ServerCommandSource> cd) {
|
public void registerCommands(CommandDispatcher<ServerCommandSource> cd) {
|
||||||
/* Register command hander */
|
|
||||||
// TODO: Use CommandRegistrationCallback
|
|
||||||
dynmapCmd = new DynmapCommand(this);
|
dynmapCmd = new DynmapCommand(this);
|
||||||
dmapCmd = new DmapCommand(this);
|
dmapCmd = new DmapCommand(this);
|
||||||
dmarkerCmd = new DmarkerCommand(this);
|
dmarkerCmd = new DmarkerCommand(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user