Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

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

This is horribly wrong. Look into CommandBase at least before making your own command.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.