Skip to content

Instantly share code, notes, and snippets.

@JamiesWhiteShirt
Created July 16, 2017 16:44
Show Gist options
  • Save JamiesWhiteShirt/52775b5ccc96847dd36058de446369af to your computer and use it in GitHub Desktop.
Save JamiesWhiteShirt/52775b5ccc96847dd36058de446369af to your computer and use it in GitHub Desktop.
Correct command
public class CommandPing extends CommandBase {
@Override
public String getCommandName() {
return "ping";
}
@Override
public String getCommandUsage(ICommandSender sender) {
return "commands.ping.usage";
}
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
if (args.length == 1) {
sender.addChatMessage(new TextComponentTranslation("commands.ping.success"));
} else {
throw new WrongUsageException(this.getCommandUsage(sender));
}
}
}
commands.ping.success=The server says pong
commands.ping.usage=/ping <something>
commands.ping.success=El servidor dice pong
commands.ping.usage=/ping <algo>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment