Java 类org.bukkit.event.player.PlayerChatTabCompleteEvent 实例源码

项目:Uranium    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:MundoSK    文件:ExprCompletionsOld.java   
@Override
public void set(Event event, String[] value) {
    if (event instanceof PlayerChatTabCompleteEvent) {
        Collection<String> completions = ((PlayerChatTabCompleteEvent) event).getTabCompletions();
        ArrayList<String> newcompletions = new ArrayList<String>(Arrays.asList(value));
        String[] completionsarray = completions.toArray(new String[0]);
        for (int i = 0; i < completionsarray.length; i++) {
            if (newcompletions.contains(completionsarray[i])) {
                newcompletions.remove(completionsarray[i]);
            } else {
                completions.remove(completionsarray[i]);
            }
        }
        for (int i = 0; i < newcompletions.size(); i++) {
            completions.add(newcompletions.get(i));
        }
    }
}
项目:MundoSK    文件:ExprCompletions.java   
@Override
public void set(Event event, String[] value) {
    if (event instanceof PlayerChatTabCompleteEvent) {
        Collection<String> completions = ((PlayerChatTabCompleteEvent) event).getTabCompletions();
        ArrayList<String> newcompletions = new ArrayList<String>(Arrays.asList(value));
        String[] completionsarray = completions.toArray(new String[0]);
        for (int i = 0; i < completionsarray.length; i++) {
            if (newcompletions.contains(completionsarray[i])) {
                newcompletions.remove(completionsarray[i]);
            } else {
                completions.remove(completionsarray[i]);
            }
        }
        for (int i = 0; i < newcompletions.size(); i++) {
            completions.add(newcompletions.get(i));
        }
    } else if (event instanceof TabCompleteEvent) {
        ((TabCompleteEvent) event).setCompletions(Arrays.asList(value));
    }
}
项目:ThermosRebased    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:KCauldron    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:CauldronGit    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:Cauldron-Old    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:DiffUtils    文件:CraftServer_188.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:DiffUtils    文件:CraftServer_1710.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:Cauldron-Reloaded    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:FFoKC    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:CraftBukkit    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:Craftbukkit    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:Almura-Server    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    Player[] players = getOnlinePlayers();
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : players) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:Tweakkit-Server    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:Cauldron    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:RedisChat    文件:RedisChat.java   
@EventHandler
public void onPlayerTabComplete(PlayerChatTabCompleteEvent event) {
    List<String> results = new ArrayList<String>();
    if (event.getLastToken().startsWith("@")) {
        for (Player p: getServer().getOnlinePlayers()) {
            if (p.getName().toLowerCase().startsWith(event.getLastToken().substring(1).toLowerCase())
                    && !event.getPlayer().getName().equals(p.getName()) && event.getPlayer().canSee(p)) {
                results.add("@" + p.getName());
            }
        }
    } else if (event.getLastToken().startsWith("#") && event.getChatMessage().equals(event.getLastToken())) {
        for (Channel c: channelManager.getPlayerChannels(event.getPlayer())) {
            if (c.getName().toLowerCase().startsWith(event.getLastToken().substring(1).toLowerCase())) {
                results.add("#" + c.getName());
            }
        }
    }
    event.getTabCompletions().clear();
    event.getTabCompletions().addAll(results);
}
项目:SpigotSource    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:SpectatorPlus    文件:SpectatorsChatListener.java   
/**
 * Adds autocompletion for spectators even if the player can't see them.
 */
@EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onTabComplete(PlayerChatTabCompleteEvent ev)
{
    if ((Toggles.AUTOCOMPLETE_SPECTATORS_FOR_PLAYERS.get() && !SpectatorPlus.get().getPlayerData(ev.getPlayer()).isSpectating()) || Toggles.AUTOCOMPLETE_SPECTATORS_FOR_SPECTATORS.get())
    {
        final String lowerCaseLastToken = ev.getLastToken().toLowerCase();

        for (Player player : Bukkit.getOnlinePlayers())
        {
            if (SpectatorPlus.get().getPlayerData(player).isSpectating() && !ev.getTabCompletions().contains(player.getName()))
            {
                if (player.getName().toLowerCase().startsWith(lowerCaseLastToken))
                {
                    ev.getTabCompletions().add(player.getName());
                }
            }
        }
    }
}
项目:Craft-city    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    Player[] players = getOnlinePlayers();
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : players) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:MCPBukkit    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    Player[] players = getOnlinePlayers();
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : players) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:McLink    文件:Chat.java   
@EventHandler
public void onTabList(PlayerChatTabCompleteEvent event) {
    /*for (String s : event.getTabCompletions()) {
        Player ap = PlayerUtil.getPlayer(s);
        if (ap == null)
            continue;
        if (!event.getPlayer().canSee(ap))
            event.getTabCompletions().remove(s);
    }*/
    event.getTabCompletions().add("@everyone");
}
项目:MundoSK    文件:ExprCompletionsOld.java   
@Override
protected String[] get(Event event) {
    if (event instanceof PlayerChatTabCompleteEvent) {
        return ((PlayerChatTabCompleteEvent) event).getTabCompletions().toArray(new String[0]);
    }
    return new String[0];
}
项目:MundoSK    文件:ExprCompletionsOld.java   
@Override
public boolean subInit(Expression<?>[] expression, int matchedPattern, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
    if (!ScriptLoader.isCurrentEvent(PlayerChatTabCompleteEvent.class)) {
        Skript.error("The 'completions' expression can only be used in the 'on chat tab complete' event!");
        return false;
    }
    return true;
}
项目:MundoSK    文件:ExprLastTokenOld.java   
@Override
protected String[] get(Event event) {
    if (event instanceof PlayerChatTabCompleteEvent) {
        return new String[]{((PlayerChatTabCompleteEvent) event).getLastToken()};
    }
    return null;
}
项目:MundoSK    文件:ExprLastTokenOld.java   
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
    if (!ScriptLoader.isCurrentEvent(PlayerChatTabCompleteEvent.class)) {
        Skript.error("The 'last token' expression can only be used in the 'on chat tab complete' event!");
        return false;
    }
    return true;
}
项目:MundoSK    文件:ExprLastToken.java   
@Override
protected String[] get(Event event) {
    if (event instanceof PlayerChatTabCompleteEvent) {
        return new String[]{((PlayerChatTabCompleteEvent) event).getLastToken()};
    } else if (event instanceof TabCompleteEvent) {
        String buffer = ((TabCompleteEvent) event).getBuffer();
        if (buffer.endsWith(" ")) {
            return new String[]{""};
        }
        String[] tokens = buffer.split(" ");
        return new String[]{tokens[tokens.length - 1]};
    }
    return null;
}
项目:MundoSK    文件:ExprLastToken.java   
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
    if (!ScriptLoader.isCurrentEvent(PlayerChatTabCompleteEvent.class) && !ScriptLoader.isCurrentEvent(TabCompleteEvent.class)) {
        Skript.error("The 'last token' expression can only be used in the 'on chat tab complete' event and the 'on tab complete' event!");
        return false;
    }
    return true;
}
项目:MundoSK    文件:ExprCompletions.java   
@Override
protected String[] get(Event event) {
    if (event instanceof PlayerChatTabCompleteEvent) {
        return ((PlayerChatTabCompleteEvent) event).getTabCompletions().toArray(new String[0]);
    } else if (event instanceof TabCompleteEvent) {
        return ((TabCompleteEvent) event).getCompletions().toArray(new String[0]);
    }
    return new String[0];
}
项目:MundoSK    文件:ExprCompletions.java   
@Override
public boolean subInit(Expression<?>[] expression, int matchedPattern, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
    if (!ScriptLoader.isCurrentEvent(PlayerChatTabCompleteEvent.class) && !ScriptLoader.isCurrentEvent(TabCompleteEvent.class)) {
        Skript.error("The 'completions' expression can only be used in the 'on chat tab complete' event or the 'on tab complete' event!");
        return false;
    }
    return true;
}
项目:MCChatManager    文件:CallSystem.java   
public static boolean complete(PlayerChatTabCompleteEvent e) {
    if (!e.getChatMessage().startsWith("@"))
        return false;
    if (e.getChatMessage().contains(" "))
        return false;
    String message = e.getChatMessage().split(" ")[0].substring(1).trim();
    List<String> list = new ArrayList<>();
    Bukkit.getOnlinePlayers().forEach((p) -> {
        if (p.getName().toLowerCase().contains(message.toLowerCase()))
            list.add("@" + p.getName());
    });
    e.getTabCompletions().clear();
    e.getTabCompletions().addAll(list);
    return true;
}
项目:Janitor    文件:TabComplete.java   
@EventHandler
public void TabCompleteEvent(PlayerChatTabCompleteEvent e) {
    String[] Args = e.getChatMessage().split(" ");
    Player Player2 = e.getPlayer();
    if (Args[0].startsWith(".") && Args[0].substring(1, 2).equalsIgnoreCase("/")) {
        return;
    }
    if (Args.length > 1 && (Args[0].startsWith(".") || Args[0].startsWith("-") || Args[0].startsWith("#") || Args[0].startsWith("*"))) {
        if (this.TabComplete.containsKey(Player2.getUniqueId()) && System.currentTimeMillis() < this.TabComplete.get(Player2.getUniqueId()) + 1000) {
            return;
        }
        this.getJanitor().logCheat(this, Player2, null, e.getChatMessage());
        this.TabComplete.put(Player2.getUniqueId(), System.currentTimeMillis());
    }
}
项目:BetterShards    文件:BetterShardsListener.java   
@EventHandler(priority = EventPriority.LOWEST)
public void playerTabComplete(PlayerChatTabCompleteEvent event) {
    Collection <String> res = event.getTabCompletions();
    res.clear();
    String lower = event.getLastToken() != null ? event.getLastToken() : "";
    for(String player : MercuryAPI.getAllPlayers()) {
        if (player.toLowerCase().startsWith(lower)) {
            res.add(player);
        }
    }
}
项目:Thermos    文件:CraftServer.java   
public List<String> tabCompleteChat(Player player, String message) {
    List<String> completions = new ArrayList<String>();
    PlayerChatTabCompleteEvent event = new PlayerChatTabCompleteEvent(player, message, completions);
    String token = event.getLastToken();
    for (Player p : getOnlinePlayers()) {
        if (player.canSee(p) && StringUtil.startsWithIgnoreCase(p.getName(), token)) {
            if (event.isPinging())
            {
                StringBuilder sb = new StringBuilder(1 + p.getName().length());
                sb.append('@'); sb.append(p.getName());
                completions.add(sb.toString());
            }
            else
                completions.add(p.getName());
        }
    }
    pluginManager.callEvent(event);

    Iterator<?> it = completions.iterator();
    while (it.hasNext()) {
        Object current = it.next();
        if (!(current instanceof String)) {
            // Sanity
            it.remove();
        }
    }
    Collections.sort(completions, String.CASE_INSENSITIVE_ORDER);
    return completions;
}
项目:Chatterbox    文件:ChatterboxListener.java   
@EventHandler(ignoreCancelled = true)
public void atTagTabComplete(final PlayerChatTabCompleteEvent event) {
    final String message = event.getChatMessage();
    final String token = event.getLastToken();
    if (!message.equals(token) && !token.startsWith("@")) return;
    final String partialChannelTag = token.substring(1).toLowerCase();
    event.getTabCompletions().addAll(
        this.chatterbox.getAPI().getChannelAPI().getAllChannelTags().stream()
            .filter(tag -> tag.toLowerCase().startsWith(partialChannelTag))
            .map(tag -> "@" + tag)
            .collect(Collectors.toSet())
    );
}
项目:At-Bukkit    文件:Main.java   
@EventHandler
public void onTabComplete(PlayerChatTabCompleteEvent event) {
    String uncomplete = event.getChatMessage();
    if (uncomplete.contains("@") && !uncomplete.endsWith(" ")) {
        List<Player> allplayers = new ArrayList<Player>();
        allplayers.addAll(Arrays.asList(Bukkit.getServer()
                .getOnlinePlayers()));
        String at = uncomplete.substring(uncomplete.lastIndexOf("@") + 1);
        List<String> fit = new ArrayList<String>();
        for (Player p : allplayers) {
            if (p.getName().toLowerCase().startsWith(at.toLowerCase())) {
                if (uncomplete.contains(" ")) {
                    fit.add(uncomplete.substring(
                            uncomplete.lastIndexOf(" ") + 1,
                            uncomplete.lastIndexOf("@"))
                            + "@" + p.getName());
                    // event.getPlayer().sendMessage(ChatColor.RED+event.getTabCompletions().toString()+ChatColor.GREEN+event.getLastToken());
                } else {
                    fit.add(uncomplete.substring(0,
                            uncomplete.lastIndexOf("@"))
                            + "@" + p.getName());
                    // event.getPlayer().sendMessage(ChatColor.RED+event.getTabCompletions().toString()+ChatColor.GREEN+event.getLastToken());
                }
            }
        }
        event.getTabCompletions().clear();
        event.getTabCompletions().addAll(fit);
        // event.getPlayer().sendMessage(ChatColor.RED+event.getTabCompletions().toString()+ChatColor.GREEN+event.getLastToken());
    }
}
项目:tregmine    文件:TabListener.java   
@EventHandler
public void tabcomplete(PlayerChatTabCompleteEvent e) {

    TregminePlayer p = plugin.getPlayer(e.getPlayer());
    if (p.getRank().canGetTrueTab()) {
        return;
    }

    e.getTabCompletions().clear();
    String[] args = e.getChatMessage().split(" ");
    if (args.length == 0) {
        return;
    }

    List<String> nonOps = new ArrayList<String>();
    List<String> result = new ArrayList<String>();

    for (TregminePlayer player : plugin.getOnlinePlayers()) {
        if (!player.hasFlag(TregminePlayer.Flags.INVISIBLE)) {
            nonOps.add(player.getName());
        }
    }

    for (String name : nonOps) {
        if (name.toLowerCase().startsWith(args[args.length - 1].toLowerCase())) {
            result.add(name);
        }
    }

    e.getTabCompletions().addAll(result);
}
项目:xEssentials-deprecated-bukkit    文件:ChatHighLightEvent.java   
@EventHandler
public void onTabComplete(PlayerChatTabCompleteEvent e) {
    e.getTabCompletions().clear();
    for(XOfflinePlayer off : pl.getManagers().getPlayerManager().getOfflinePlayers()) {
            if(off.getName().toUpperCase().startsWith(e.getLastToken().toUpperCase())) {
                e.getTabCompletions().add(off.getName());
            }
    }
}
项目:At-Bukkit    文件:Main.java   
@EventHandler
public void onTabComplete(PlayerChatTabCompleteEvent event) {
    String uncomplete = event.getChatMessage();
    if (uncomplete.contains("@") && !uncomplete.endsWith(" ")) {
        List<Player> allplayers = new ArrayList<Player>();
        allplayers.addAll(Arrays.asList(Bukkit.getServer()
                .getOnlinePlayers()));
        String at = uncomplete.substring(uncomplete.lastIndexOf("@") + 1);
        List<String> fit = new ArrayList<String>();
        for (Player p : allplayers) {
            if (p.getName().toLowerCase().startsWith(at.toLowerCase())) {
                if (uncomplete.contains(" ")) {
                    fit.add(uncomplete.substring(
                            uncomplete.lastIndexOf(" ") + 1,
                            uncomplete.lastIndexOf("@"))
                            + "@" + p.getName());
                    // event.getPlayer().sendMessage(ChatColor.RED+event.getTabCompletions().toString()+ChatColor.GREEN+event.getLastToken());
                } else {
                    fit.add(uncomplete.substring(0,
                            uncomplete.lastIndexOf("@"))
                            + "@" + p.getName());
                    // event.getPlayer().sendMessage(ChatColor.RED+event.getTabCompletions().toString()+ChatColor.GREEN+event.getLastToken());
                }
            }
        }
        event.getTabCompletions().clear();
        event.getTabCompletions().addAll(fit);
        // event.getPlayer().sendMessage(ChatColor.RED+event.getTabCompletions().toString()+ChatColor.GREEN+event.getLastToken());
    }
}
项目:InteliAutomataMC    文件:ChatListener.java   
@EventHandler(priority = EventPriority.LOW)
public void onTab(PlayerChatTabCompleteEvent event) {
    if (!plugin.getCore().isInputtingKorean(event.getPlayer().getUniqueId()) && plugin.getCore().useTab && event.getPlayer().hasPermission("inteliautomatabukkit.tab"))  {
        event.getTabCompletions().add(InteliAutomata.convert(event.getLastToken()));
    }
}