All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.the_fireplace.grandeconomy.command.commands.GEReloadCommand Maven / Gradle / Ivy

There is a newer version: 4.1.0+1.16.5
Show newest version
package dev.the_fireplace.grandeconomy.command.commands;

import com.mojang.brigadier.Command;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.tree.CommandNode;
import dev.the_fireplace.grandeconomy.GrandEconomy;
import dev.the_fireplace.grandeconomy.command.GeCommand;
import dev.the_fireplace.lib.api.storage.utility.ReloadableManager;
import net.minecraft.class_2168;
import net.minecraft.class_2170;

public final class GEReloadCommand extends GeCommand {

    private final ReloadableManager reloadableManager;

    public GEReloadCommand() {
        reloadableManager = ReloadableManager.getInstance();
    }

    @Override
    public CommandNode register(CommandDispatcher commandDispatcher) {
        return commandDispatcher.register(class_2170.method_9247("gereload")
            .requires(requirements::manageServer)
            .executes(this::execute)
        );
    }

    private int execute(CommandContext command) {
        reloadableManager.reload(GrandEconomy.MODID);
        feedbackSender.basic(command, "commands.grandeconomy.reload.reloaded");
        return Command.SINGLE_SUCCESS;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy