added perf command support
This commit is contained in:
1 parent
69cb3b98c3
commit
a48a7df386
9 files changed
+136
-7
No files matched your search
@@ -33,8 +33,10 @@ import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.server.command.CommandManager;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.dedicated.command.PerfCommand;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
|
||||
public class CarpetServer implements ClientModInitializer,DedicatedServerModInitializer // static for now - easier to handle all around the code, its one anyways
|
||||
@@ -122,7 +124,11 @@ public class CarpetServer implements ClientModInitializer,DedicatedServerModInit
|
||||
extensions.forEach(e -> e.onTick(server));
|
||||
}
|
||||
|
||||
public static void registerCarpetCommands(CommandDispatcher<ServerCommandSource> dispatcher)
|
||||
@Deprecated
|
||||
public static void registerCarpetCommands(CommandDispatcher<ServerCommandSource> dispatcher) {
|
||||
}
|
||||
|
||||
public static void registerCarpetCommands(CommandDispatcher<ServerCommandSource> dispatcher, CommandManager.RegistrationEnvironment environment)
|
||||
{
|
||||
settingsManager.registerCommand(dispatcher);
|
||||
extensions.forEach(e -> {
|
||||
@@ -146,6 +152,9 @@ public class CarpetServer implements ClientModInitializer,DedicatedServerModInit
|
||||
// for all other, they will have them registered when they add themselves
|
||||
extensions.forEach(e -> e.registerCommands(dispatcher));
|
||||
currentCommandDispatcher = dispatcher;
|
||||
|
||||
if (environment != CommandManager.RegistrationEnvironment.DEDICATED)
|
||||
PerfCommand.register(dispatcher);
|
||||
|
||||
if (FabricLoader.getInstance().isDevelopmentEnvironment())
|
||||
TestCommand.register(dispatcher);
|
||||
|
||||
Reference in new issue
Block a user