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

io.github.dailystruggle.rtp.bukkit.commands.BukkitBaseRTPCmd Maven / Gradle / Ivy

There is a newer version: 2.0.15
Show newest version
package io.github.dailystruggle.rtp.bukkit.commands;

import io.github.dailystruggle.commandsapi.bukkit.localCommands.BukkitTreeCommand;
import io.github.dailystruggle.commandsapi.common.CommandsAPI;
import io.github.dailystruggle.commandsapi.common.CommandsAPICommand;
import io.github.dailystruggle.rtp.bukkit.tools.SendMessage;
import io.github.dailystruggle.rtp.common.RTP;
import io.github.dailystruggle.rtp.common.configuration.ConfigParser;
import io.github.dailystruggle.rtp.common.configuration.enums.MessagesKeys;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.Nullable;

import java.util.UUID;

public abstract class BukkitBaseRTPCmd extends BukkitTreeCommand implements io.github.dailystruggle.rtp.common.commands.BaseRTPCmd {
    public BukkitBaseRTPCmd(Plugin plugin, @Nullable CommandsAPICommand parent) {
        super(plugin, parent);
    }

    @Override
    public void msgBadParameter(UUID callerId, String parameterName, String parameterValue) {
        CommandSender sender = callerId.equals(CommandsAPI.serverId) ? Bukkit.getConsoleSender() : Bukkit.getPlayer(callerId);
        if (sender == null) return;

        ConfigParser lang = (ConfigParser) RTP.configs.getParser(MessagesKeys.class);

        String msg = String.valueOf(lang.getConfigValue(MessagesKeys.badArg, ""));
        msg = msg.replace("[arg]", parameterName + ":" + parameterValue);
        SendMessage.sendMessage(sender, msg);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy