Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package io.github.diamob;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.PluginDescriptionFile;
- import org.bukkit.plugin.java.JavaPlugin;
- public class sAnnounce extends JavaPlugin {
- public PluginDescriptionFile pdfFile = getDescription();
- @Override
- public void onEnable() {
- Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[" + pdfFile.getName() + "] Version " + pdfFile.getVersion() + " by" + ChatColor.BLUE + "DIAMOB" + ChatColor.YELLOW + " is " + ChatColor.GREEN + "enabled.");
- }
- @Override
- public void onDisable() {
- Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[" + pdfFile.getName() + "] Version " + pdfFile.getVersion() + " by" + ChatColor.BLUE + "DIAMOB" + ChatColor.YELLOW + " is " + ChatColor.RED + "disabled.");
- }
- public boolean onCommand(CommandSender sender, Command cmd, String[] args) {
- Player player = (Player) sender;
- if(cmd.getName().equalsIgnoreCase("a")){
- if(!(sender instanceof Player))
- {
- if(!(sender instanceof org.bukkit.command.ConsoleCommandSender))
- {
- sender.sendMessage(ChatColor.RED + "Error: You must be a player to use this!");
- return false;
- }else
- {
- if(args.length > 1)
- {
- if(player.hasPermission("sannounce.*")) {
- String text = "";
- for (int i = 0; i < args.length; i++) {
- text += args[i] + " ";
- }
- Bukkit.broadcastMessage(ChatColor.GOLD + "[Announcement] " + ChatColor.BLUE + text);
- return true;
- }
- }
- }
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement