Normalized code formatting.
This commit is contained in:
parent
b1db7c5152
commit
134b11f177
122 changed files with 944 additions and 697 deletions
|
@ -12,28 +12,33 @@ import net.minecraft.util.StatCollector;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
public abstract class SubCommandBase implements ISubCommand {
|
||||
public abstract class SubCommandBase implements ISubCommand
|
||||
{
|
||||
|
||||
private ICommand parent;
|
||||
private String name;
|
||||
|
||||
public SubCommandBase(ICommand parent, String name) {
|
||||
public SubCommandBase(ICommand parent, String name)
|
||||
{
|
||||
this.parent = parent;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubCommandName() {
|
||||
public String getSubCommandName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICommand getParentCommand() {
|
||||
public ICommand getParentCommand()
|
||||
{
|
||||
return parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSubCommand(ICommandSender commandSender, String[] args) {
|
||||
public void processSubCommand(ICommandSender commandSender, String[] args)
|
||||
{
|
||||
|
||||
if (args.length == 0 && !getSubCommandName().equals("help"))
|
||||
displayErrorString(commandSender, String.format(StatCollector.translateToLocal("commands.format.error"), capitalizeFirstLetter(getSubCommandName()), getArgUsage(commandSender)));
|
||||
|
@ -42,19 +47,22 @@ public abstract class SubCommandBase implements ISubCommand {
|
|||
displayHelpString(commandSender, String.format(StatCollector.translateToLocal("commands.format.help"), capitalizeFirstLetter(getSubCommandName()), getHelpText()));
|
||||
}
|
||||
|
||||
protected EntityPlayerMP getCommandSenderAsPlayer(ICommandSender commandSender) throws PlayerNotFoundException{
|
||||
protected EntityPlayerMP getCommandSenderAsPlayer(ICommandSender commandSender) throws PlayerNotFoundException
|
||||
{
|
||||
if (commandSender instanceof EntityPlayerMP)
|
||||
return (EntityPlayerMP)commandSender;
|
||||
return (EntityPlayerMP) commandSender;
|
||||
else
|
||||
throw new PlayerNotFoundException(StatCollector.translateToLocal("commands.error.arg.player.missing"));
|
||||
}
|
||||
|
||||
protected EntityPlayerMP getPlayer(ICommandSender commandSender, String playerName) throws PlayerNotFoundException {
|
||||
protected EntityPlayerMP getPlayer(ICommandSender commandSender, String playerName) throws PlayerNotFoundException
|
||||
{
|
||||
EntityPlayerMP entityplayermp = PlayerSelector.matchOnePlayer(commandSender, playerName);
|
||||
|
||||
if (entityplayermp != null)
|
||||
return entityplayermp;
|
||||
else {
|
||||
else
|
||||
{
|
||||
entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(playerName);
|
||||
|
||||
if (entityplayermp == null)
|
||||
|
@ -64,23 +72,28 @@ public abstract class SubCommandBase implements ISubCommand {
|
|||
}
|
||||
}
|
||||
|
||||
protected String capitalizeFirstLetter(String toCapital) {
|
||||
protected String capitalizeFirstLetter(String toCapital)
|
||||
{
|
||||
return String.valueOf(toCapital.charAt(0)).toUpperCase(Locale.ENGLISH) + toCapital.substring(1);
|
||||
}
|
||||
|
||||
protected boolean isBounded(int low, int high, int given) {
|
||||
protected boolean isBounded(int low, int high, int given)
|
||||
{
|
||||
return given > low && given < high;
|
||||
}
|
||||
|
||||
protected void displayHelpString(ICommandSender commandSender, String display, Object ... info) {
|
||||
protected void displayHelpString(ICommandSender commandSender, String display, Object... info)
|
||||
{
|
||||
commandSender.addChatMessage(new ChatComponentText(TextHelper.localizeEffect(display, info)));
|
||||
}
|
||||
|
||||
protected void displayErrorString(ICommandSender commandSender, String display, Object ... info) {
|
||||
protected void displayErrorString(ICommandSender commandSender, String display, Object... info)
|
||||
{
|
||||
commandSender.addChatMessage(new ChatComponentText(TextHelper.localizeEffect(display, info)));
|
||||
}
|
||||
|
||||
protected void displaySuccessString(ICommandSender commandSender, String display, Object ... info) {
|
||||
protected void displaySuccessString(ICommandSender commandSender, String display, Object... info)
|
||||
{
|
||||
commandSender.addChatMessage(new ChatComponentText(TextHelper.localizeEffect(display, info)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue