/*
 *  This file is part of CubicChunksConverter, licensed under the MIT License (MIT).
 *
 *  Copyright (c) 2017-2021 contributors
 *
 *  Permission is hereby granted, free of charge, to any person obtaining a copy
 *  of this software and associated documentation files (the "Software"), to deal
 *  in the Software without restriction, including without limitation the rights
 *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *  copies of the Software, and to permit persons to whom the Software is
 *  furnished to do so, subject to the following conditions:
 *
 *  The above copyright notice and this permission notice shall be included in
 *  all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 *  THE SOFTWARE.
 */
package cubicchunks.converter.lib.conf.command.commands;

import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import cubicchunks.converter.lib.conf.command.EditTaskContext;
import cubicchunks.converter.lib.util.edittask.ConfigEditTask;

public class ConfigCommand {
    public static void register(CommandDispatcher<EditTaskContext> dispatcher) {
        dispatcher.register(LiteralArgumentBuilder.<EditTaskContext>literal("config")
            .then(LiteralArgumentBuilder.<EditTaskContext>literal("relight")
                .then(LiteralArgumentBuilder.<EditTaskContext>literal("src")
                    .then(LiteralArgumentBuilder.<EditTaskContext>literal("off")
                        .executes((info) -> {
                            info.getSource().addEditTask(new ConfigEditTask((config) -> {
                                config.relightSrc(false);
                            }));
                            return 1;
                        })
                    ).then(LiteralArgumentBuilder.<EditTaskContext>literal("on")
                        .executes((info) -> {
                            info.getSource().addEditTask(new ConfigEditTask((config) -> {
                                config.relightSrc(true);
                            }));
                            return 1;
                        })
                    )
                ).then(LiteralArgumentBuilder.<EditTaskContext>literal("dst")
                    .then(LiteralArgumentBuilder.<EditTaskContext>literal("off")
                        .executes((info) -> {
                            info.getSource().addEditTask(new ConfigEditTask((config) -> {
                                config.relightDst(false);
                            }));
                            return 1;
                        })
                    ).then(LiteralArgumentBuilder.<EditTaskContext>literal("on")
                        .executes((info) -> {
                            info.getSource().addEditTask(new ConfigEditTask((config) -> {
                                config.relightDst(true);
                            }));
                            return 1;
                        })
                    )
                )
            )
        );
    }
}

@@ -1933,33 +1933,43 @@
 t%3Eliteral(%22off%22)
+ //src off
 %0A
-
                 
@@ -2316,32 +2316,41 @@
 xt%3Eliteral(%22on%22)
+ //src on
 %0A               
@@ -2805,16 +2805,26 @@
 l(%22off%22)
+ //dst off
 %0A       
@@ -3188,16 +3188,25 @@
 al(%22on%22)
+ //dst on
 %0A       
@@ -3481,32 +3481,32 @@
              %7D)%0A
-
                 
@@ -3503,32 +3503,850 @@
               )%0A
+                ).then(LiteralArgumentBuilder.%3CEditTaskContext%3Eliteral(%22off%22) //both off%0A                    .executes((info) -%3E %7B%0A                        info.getSource().addEditTask(new ConfigEditTask((config) -%3E %7B%0A                            config.relightSrc(false);%0A                            config.relightDst(false);%0A                        %7D));%0A                        return 1;%0A                    %7D)%0A                ).then(LiteralArgumentBuilder.%3CEditTaskContext%3Eliteral(%22on%22) //both on%0A                    .executes((info) -%3E %7B%0A                        info.getSource().addEditTask(new ConfigEditTask((config) -%3E %7B%0A                            config.relightSrc(true);%0A                            config.relightDst(true);%0A                        %7D));%0A                        return 1;%0A                    %7D)%0A
                 

add joint on and off for relight config