use of net.md_5.bungee.api.CommandSender in project Minigames by AddstarMC.
the class MessageManager method sendClickedCommandMessage.
public static void sendClickedCommandMessage(CommandSender target, String command, String identifier, String key, Object... args) {
BaseComponent init = getMessageStart(MinigameMessageType.INFO);
TextComponent message = new TextComponent(getMessage(identifier, key, args));
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command));
sendMessage(target, init, message);
}
use of net.md_5.bungee.api.CommandSender in project Minigames by AddstarMC.
the class MessageManager method sendMessage.
public static void sendMessage(CommandSender target, MinigameMessageType type, String identifier, String key, Object... args) {
BaseComponent init = getMessageStart(type);
TextComponent message = new TextComponent(getMessage(identifier, key, args));
sendMessage(target, init, message);
}
use of net.md_5.bungee.api.CommandSender in project DiscordBot by LXGaming.
the class DiscordChatCommand method execute.
@Override
public void execute(CommandSender sender, String[] args) {
StringBuilder stringBuilder = new StringBuilder();
for (String arg : args) {
stringBuilder.append(arg + " ");
}
if (stringBuilder.toString().trim().length() == 0) {
sender.sendMessage(new ComponentBuilder("Message cannot be blank!").color(ChatColor.RED).create());
return;
}
Message message = new Message().setChannel(DiscordBotCore.getInstance().getConfiguration().getChannels().get(this.name).getChannel()).setFormat(DiscordBotCore.getInstance().getConfiguration().getChannelFormat().get(this.name)).setName(sender.getName()).setNick("").setServer("Unknown").setMessage(stringBuilder.toString().trim()).setDiscord(true).setMinecraft(true).setConsole(true).setRedis(true);
if (sender instanceof ProxiedPlayer) {
ProxiedPlayer player = (ProxiedPlayer) sender;
if (DiscordBotCore.getInstance().getDatabaseManager().checkDatabase(player.getUniqueId())) {
player.sendMessage(new ComponentBuilder("DiscordChat disabled. '/DiscordBot Toggle' to enable").color(ChatColor.RED).create());
return;
}
message.setName(player.getName()).setNick(player.getDisplayName());
if (player.getServer() != null && player.getServer().getInfo() != null) {
message.setServer(player.getServer().getInfo().getName());
}
}
DiscordBotCore.getInstance().getMessageSender().sendMessage(message);
}
use of net.md_5.bungee.api.CommandSender in project DiscordBot by LXGaming.
the class DiscordBotCommand method execute.
@Override
public void execute(CommandSender sender, String[] args) {
if (args.length == 0) {
sender.sendMessage(new ComponentBuilder("===== ").color(ChatColor.GOLD).append("DiscordBot - Bungeecord Edition").color(ChatColor.GREEN).append(" =====").color(ChatColor.GOLD).create());
sender.sendMessage(new ComponentBuilder("Version - ").color(ChatColor.GOLD).append(DiscordBotCore.getInstance().getConfiguration().getDiscordBotVersion()).color(ChatColor.AQUA).create());
sender.sendMessage(new ComponentBuilder("JDA - ").color(ChatColor.GOLD).append(DiscordBotCore.getInstance().getConfiguration().getJDAVersion()).color(ChatColor.AQUA).create());
sender.sendMessage(new ComponentBuilder("Author - ").color(ChatColor.GOLD).append("LX_Gaming").color(ChatColor.AQUA).create());
return;
}
if (args.length == 1 && args[0].equalsIgnoreCase("reload") && sender.hasPermission("DiscordBot.Reload")) {
DiscordBot.getInstance().reloadDiscordBot();
sender.sendMessage(new ComponentBuilder("DiscordBot reloaded.").color(ChatColor.GREEN).create());
return;
}
if (!(sender instanceof ProxiedPlayer)) {
sender.sendMessage(new ComponentBuilder("Command cannot be run from Console").color(ChatColor.RED).create());
return;
}
ProxiedPlayer proxiedPlayer = (ProxiedPlayer) sender;
if (args.length == 1 && (args[0].equalsIgnoreCase("toggle") || args[0].equalsIgnoreCase("t")) && proxiedPlayer.hasPermission("DiscordBot.Toggle")) {
DiscordBotCore.getInstance().getDatabaseManager().togglePlayerDatabase(proxiedPlayer.getUniqueId());
}
}
use of net.md_5.bungee.api.CommandSender in project VotingPlugin by Ben12345rocks.
the class VotingPluginBungeeCommand method execute.
@Override
public void execute(CommandSender sender, String[] args) {
if (sender.hasPermission("votingplugin.admin")) {
if (args.length > 0) {
if (args[0].equalsIgnoreCase("reload")) {
bungee.reload(false);
sender.sendMessage(new TextComponent("&aReloading VotingPluginBungee"));
}
if (args[0].equalsIgnoreCase("reloadmysql")) {
bungee.reload(true);
sender.sendMessage(new TextComponent("&aReloading VotingPluginBungee with MySQL"));
}
if (args[0].equalsIgnoreCase("vote")) {
if (args.length >= 2) {
String user = args[1];
String site = args[2];
bungee.vote(user, site, false);
sender.sendMessage(new TextComponent("Sending vote"));
}
}
if (args[0].equalsIgnoreCase("status")) {
if (bungee.getMethod().equals(BungeeMethod.SOCKETS)) {
sender.sendMessage(new TextComponent("&aChecking status, waiting for response, check console, method: sockets"));
bungee.status(sender);
} else if (bungee.getMethod().equals(BungeeMethod.PLUGINMESSAGING)) {
sender.sendMessage(new TextComponent("&aChecking status, waiting for response, check console, method: plugin messaging"));
bungee.status(sender);
} else {
sender.sendMessage(new TextComponent("&aNot using socket/pluginmessage method, command unavailable"));
}
}
if (args[0].equalsIgnoreCase("help")) {
TextComponent[] msg = new TextComponent[4];
msg[0] = new TextComponent("&avotingpluginbungee reload - Reload plugin");
msg[1] = new TextComponent("&avotingpluginbungee reloadmysql - Reload plugin including mysql");
msg[2] = new TextComponent("&avotingpluginbungee vote (player) (servicesite) - Send bungee vote");
msg[3] = new TextComponent("&avotingpluginbungee status - Check socket connection status");
sender.sendMessage(msg);
}
}
} else {
sender.sendMessage(new TextComponent("&cYou do not have permission to do this!"));
}
}
Aggregations