Get tab auto completion suggestions working for some more commands

This commit is contained in:
Pahimar 2015-02-05 20:52:12 -05:00
parent fdd4d6162b
commit 0ee0ac5995
4 changed files with 29 additions and 4 deletions

View file

@ -2,6 +2,7 @@ package com.pahimar.ee3.command;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.util.LogHelper;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
@ -36,7 +37,11 @@ public class CommandPlayerLearnEverything extends CommandBase
@Override
public List addTabCompletionOptions(ICommandSender commandSender, String[] args)
{
// TODO List currently logged in players as options
if (args.length == 2)
{
return getListOfStringsMatchingLastWord(args, FMLCommonHandler.instance().getMinecraftServerInstance().getAllUsernames());
}
return null;
}
}

View file

@ -1,8 +1,10 @@
package com.pahimar.ee3.command;
import com.pahimar.ee3.reference.Names;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.item.Item;
import java.util.List;
@ -35,7 +37,15 @@ public class CommandPlayerLearnItem extends CommandBase
@Override
public List addTabCompletionOptions(ICommandSender commandSender, String[] args)
{
// TODO List currently logged in players as options
if (args.length == 2)
{
return getListOfStringsMatchingLastWord(args, FMLCommonHandler.instance().getMinecraftServerInstance().getAllUsernames());
}
else if (args.length == 3)
{
return getListOfStringsFromIterableMatchingLastWord(args, Item.itemRegistry.getKeys());
}
return null;
}
}

View file

@ -4,6 +4,7 @@ import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.item.Item;
import java.util.List;
@ -36,7 +37,11 @@ public class CommandTemplateForgetItem extends CommandBase
@Override
public List addTabCompletionOptions(ICommandSender commandSender, String[] args)
{
// TODO
if (args.length == 2)
{
return getListOfStringsFromIterableMatchingLastWord(args, Item.itemRegistry.getKeys());
}
return null;
}
}

View file

@ -4,6 +4,7 @@ import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.item.Item;
import java.util.List;
@ -36,7 +37,11 @@ public class CommandTemplateLearnItem extends CommandBase
@Override
public List addTabCompletionOptions(ICommandSender commandSender, String[] args)
{
// TODO
if (args.length == 2)
{
return getListOfStringsFromIterableMatchingLastWord(args, Item.itemRegistry.getKeys());
}
return null;
}
}