public class Main extends JavaPlugin
{
// Logger variable
Logger myPluginLogger = Bukkit.getLogger();
// Does when plugin is disabled - console logging
@Override
public void onDisable()
{
myPluginLogger.info("Disabling Political Parties...");
}
// Plugin chat help function
public void sendPlayerHelp(String permissions, Player player)
{
// If player does not belong to a party, show them these commands
if (permissions == "nonpartisan")
{
player.sendMessage(ChatColor.YELLOW + "Political Parties by TerraCraft - version 1.0");
player.sendMessage(ChatColor.RED + "/party create <party name> " + ChatColor.YELLOW + "Start a political party");
player.sendMessage(ChatColor.RED + "/party list " + ChatColor.YELLOW + "Shows a list of all of the current political parties");
player.sendMessage(ChatColor.RED + "/party info <party> " + ChatColor.YELLOW + "Shows info about a specific party");
}
// If a player does belong to a party, show them these commands
else if (permissions == "inparty")
{
player.sendMessage(ChatColor.YELLOW + "Political Parties by TerraCraft - version 1.0");
player.sendMessage(ChatColor.RED + "/party leave " + ChatColor.YELLOW + "Leave your current political party");
player.sendMessage(ChatColor.RED + "/party list " + ChatColor.YELLOW + "Shows a list of all of the current political parties");
player.sendMessage(ChatColor.RED + "/party info <party> " + ChatColor.YELLOW + "Shows info about a specific party");
player.sendMessage(ChatColor.RED + "/party deposit <amount> " + ChatColor.YELLOW + "Deposit a specific sum into the party bank account");
player.sendMessage(ChatColor.RED + "/party chat <message> " + ChatColor.YELLOW + "Say specified message in party chat");
}
// If a player is the leader of a party, show them these commands
else if (permissions == "partyleader")
{
player.sendMessage(ChatColor.YELLOW + "Political Parties by TerraCraft - version 1.0");
player.sendMessage(ChatColor.RED + "/party delete " + ChatColor.YELLOW + "Deletes your current political party");
player.sendMessage(ChatColor.RED + "/party list " + ChatColor.YELLOW + "Shows a list of all of the current political parties");
player.sendMessage(ChatColor.RED + "/party info <party> " + ChatColor.YELLOW + "Shows info about a specific party");
player.sendMessage(ChatColor.RED + "/party deposit <amount> " + ChatColor.YELLOW + "Deposit a specific sum into the party bank account");
player.sendMessage(ChatColor.RED + "/party withdraw <amount> " + ChatColor.YELLOW + "Withdraw a specific sum from the party bank account");
player.sendMessage(ChatColor.RED + "/party policy <add|remove> [index] [message] " + ChatColor.YELLOW + "Add or remove a specific policy to/from your political party");
player.sendMessage(ChatColor.RED + "/party invite <player> " + ChatColor.YELLOW + "Invite a player to your political party");
player.sendMessage(ChatColor.RED + "/party kick <player> " + ChatColor.YELLOW + "Kick a player from your political party");
player.sendMessage(ChatColor.RED + "/party giveleader <player> " + ChatColor.YELLOW + "Resign yourself as party leader and give it to another player");
player.sendMessage(ChatColor.RED + "/party chat <message> " + ChatColor.YELLOW + "Say specified message in party chat");
}
}
// Command function
public boolean onCommand(CommandSender theSender, Command cmd, String[] args, String commandLabel)
{
// Party command
if (cmd.getName().equalsIgnoreCase("party"))
{
Player player = (Player) theSender;
// If no arguments are specified, or if the first argument is equal to help, or ?, show them help
if (args.length == 0 || args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("?"))
{
sendPlayerHelp("nonpartisan", player);
}
else
{
}
return true;
}
else
{
}
return false;
}
}
Hello, I have previously created basic Bukkit server plugins, and have worked properly. I am creating a new one, but for some reason, it will not run the command. Just to clarify, the plugin YAML is correctly done (and so are the imports, I just did not feel the need to include them), and there are no compiling errors. I have the command in the command YAML file, and when I load the plugin, it shows up in my plugins list, and when I do /help. When I run the command it just returns the usage: '/party', but will not do the other stuff (send the player the help message). I am not quite sure why it is not working. Have I forgot something by mistake? Also, this is my first question, so apologies if it is not up to standards.
else
blocks and changing how you compareStrings
from==
to.equals()
This doesn't fix the problem, just some tips – Jonah Dec 7 '15 at 3:38