Archived
0

Added sendActionBar(CommandSender sender, String message) method #1

Merged
Minenash merged 1 commits from action_bar into master 2018-11-05 15:18:48 +00:00
2 changed files with 16 additions and 0 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@
### Maven ### Maven
target/ target/
/bin/

View File

@ -6,8 +6,10 @@ import java.util.Random;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandMap; import org.bukkit.command.CommandMap;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import net.md_5.bungee.api.chat.TextComponent;
import net.nemez.chatapi.click.CallbackCommand; import net.nemez.chatapi.click.CallbackCommand;
import net.nemez.chatapi.click.Message; import net.nemez.chatapi.click.Message;
import net.nemez.chatapi.click.PlayerQuitListener; import net.nemez.chatapi.click.PlayerQuitListener;
@ -93,6 +95,19 @@ public class ChatAPI
sender.sendMessage(colorify(null, message)); sender.sendMessage(colorify(null, message));
} }
/** Sends a colorified action bar message to the command sender.
*
* @param sender the command sender to whom to send the action bar message.
* @param message the message to send. */
public static void sendActionBar(CommandSender sender, String message)
{
if (sender instanceof Player)
{
sender.spigot().sendMessage(new TextComponent(colorify(sender, message)));
}
}
/** Checks if a command sender has the permission node required to send chat messages. /** Checks if a command sender has the permission node required to send chat messages.
* *
* @param sender the command sender to check. * @param sender the command sender to check.