Problem/Bug Plugin return problems

Discussion in 'Plugin Help/Development/Requests' started by EvanChrispie, Jan 14, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    EvanChrispie

    I started making a Maven project for the first time, and I copy and pasted in a previous broadcast plugin I made, which worked as a java project, but now in the Maven project its being weird. So what's happening is I think to do with the plugin.yml and the usage of my plugin.yml. Because when I don't put a usage in for the broadcast command it returns empty ingame , but when I do the usage which is /<command> it returns ingame with /broadcast instead of [Broadcast]<message> If someone could help that would be great thanks.
    Code:
    Code:
    package io.github.evanchrispie.TestPlugin;
    
    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.java.JavaPlugin;
    
    public class Broadcast extends JavaPlugin{
    
        public void onEnable(){
            getLogger().info("Plugin Enabled!");
        }
        public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
    Player player = (Player) sender;
    String message = "";
    for (String part : args) {
    if (message != "") message += " ";
    message += part;
    }
    Bukkit.getServer().broadcastMessage(ChatColor.GOLD + "[" + ChatColor.AQUA + "Broadcast"+ ChatColor.GOLD + "]" + ChatColor.GREEN + " " + message);
    if (alias.equalsIgnoreCase("broadcast")) {
    if (args.length == 0) {
    player.sendMessage(message);
    } else {
       
    }   
        }   
    return false;
    }
        }
    Plugin.yml:
    Code:
    name: TestPlugin
    version: 1.2
    main: io.github.evanchrispie.TestPlugin.Main
    commands:
      broadcast:
        description: Broadcast a server wide message
     
Thread Status:
Not open for further replies.

Share This Page