Get tab auto completion suggestions working for some more commands
This commit is contained in:
parent
fdd4d6162b
commit
0ee0ac5995
4 changed files with 29 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue