|
| 1 | +/* |
| 2 | + * EffectTimerPlus |
| 3 | + * Copyright (C) 2026 TerminalMC |
| 4 | + * |
| 5 | + * This program is free software: you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU Lesser General Public License as |
| 7 | + * published by the Free Software Foundation, version 3 of the License. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +package dev.terminalmc.effecttimerplus.command; |
| 19 | + |
| 20 | +import com.mojang.brigadier.Command; |
| 21 | +import com.mojang.brigadier.CommandDispatcher; |
| 22 | +import com.mojang.brigadier.builder.LiteralArgumentBuilder; |
| 23 | +import dev.terminalmc.effecttimerplus.EffectTimerPlus; |
| 24 | +import dev.terminalmc.effecttimerplus.gui.screen.ConfigScreenProvider; |
| 25 | +import net.minecraft.client.Minecraft; |
| 26 | +import net.minecraft.commands.CommandBuildContext; |
| 27 | + |
| 28 | +import static net.minecraft.commands.Commands.literal; |
| 29 | + |
| 30 | +public class Commands { |
| 31 | + |
| 32 | + private Commands() { |
| 33 | + throw new UnsupportedOperationException("This class cannot be instantiated."); |
| 34 | + } |
| 35 | + |
| 36 | + public static <S> void register(CommandDispatcher<S> dispatcher, CommandBuildContext buildCtx) { |
| 37 | + Minecraft mc = Minecraft.getInstance(); |
| 38 | + //noinspection unchecked |
| 39 | + dispatcher.register((LiteralArgumentBuilder<S>) literal(EffectTimerPlus.MOD_ID) |
| 40 | + .executes((ctx) -> { |
| 41 | + mc.schedule(() -> mc.setScreen(ConfigScreenProvider.getConfigScreen(null))); |
| 42 | + return Command.SINGLE_SUCCESS; |
| 43 | + }) |
| 44 | + ); |
| 45 | + } |
| 46 | +} |
0 commit comments