本文整理汇总了Java中org.spongepowered.api.event.command.TabCompleteEvent类的典型用法代码示例。如果您正苦于以下问题:Java TabCompleteEvent类的具体用法?Java TabCompleteEvent怎么用?Java TabCompleteEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TabCompleteEvent类属于org.spongepowered.api.event.command包,在下文中一共展示了TabCompleteEvent类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTab
import org.spongepowered.api.event.command.TabCompleteEvent; //导入依赖的package包/类
@Listener
public void onTab(TabCompleteEvent.Chat e) {
String currentWord;
if (!e.getRawMessage().contains(" ")) {
currentWord = e.getRawMessage();
} else {
String[] words = SPACE.split(e.getRawMessage());
currentWord = words[words.length - 1];
}
if (currentWord.startsWith("@")) {
e.getTabCompletions().addAll(config.groups.stream().map(s -> "@"+s).filter(s -> s.toLowerCase().startsWith(currentWord.toLowerCase())).collect(Collectors.toList()));
e.getTabCompletions().addAll(game.getServer().getOnlinePlayers().stream().map(Player::getName).map(s -> "@"+s).filter(s -> s.toLowerCase().startsWith(currentWord.toLowerCase())).collect(Collectors.toList()));
}
}
示例2: onTabComplete
import org.spongepowered.api.event.command.TabCompleteEvent; //导入依赖的package包/类
@Listener(order = POST)
public void onTabComplete(TabCompleteEvent event, @Root Player player)
{
this.updateLastAction(player);
}
示例3: PorePlayerChatTabCompleteEvent
import org.spongepowered.api.event.command.TabCompleteEvent; //导入依赖的package包/类
public PorePlayerChatTabCompleteEvent(TabCompleteEvent handle, @Source Player source) {
super(null, "", Collections.<String>emptyList());
this.handle = checkNotNull(handle, "handle");
this.source = checkNotNull(source, "source");
}
示例4: getHandle
import org.spongepowered.api.event.command.TabCompleteEvent; //导入依赖的package包/类
@Override
public TabCompleteEvent getHandle() {
return handle;
}