changes in 1.16 require to re-register commands after datapack reload. May affect extensions with custom CMs - doubt there is any.

This commit is contained in:
gnembon committed 2020-06-02 21:05:44 -03:00
1 parent c94ba6a021
commit d6845487ce
2 files changed
+7 -3

No files matched your search

+6
View File
@@ -80,6 +80,11 @@ public class CarpetServer // static for now - easier to handle all around the co
public static void registerCarpetCommands(CommandDispatcher<ServerCommandSource> dispatcher)
{
settingsManager.registerCommand(dispatcher);
extensions.forEach(e -> {
SettingsManager sm = e.customSettingsManager();
if (sm != null) sm.registerCommand(dispatcher);
});
TickCommand.register(dispatcher);
ProfileCommand.register(dispatcher);
CounterCommand.register(dispatcher);
@@ -100,6 +105,7 @@ public class CarpetServer // static for now - easier to handle all around the co
if (FabricLoader.getInstance().isDevelopmentEnvironment())
TestCommand.register(dispatcher);
// todo 1.16 - re-registerer apps if that's a reload operation.
}
public static void onPlayerLoggedIn(ServerPlayerEntity player)
@@ -76,8 +76,6 @@ public class SettingsManager
{
this.server = server;
loadConfigurationFromConf();
registerCommand(server.getCommandManager().getDispatcher());
notifyPlayersCommandsChanged();
}
public void detachServer()
@@ -359,7 +357,7 @@ public class SettingsManager
return rule;
}
private void registerCommand(CommandDispatcher<ServerCommandSource> dispatcher)
public void registerCommand(CommandDispatcher<ServerCommandSource> dispatcher)
{
if (dispatcher.getRoot().getChildren().stream().anyMatch(node -> node.getName().equalsIgnoreCase(identifier)))
{