Jump to content

Recommended Posts

Posted

I get an error when I try using the /help command. I believe what I return for the command usage affects this.

 

Command:

package easycoins.command;

import java.util.List;

import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import easycoins.api.EasyCoinsAPI;

public class CommandCoinsEC implements ICommand {
private List aliases;

@Override
public String getCommandName() {
	return "coins";
}

@Override
public String getCommandUsage(ICommandSender sender) {
	return "commands.coins.usage";
}

@Override
public void processCommand(ICommandSender sender, String[] args) {
	EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(sender.getCommandSenderName());
	player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.WHITE + "You currently have " + EnumChatFormatting.YELLOW + EasyCoinsAPI.getCoins(player) + EnumChatFormatting.WHITE + " coins."));
}

@Override
public int compareTo(Object o) {
	return 0;
}

@Override
public List getCommandAliases() {
	return aliases;
}

@Override
public boolean canCommandSenderUseCommand(ICommandSender var1) {
	return true;
}

@Override
public List addTabCompletionOptions(ICommandSender var1, String[] var2) {
	return null;
}

@Override
public boolean isUsernameIndex(String[] var1, int var2) {
	return false;
}
}

 

Language File:

commands.coins.usage=/coins

 

If I try returning "coins" then it works fine, but it looks weird if I use the /help command.

 

Am I doing something wrong?

Kain

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.