[HELP] Creating Multiple Commands?

Discussion in 'Spigot Plugin Development' started by Ithladohr, Jul 11, 2015.

  1. Ok people's of the internet and Spigot.
    I need some help, with creating multiple commands.
    The only thing that worked for me was creating arguments, it was like:
    /banana eat and that's it, i would like to know how i create multiple arguments/commands.
    For example: /banana give Ithladohr, wich is the name of the player. (Ithladohr is my IGN)
    I also would like to know how i code multiple COMMANDS.

    My current code:

    package me.Ithladohr.ROSPlugin;

    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Effect;
    import org.bukkit.Sound;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;
    import org.bukkit.scoreboard.DisplaySlot;
    import org.bukkit.scoreboard.Objective;
    import org.bukkit.scoreboard.Score;
    import org.bukkit.scoreboard.Scoreboard;
    import org.bukkit.scoreboard.ScoreboardManager;

    public class Main extends JavaPlugin {

    @Override
    public void onEnable() {
    getLogger().info("ROSPlugin enabled.");
    }
    @Override
    public void onDisable() {
    getLogger().info("ROSPlugin Disabled.");

    }
    @SuppressWarnings("deprecation")
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[]args) {
    Player player = (Player) sender;
    if (sender.hasPermission("ros.main"));
    if(cmd.getName().equalsIgnoreCase("ros")) {
    if (args.length == 0) {
    player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "Commands ROSPlugin:");
    player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Main Command ROSPlugin.");
    player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros startwar" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Start a war.");
    player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros stopwar" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Stop a war.");
    player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros god" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Enable God Mode (For roleplaying, you can still die)");
    player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros vanish" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Become invisible, poof. (For Spectating, Don't abuse) Shortcut: /ros v");
    player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros vision" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Enable (night) vision. (For Spectating, Don't abuse)");
    player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros cchat" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Clear the chat.");
    player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros thunderstrike" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Strikes lightning at your location.'(With Explosion)");
    player.playSound(player.getLocation(), Sound.CLICK, 5, 4);

    }else if(args[0].equalsIgnoreCase("startwar")) {
    player.sendMessage(ChatColor.RED + "You have started the war!");
    player.sendMessage(ChatColor.RED + "Goodluck! And have fun!");
    player.playSound(player.getLocation(), Sound.FIREWORK_LAUNCH, 5, 5);
    player.playSound(player.getLocation(), Sound.WITHER_SPAWN, 5, 5);
    player.playEffect(player.getLocation(), Effect.CLOUD, 30);
    player.playEffect(player.getLocation(), Effect.SMOKE, 30);
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage(ChatColor.BOLD + "" + ChatColor.RED + "THE WAR HAS BEGUN!");
    Bukkit.broadcastMessage("");

    ScoreboardManager sbm = Bukkit.getScoreboardManager();
    Scoreboard sBoard = sbm.getNewScoreboard();
    Objective obj = sBoard.registerNewObjective("test", "test");
    obj.setDisplaySlot(DisplaySlot.SIDEBAR);
    obj.setDisplayName("" + ChatColor.DARK_RED + ChatColor.BOLD + "WAR");

    Score score=obj.getScore(Bukkit.getOfflinePlayer(ChatColor.RED + "NO WAR"));
    score.setScore(1);
    for(Player player1 : Bukkit.getOnlinePlayers()) {
    player1.setScoreboard(sBoard);
    }}else if(args[0].equalsIgnoreCase("stopwar")) {
    player.sendMessage(ChatColor.RED + "You have stopped the war! Say the Kingdoms to return to their homeland!");
    player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 5, 5);
    player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 5, 5);
    player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 5, 5);
    player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 5, 5);
    player.playEffect(player.getLocation(), Effect.CLOUD, 25);
    player.playEffect(player.getLocation(), Effect.SMOKE, 30);
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage(ChatColor.BOLD + "" + ChatColor.RED + "THE WAR HAS ENDED! RETURN TO YOUR HOMELAND!");
    Bukkit.broadcastMessage("");

    ScoreboardManager sbm = Bukkit.getScoreboardManager();
    Scoreboard sBoard = sbm.getNewScoreboard();

    for(Player player1 : Bukkit.getOnlinePlayers()) {
    player1.setScoreboard(sBoard);
    }}else if(args[0].equalsIgnoreCase("god")) {
    player.sendMessage(ChatColor.RED + "God mode is now enabled! /heal to disable. Don't abuse!");
    player.playSound(player.getLocation(), Sound.WITHER_SPAWN, 5, 5);
    player.playEffect(player.getLocation(), Effect.WITCH_MAGIC, 30);
    player.playEffect(player.getLocation(), Effect.HEART, 40);
    player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 1000000, 4));
    player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 1000000, 4));
    player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 1000000, 1));
    player.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1000000, 0));
    player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1000000, 1));
    player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 1000000, 3));
    player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 1000000, 2));
    player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 1000000, 2));
    }else if(args[0].equalsIgnoreCase("vanish")) {
    player.sendMessage(ChatColor.RED + "You're now invisible, poof. /heal to disable. Don't abuse! Shortcut: /ros v");
    player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100000, 2));
    player.playSound(player.getLocation(), Sound.BURP, 5, 4);
    player.playEffect(player.getLocation(), Effect.MAGIC_CRIT, 20);
    player.playEffect(player.getLocation(), Effect.LARGE_SMOKE, 25);

    }else if(args[0].equalsIgnoreCase("v")) {
    player.sendMessage(ChatColor.RED + "You're now invisible, poof. /heal to disable. Don't abuse!");
    player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100000, 2));
    player.playSound(player.getLocation(), Sound.BURP, 5, 4);
    player.playEffect(player.getLocation(), Effect.MAGIC_CRIT, 20);
    player.playEffect(player.getLocation(), Effect.LARGE_SMOKE, 25);

    }else if(args[0].equalsIgnoreCase("vision")) {
    player.sendMessage(ChatColor.RED + "You now have (night) vision, woah. /heal to disable. Don't abuse!");
    player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 100000, 2));
    player.playSound(player.getLocation(), Sound.DRINK, 5, 4);
    player.playEffect(player.getLocation(), Effect.CRIT, 30);
    player.playEffect(player.getLocation(), Effect.HAPPY_VILLAGER, 25);

    }else if(args[0].equalsIgnoreCase("cchat")) {
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage("");
    Bukkit.broadcastMessage(ChatColor.BLUE + "Chat cleared by: " + ChatColor.DARK_AQUA + player.getName() + ChatColor.BLUE + "!");
    player.playSound(player.getLocation(), Sound.CLICK, 5, 4);
    player.playEffect(player.getLocation(), Effect.SMOKE, 40);
    }
    }else {
    player.sendMessage(ChatColor.RED + "We don't know that command. Try /ros for all commands.");
    player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 4, 4);
    player.playEffect(player.getLocation(), Effect.VILLAGER_THUNDERCLOUD, 1);
    }
    return true;

    }}


    ______________________________________________________________

    Also i would like to know, how to create FAKE Explosions in a command, or a specified argument.

    For example: }else if(args[0].equalsIgnoreCase("expleffect")) {

    I think i need help with some more things.

    Such as like:
    - How do i display my health on a scoreboard.
    - How do i code 1.8 Particles, cause if i use:
    player.getWorld().playEffect(player.getLocation(), Effect.CLOUD, 50);
    player.getWorld().playEffect(player.getLocation(), Effect.SNOW_SHOVEL, 50);
    Then it's just a little poof of the specified particle.
    - I would like to know how to use multiple classes.
    - I would like to know how to change the name of a given item of an itemstack. And maybe enchantments/lores.
    - How can create a config.yml file, with things like:
    How to change the scoreboard so;
    ScoreboardManager sbm = Bukkit.getScoreboardManager();
    Scoreboard sBoard = sbm.getNewScoreboard();
    Objective obj = sBoard.registerNewObjective("test", "test");
    obj.setDisplaySlot(DisplaySlot.SIDEBAR);
    obj.setDisplayName("" + ChatColor.DARK_RED + ChatColor.BOLD + "How do i change this in a config file or maybe in game.");

    Score score=obj.getScore(Bukkit.getOfflinePlayer(ChatColor.RED + "Same for this one."));
    score.setScore(1);
    for(Player player1 : Bukkit.getOnlinePlayers()) {
    player1.setScoreboard(sBoard);
    - How can i drop a item, with a command so when a player dies with an Event, or when a player gets hit there will be a particle or something like bleed.
    -How can i use titles/subtitles/actionbars?
    Following are needed to be in one command.
    - How do i change Nicknames without using essentials.
    - How do i change the name-tag of a player with colors.
    - How do i change the TAB name of a player with colors.

    Thanks all! <3 I hope u guys can help me! :D
     
  2. Please please please use the right code tags... Click Insert(Page looking thing)>Code> Paste it there. It's very hard for me to read.

    The second thing I need to point out, and please don't take offence, but you need to Google some of this stuff.

    Third, I need to know is how well do you know Java? and the Documentation associated with Java and Spigot?


    To do multiple commands, it's just like using that args[0] but instead of 0, use 1.
     
  3. Just use command executors. You would put them all into your main class, and have separate classes for each command.
     
  4. Code (Text):
    package me.Ithladohr.ROSPlugin;

    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Effect;
    import org.bukkit.Sound;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;
    import org.bukkit.scoreboard.DisplaySlot;
    import org.bukkit.scoreboard.Objective;
    import org.bukkit.scoreboard.Score;
    import org.bukkit.scoreboard.Scoreboard;
    import org.bukkit.scoreboard.ScoreboardManager;

    public class Main extends JavaPlugin {

        @Override
        public void onEnable() {
        getLogger().info("ROSPlugin enabled.");
    }
    @Override
        public void onDisable() {
        getLogger().info("ROSPlugin Disabled.");
       
    }
    @SuppressWarnings("deprecation")
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[]args) {
        Player player = (Player) sender;
        if (sender.hasPermission("ros.main"));
        if(cmd.getName().equalsIgnoreCase("ros")) {
            if (args.length == 0) {
                player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "Commands ROSPlugin:");
                player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Main Command ROSPlugin.");
                player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros startwar" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Start a war.");
                player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros stopwar" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Stop a war.");
                player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros god" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Enable God Mode (For roleplaying, you can still die)");
                player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros vanish" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Become invisible, poof. (For Spectating, Don't abuse) Shortcut: /ros v");
                player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros vision" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Enable (night) vision. (For Spectating, Don't abuse)");
                player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros cchat" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Clear the chat.");
                player.sendMessage(ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ROS" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY + "/ros thunderstrike" + ChatColor.YELLOW + " - " + ChatColor.GRAY + "Strikes lightning at your location.'(With Explosion)");
                player.playSound(player.getLocation(), Sound.CLICK, 5, 4);
               
            }else if(args[0].equalsIgnoreCase("startwar")) {
                player.sendMessage(ChatColor.RED + "You have started the war!");
                player.sendMessage(ChatColor.RED + "Goodluck! And have fun!");
                player.playSound(player.getLocation(), Sound.FIREWORK_LAUNCH, 5, 5);
                player.playSound(player.getLocation(), Sound.WITHER_SPAWN, 5, 5);
                player.playEffect(player.getLocation(), Effect.CLOUD, 30);
                player.playEffect(player.getLocation(), Effect.SMOKE, 30);
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage(ChatColor.BOLD + "" + ChatColor.RED + "THE WAR HAS BEGUN!");
                Bukkit.broadcastMessage("");
               
                ScoreboardManager sbm = Bukkit.getScoreboardManager();
                Scoreboard sBoard = sbm.getNewScoreboard();
                Objective obj = sBoard.registerNewObjective("test", "test");
                obj.setDisplaySlot(DisplaySlot.SIDEBAR);
                obj.setDisplayName("" + ChatColor.DARK_RED + ChatColor.BOLD + "WAR");
               
                Score score=obj.getScore(Bukkit.getOfflinePlayer(ChatColor.RED + "NO WAR"));
                score.setScore(1);
                for(Player player1 : Bukkit.getOnlinePlayers()) {
                    player1.setScoreboard(sBoard);
            }}else if(args[0].equalsIgnoreCase("stopwar")) {
                player.sendMessage(ChatColor.RED + "You have stopped the war! Say the Kingdoms to return to their homeland!");
                player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 5, 5);
                player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 5, 5);
                player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 5, 5);
                player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 5, 5);
                player.playEffect(player.getLocation(), Effect.CLOUD, 25);
                player.playEffect(player.getLocation(), Effect.SMOKE, 30);
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage(ChatColor.BOLD + "" + ChatColor.RED + "THE WAR HAS ENDED! RETURN TO YOUR HOMELAND!");
                Bukkit.broadcastMessage("");
               
                ScoreboardManager sbm = Bukkit.getScoreboardManager();
                Scoreboard sBoard = sbm.getNewScoreboard();
               
                for(Player player1 : Bukkit.getOnlinePlayers()) {
                    player1.setScoreboard(sBoard);
            }}else if(args[0].equalsIgnoreCase("god")) {
                player.sendMessage(ChatColor.RED + "God mode is now enabled! /heal to disable. Don't abuse!");
                player.playSound(player.getLocation(), Sound.WITHER_SPAWN, 5, 5);
                player.playEffect(player.getLocation(), Effect.WITCH_MAGIC, 30);
                player.playEffect(player.getLocation(), Effect.HEART, 40);
                player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 1000000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 1000000, 4));
                player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 1000000, 1));
                player.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1000000, 0));
                player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1000000, 1));
                player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 1000000, 3));
                player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 1000000, 2));
                player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 1000000, 2));
            }else if(args[0].equalsIgnoreCase("vanish")) {
                player.sendMessage(ChatColor.RED + "You're now invisible, poof. /heal to disable. Don't abuse! Shortcut: /ros v");
                player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100000, 2));
                player.playSound(player.getLocation(), Sound.BURP, 5, 4);
                player.playEffect(player.getLocation(), Effect.MAGIC_CRIT, 20);
                player.playEffect(player.getLocation(), Effect.LARGE_SMOKE, 25);
               
            }else if(args[0].equalsIgnoreCase("v")) {
                player.sendMessage(ChatColor.RED + "You're now invisible, poof. /heal to disable. Don't abuse!");
                player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100000, 2));
                player.playSound(player.getLocation(), Sound.BURP, 5, 4);
                player.playEffect(player.getLocation(), Effect.MAGIC_CRIT, 20);
                player.playEffect(player.getLocation(), Effect.LARGE_SMOKE, 25);
               
            }else if(args[0].equalsIgnoreCase("vision")) {
                player.sendMessage(ChatColor.RED + "You now have (night) vision, woah. /heal to disable. Don't abuse!");
                player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 100000, 2));
                player.playSound(player.getLocation(), Sound.DRINK, 5, 4);
                player.playEffect(player.getLocation(), Effect.CRIT, 30);
                player.playEffect(player.getLocation(), Effect.HAPPY_VILLAGER, 25);
               
            }else if(args[0].equalsIgnoreCase("cchat")) {
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage("");
                Bukkit.broadcastMessage(ChatColor.BLUE + "Chat cleared by: " + ChatColor.DARK_AQUA + player.getName() + ChatColor.BLUE + "!");
                player.playSound(player.getLocation(), Sound.CLICK, 5, 4);
                player.playEffect(player.getLocation(), Effect.SMOKE, 40);
               
            }else if(args[0].equalsIgnoreCase("mstrike")) {
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().playEffect(player.getLocation(), Effect.CLOUD, 50);
                player.getWorld().playEffect(player.getLocation(), Effect.SNOW_SHOVEL, 50);
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.playEffect(player.getLocation(), Effect.SMOKE, 1);
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().createExplosion(player.getLocation(), 3);
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().playEffect(player.getLocation(), Effect.CLOUD, 50);
                player.sendMessage(ChatColor.RED + "Striked lightning at your location!");
                Bukkit.broadcastMessage(ChatColor.GRAY + "An Huge Thunder clap sounds along the world.");
               
            }else if(args[0].equalsIgnoreCase("sstrike")) {
                player.getWorld().createExplosion(player.getLocation(), 2);
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
               
            }else if(args[0].equalsIgnoreCase("lstrike")) {
                player.getWorld().createExplosion(player.getLocation(), 1);
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().createExplosion(player.getLocation(), 4);
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
                player.getWorld().strikeLightning(player.getLocation());
               
            }
            }else {
                player.sendMessage(ChatColor.RED + "We don't know that command. Try /ros for all commands.");
                player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 4, 4);
                player.playEffect(player.getLocation(), Effect.VILLAGER_THUNDERCLOUD, 1);
        }
        return true;

    }}
     
     
  5. Sorry, created my account yesterday..
     
  6. Code (Text):
    if (cmd.getName().equalsIgnoreCase("command1") {

      // do something
      return true; = needed to make the statment finished
    }

    if (cmd.getName().equalsIgnoreCase("anothercmd") {
      // continue
    return true;
    }
    Code (Text):
    // best clearchat

    if(cmd.getName().equalsIgnoreCase("clearchat") {
    for (int i = 0; i < 100; i++)
        bukkit.broadcastmessage(" ");
       return true;
    }
     
  7. thats what i did in my plugin LOL
     
  8. nope you didn't ....
    there are no return true; that I see .

    you did
    if (cmd command) {

    } else if (cmd command) {

    }
     
  9. Code (Text):
    Bukkit.broadcastMessage(ChatColor.BLUE + "Chat cleared by: " + ChatColor.DARK_AQUA + player.getName() + ChatColor.BLUE + "!");
    player.playSound(player.getLocation(), Sound.CLICK, 5, 4);
    player.playEffect(player.getLocation(), Effect.SMOKE, 40);
    }
    Try doing sender.getName()