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

项目:PetBlocks    文件:PetDataListener.java   
private void handleChatMessage(PlayerChatEvent event) {
    if (this.namingPlayers.contains(event.getPlayer()) || this.namingSkull.contains(event.getPlayer()))
        event.setCancelled(true);
    final PetBlock petBlock;
    if ((petBlock = this.getPetBlock(event.getPlayer())) != null) {
        if (this.namingSkull.contains(event.getPlayer())) {
            this.renameSkull(event.getPlayer(), event.getMessage(), petBlock.getMeta(), petBlock);
        } else if (this.namingPlayers.contains(event.getPlayer())) {
            this.renameName(event.getPlayer(), event.getMessage(), petBlock.getMeta(), petBlock);
        }
    } else {
        this.plugin.getServer().getScheduler().runTaskAsynchronously(this.plugin, () -> {
            final com.github.shynixn.petblocks.api.persistence.entity.PetMeta petMeta = this.manager.getPetMetaController().getByPlayer(event.getPlayer());
            if (this.namingSkull.contains(event.getPlayer())) {
                this.plugin.getServer().getScheduler().runTask(this.plugin, () -> this.renameSkull(event.getPlayer(), event.getMessage(), petMeta, null));
            } else if (this.namingPlayers.contains(event.getPlayer())) {
                this.plugin.getServer().getScheduler().runTask(this.plugin, () -> this.renameName(event.getPlayer(), event.getMessage(), petMeta, null));
            }
        });
    }
}
项目:FlexMC    文件:ChatListener.java   
@SuppressWarnings( "deprecation" )
@Override
public void handle( ConnectionHandler connectionHandler, MessageC02ChatMessage message ) {
    FlexPlayer player = connectionHandler.getPlayer();
    if( player != null && message.getMessage().length() < 256 ) {
        if( message.getMessage().startsWith( "/" ) ) {
            String commandLine = message.getMessage().length() == 1 ? "" : message.getMessage().substring( 1 );
            if( !Flex.getServer().getCommandMap().dispatch( player, commandLine ) ) {
                player.sendMessage( "Unknown command. Type /help for help" );
            }
            return;
        }
        PlayerChatEvent oldEvent = EventFactory.call( new PlayerChatEvent( player, message.getMessage(), "<%1$s> %2$s", new HashSet<>( Flex.getServer().getPlayerManager().getOnlinePlayers() ) ) );
        AsyncPlayerChatEvent event = new AsyncPlayerChatEvent( true, player, oldEvent.getMessage(), oldEvent.getRecipients() );
        event.setFormat( oldEvent.getFormat() );
        EventFactory.call( event );
        if( !event.isCancelled() ) {
            for( Player target : event.getRecipients() ) {
                if( target.isOnline() ) {
                    target.sendMessage( String.format( event.getFormat(), player.getDisplayName(), message.getMessage() ) );
                }
            }
        }
    }
}
项目:Pugna    文件:PlayerListener.java   
@EventHandler(priority = EventPriority.NORMAL)
public void onChat(PlayerChatEvent event)
{
    Player player = event.getPlayer();
    PugnaPlayer play = pg.track.getPlayerData(player);

    if (play.getChatState() && play.getTeamState())
    {
        event.setCancelled(true);
        String teamName = play.getTeam();
        PugnaTeam team = pg.teams.getTeam(teamName); //
        team.sendMessage(player, " " + event.getMessage());
    }
    else if (player.getPlayerListName().equals(pg.emperor.getEmperorName()))
    {
        event.setFormat(ChatColor.DARK_PURPLE + pg.config.emperorTitle + " %s: %s");
    }
}
项目:xEssentials-deprecated-bukkit    文件:FloodSpamEvent.java   
@EventHandler(priority = EventPriority.LOWEST)
public void playerChatTime(PlayerChatEvent e) {
    if(chatTime.containsKey(e.getPlayer().getName())) {
        if(System.currentTimeMillis() - chatTime.get(e.getPlayer().getName()) < 300) {
            e.setCancelled(true);
            XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
            Date date = new Date(System.currentTimeMillis());
            date.setDate(date.getDate() + 1);
            xp.setTempbanned(date.getTime(), pl.getConfiguration().getBanConfig().getFloodSpamBanMessage(), "CONSOLE");
        } else {
            chatTime.put(e.getPlayer().getName(), System.currentTimeMillis());
        }
    } else {
        chatTime.put(e.getPlayer().getName(), System.currentTimeMillis());
    }
}
项目:xEssentials-deprecated-bukkit    文件:SilenceChatEvent.java   
@EventHandler(priority = EventPriority.LOW)
public void onChat(PlayerChatEvent e) {
    if(pl.getConfiguration().isChatSillenced()) {
        sendMessage(e.getPlayer(), ChatColor.GREEN + "all chat activity has been halted!, please wait a few minuts.");
        e.setCancelled(true);
    } else {
        XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
        if(xp.isSilenced()) {
            sendMessage(e.getPlayer(), ChatColor.GREEN + "you have silenced your chat, so you cannot chat unless you unmute your self with /silence");
            e.setCancelled(true);
            return;
        }

        //credits to feildmaster his silence source

        Iterator<Player> it = e.getRecipients().iterator();

        for(Player p = (it.hasNext() ? it.next() : null); it.hasNext(); p=it.next()) {
            XPlayer xp2 = pl.getManagers().getPlayerManager().getPlayer(p.getName());
            if(xp2.isSilenced()) {
                it.remove();
            }
        }
    }
}
项目:xEssentials-deprecated-bukkit    文件:CallPlayerChatSmilleyEvent.java   
@EventHandler
public void onChatSmilleyEvent(PlayerChatEvent e) {
    List<String> SmilleyList = new ArrayList<String>();
    String[] args = e.getMessage().split(" ");
    for(int i = 0; i < args.length; i++) {
        if(args[i].equalsIgnoreCase(":D")) {
            SmilleyList.add(args[i]);
        } else if(args[i].equalsIgnoreCase(":@")) {
            SmilleyList.add(args[i]);
        } else if(args[i].equalsIgnoreCase("<3")) {
            SmilleyList.add(args[i]);
        } else if(args[i].equalsIgnoreCase(":)")) {
            SmilleyList.add(args[i]);
        }
    }
    String[] SmilleyNames = SmilleyList.toArray(new String[SmilleyList.size()]);
    if(SmilleyNames.length > 0) {
        Bukkit.getPluginManager().callEvent(new PlayerChatSmilleyEvent(e, SmilleyNames, pl));
    }
}
项目:xEssentials_old_Source    文件:afkChat.java   
@EventHandler
public void afkCheckChat(PlayerChatEvent e) {
    for(Player p : Bukkit.getOnlinePlayers()) {
        if(e.getMessage().contains(p.getName())) {
            if(afkCheck.afkList.contains(p.getName())) {
                if(afkCheck.afkMessage.containsKey(p.getName())) {
                    e.getPlayer().sendMessage(ChatColor.GREEN + p.getName() + " has been afk [ " + afkCheck.afkMessage.get(p.getName()) + " ]");
                    //e.setCancelled(true); 
                } else {
                    e.getPlayer().sendMessage(ChatColor.GREEN + p.getName() + " has been afk");
                    //e.setCancelled(true);
                }
            }
        }
    }
}
项目:Chatter    文件:Chatter.java   
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerChatEvent(PlayerChatEvent event) {
  Player player = event.getPlayer();

  // replace message color codes
  if (player.hasPermission("chatter.colour")) {
    String message = event.getMessage();
    message = replaceColorCodes(message);
    event.setMessage(message);
  }

  // set the format
  String format = config.getString("chat.format");
  format = replacePlayerPlaceholders(player, format);
  format = replaceColorCodes(format);
  event.setFormat(format);
}
项目:PetBlocks    文件:PetDataListener.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void playerChatEvent3(final AsyncPlayerChatEvent event) {
    if (Config.getInstance().isChat_async() && Config.getInstance().isChatHighestPriority()) {
        if (this.namingPlayers.contains(event.getPlayer()) || this.namingSkull.contains(event.getPlayer()))
            event.setCancelled(true);
        this.plugin.getServer().getScheduler().runTaskLater(this.plugin, () -> PetDataListener.this.handleChatMessage(new PlayerChatEvent(event.getPlayer(), event.getMessage())), 1L);
    }
}
项目:PetBlocks    文件:PetDataListener.java   
@EventHandler(priority = EventPriority.LOW)
public void playerChatEvent4(final AsyncPlayerChatEvent event) {
    if (Config.getInstance().isChat_async() && !Config.getInstance().isChatHighestPriority()) {
        if (this.namingPlayers.contains(event.getPlayer()) || this.namingSkull.contains(event.getPlayer()))
            event.setCancelled(true);
        this.plugin.getServer().getScheduler().runTaskLater(this.plugin, () -> PetDataListener.this.handleChatMessage(new PlayerChatEvent(event.getPlayer(), event.getMessage())), 1L);
    }
}
项目:BlockBall    文件:SChatMenuManager.java   
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerAsyncChatEvent2(PlayerChatEvent event) {
    if (!Config.getInstance().isAsyncChat() && !Config.getInstance().isHighpriority()) {
        if (this.pages.containsKey(event.getPlayer())) {
            event.setCancelled(true);
            final String message = ChatColor.stripColor(event.getMessage());
            this.handleChatMessage(event.getPlayer(), message);
        }
    }
}
项目:BlockBall    文件:SChatMenuManager.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerAsyncChatEvent(PlayerChatEvent event) {
    if (!Config.getInstance().isAsyncChat() && Config.getInstance().isHighpriority()) {
        if (this.pages.containsKey(event.getPlayer())) {
            event.setCancelled(true);
            final String message = ChatColor.stripColor(event.getMessage());
            this.handleChatMessage(event.getPlayer(), message);
        }
    }
}
项目:Skript    文件:ExprMessage.java   
@Override
@Nullable
String get(final Event e) {
    if (PlayerChatEventHandler.usesAsyncEvent)
        return ((AsyncPlayerChatEvent) e).getMessage();
    else
        return ((PlayerChatEvent) e).getMessage();
}
项目:Skript    文件:ExprMessage.java   
@Override
void set(final Event e, final String message) {
    if (PlayerChatEventHandler.usesAsyncEvent)
        ((AsyncPlayerChatEvent) e).setMessage(message);
    else
        ((PlayerChatEvent) e).setMessage(message);
}
项目:Skript    文件:Commands.java   
@SuppressWarnings("null")
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerChat(final PlayerChatEvent e) {
    if (!SkriptConfig.enableEffectCommands.value() || !e.getMessage().startsWith(SkriptConfig.effectCommandToken.value()))
        return;
    if (handleEffectCommand(e.getPlayer(), e.getMessage()))
        e.setCancelled(true);
}
项目:CraftPlugins    文件:Blockode.java   
@EventHandler(priority = EventPriority.NORMAL,ignoreCancelled = true)
public void onPlayerChat(PlayerChatEvent event) {
    if(this.isQuoteBlocked(event.getMessage())){
        event.getPlayer().sendMessage(ChatColor.RED+"这话你可不能说啊。。。!");
        event.setCancelled(true);
    }
}
项目:CraftPlugins    文件:Banner.java   
@EventHandler(priority = EventPriority.NORMAL,ignoreCancelled = true)
public void onPlayerChat(PlayerChatEvent event) {
    if(this.isQuoteBlocked(event.getMessage()) && !event.getPlayer().isOp()){
        event.getPlayer().sendMessage(ChatColor.RED+"这话你可不能说啊。。。!");
        event.setCancelled(true);
    }
}
项目:CraftPlugins    文件:Blockode.java   
@EventHandler(priority = EventPriority.NORMAL,ignoreCancelled = true)
public void onPlayerChat(PlayerChatEvent event) {
    if(this.isQuoteBlocked(event.getMessage())){
        event.getPlayer().sendMessage(ChatColor.RED+"这话你可不能说啊。。。!");
        event.setCancelled(true);
    }
}
项目:JAATP    文件:Mentions.java   
@EventHandler
public void onChat(PlayerChatEvent e){

    if(!e.getMessage().contains("@")) return;

    ArrayList<String> words = new ArrayList<>(Arrays.asList(e.getMessage().split(" ")));
    ArrayList<String> mentions = new ArrayList<>();

    for(String word : words){
        if(word.contains("@")){

            mentions.add(word.split("@")[1]);
        }
    }

    for(String pname : mentions){
        String before = new String(pname);
        Player p = Bukkit.getPlayer(pname);
        if(p == null){
            e.getPlayer().sendMessage(MessageConfig.ERROR_PLAYER_MENTION_NOT_ONLINE);
            return;
        }
        pname = ChatColor.AQUA + pname;
        e.setMessage(e.getMessage().replaceAll("@" + before,ChatColor.AQUA + "@" + pname + ChatColor.RESET));
        p.playSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 1F, 1F);
    }



}
项目:RoyalIRC    文件:BChatListener.java   
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.MONITOR)
public void syncOnChat(PlayerChatEvent e) {
    if (!Config.useSyncChat) return;
    if (e.isCancelled() || e.getRecipients().isEmpty()) return;
    String message = Config.btiMessage;
    message = replaceVars(e, message);
    message = message.replace("{message}", e.getMessage());
    plugin.bh.sendMessage(message);
}
项目:xEssentials-deprecated-bukkit    文件:HumanSpamEvent.java   
@EventHandler(priority = EventPriority.LOWEST)
public void slowSpamCheck(PlayerChatEvent e) {
    final Player p = (Player) e.getPlayer();
    if(message2.containsKey(e.getPlayer().getName())) {
        if(message2.get(e.getPlayer().getName()).equalsIgnoreCase(e.getMessage())) {
            e.getPlayer().kickPlayer(pl.getConfiguration().getBanConfig().getHumanSpamBanMessage());
            message2.remove(e.getPlayer().getName());
        } else {
            message2.remove(e.getPlayer().getName());
        }
    } else if(message1.containsKey(e.getPlayer().getName())) {
        if(message1.get(e.getPlayer().getName()).equalsIgnoreCase(e.getMessage())) {
            message1.remove(e.getPlayer().getName());
            message2.put(e.getPlayer().getName(), e.getMessage());
            sendMessage(e.getPlayer(), ChatColor.RED + "Warning if you post one more time the same message you will be kicked!");
        } else {
            message1.put(e.getPlayer().getName(), e.getMessage());
        }
    } else {
        message1.put(e.getPlayer().getName(), e.getMessage());
    }
    Bukkit.getScheduler().scheduleSyncDelayedTask(pl, new Runnable() {

        @Override
        public void run() {
            if(message1.containsKey(p.getPlayer().getName())) {
                message1.remove(p.getPlayer().getName());
            } else if(message2.containsKey(p.getPlayer().getName())) {
                message2.remove(p.getPlayer().getName());
            }
        }
    }, 300);
}
项目:xEssentials-deprecated-bukkit    文件:PlayerIgnorePlayerChatEvent.java   
@EventHandler(priority = EventPriority.LOWEST)
public void onIgnoreChat(PlayerChatEvent e) {
    for(XPlayer xp : pl.getManagers().getPlayerManager().getPlayers()) {
        if(xp.hasIgnoredPlayers()) {
            if(xp.getIgnoredPlayers().contains(e.getPlayer().getName())) {
                e.getRecipients().remove(xp.getBukkitPlayer());
            }
        }
    }
}
项目:xEssentials-deprecated-bukkit    文件:ChatFormatEvent.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onChat(PlayerChatEvent e) {
    if(e.isCancelled()) {
        return;
    }

    String prefix = pl.getConfiguration().getChatConfig().getPrefixByPlayer(e.getPlayer());
    String suffix = pl.getConfiguration().getChatConfig().getSuffixByPlayer(e.getPlayer());
    Player p = e.getPlayer();
    e.setFormat(prefix +  p.getName() + ": " + suffix + e.getMessage());
}
项目:xEssentials-deprecated-bukkit    文件:MuteEvent.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onMute(PlayerChatEvent e) {
    if(pl.getManagers().getPlayerManager().isOnline(e.getPlayer().getName())) {
        XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
        if(xp.isMuted()) {
            if(System.currentTimeMillis() > xp.getMutedTime()) {
                sendMessage(e.getPlayer(), ChatColor.GREEN + "you are now allowed to talk again!");
                xp.unmute();
            } else {
                sendMessage(e.getPlayer(), ChatColor.GREEN + "you are muted! till: " + new Date(xp.getMutedTime()).toString());
                e.setCancelled(true);
            }
        }
    }
}
项目:xEssentials-deprecated-bukkit    文件:DrunkChatEvent.java   
@EventHandler(priority = EventPriority.HIGH)
public void onDrunk(PlayerChatEvent e) {
    if(e.isCancelled()) {
        return;
    }

    XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
    if(xp.isDrunk()) {
        String derp = xp.getDrunkMessageFrom(e.getMessage(), false);
        e.setMessage(derp);
    }
}
项目:xEssentials-deprecated-bukkit    文件:CallPlayerHighLightEvent.java   
@EventHandler
public void onChatHighLightEvent(PlayerChatEvent e) {
    List<String> playerList = new ArrayList<String>();
    String[] args = e.getMessage().split(" ");
    for(int i = 0; i < args.length; i++) {
        String name = args[i].replace("?", "").replace(",", "").replace(":", "").replace("=", "").replace("!", "").replace(".", "");
        if(pl.getManagers().getPlayerManager().isEssentialsPlayer(name)) {
            playerList.add(name);
        }
    }
    String[] PlayerNames = playerList.toArray(new String[playerList.size()]);
    if(PlayerNames.length > 0) {
        Bukkit.getPluginManager().callEvent(new PlayerChatHighLightEvent(e, PlayerNames, pl));
    }
}
项目:xEssentials-deprecated-bukkit    文件:AfkCheckEvent.java   
@EventHandler
public void chatAfk(PlayerChatEvent e) {
    for(XPlayer xp : pl.getManagers().getPlayerManager().getPlayers()) {
        if(e.getMessage().contains(xp.getBukkitPlayer().getName())) {
            if(xp.isAfk()) {
                sendMessage(e.getPlayer(), ChatColor.GREEN + xp.getBukkitPlayer().getName() + " has been afk [ " + xp.getAfkReason() + " ]");
            }
        }
    }
}
项目:xEssentials_old_Source    文件:muteManager.java   
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void getMutes(PlayerChatEvent e) {
    if(isMuted(e.getPlayer())) {
        Long time = (Long) xEssentialsMemory.returnPlayer(e.getPlayer()).get("muted");
        if(timeunits.isOverTime(time)) {
            xEssentialsMemory.returnPlayer(e.getPlayer()).put("muted", 0);
            xEssentialsMemory.updatePlayerConfig(e.getPlayer());    
        } else {
            e.setCancelled(true);
        }
    }
}
项目:xEssentials_old_Source    文件:AntiFloodSpam.java   
@EventHandler
public void playerChatTime(PlayerChatEvent e) {
    if(chatTime.containsKey(e.getPlayer().getName())) {
        if(System.currentTimeMillis() < chatTime.get(e.getPlayer().getName())) {
            cmdban.setBanned(xEssentialsMemory.antiFloodSpamMessage, e.getPlayer(), banType.floodspam);
        } else {
            chatTime.remove(e.getPlayer().getName());
        }
    } else {
        chatTime.put(e.getPlayer().getName(), System.currentTimeMillis());
    }
}
项目:PetBlocks    文件:PetDataListener.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void playerChatEvent(PlayerChatEvent event) {
    if (!Config.getInstance().isChat_async() && Config.getInstance().isChatHighestPriority()) {
        this.handleChatMessage(event);
    }
}
项目:PetBlocks    文件:PetDataListener.java   
@EventHandler(priority = EventPriority.LOWEST)
public void playerChatEvent2(PlayerChatEvent event) {
    if (!Config.getInstance().isChat_async() && !Config.getInstance().isChatHighestPriority()) {
        this.handleChatMessage(event);
    }
}
项目:SurvivalPlus    文件:LocalChat.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onChat(PlayerChatEvent event)
{
    if(event.isCancelled()) return;
    Player player = event.getPlayer();
    String msg = event.getMessage();

    if(Survival.settings.getBoolean("LegendaryItems.GoldArmorBuff"))
    {
        if(player.getInventory().getHelmet() != null)
        {
            if(player.getInventory().getHelmet().getType() == Material.GOLD_HELMET)
            {
                event.setCancelled(false);
                event.setFormat(ChatColor.GOLD + "<%1$s> " + ChatColor.YELLOW + "%2$s");
                return;
            }
        }
    }

    int channel = Survival.board.getObjective("Chat").getScore(player).getScore();
    if(channel > 0)
    {
        event.setFormat(ChatColor.GREEN + "<%1$s> " + ChatColor.RESET + "%2$s");
        return;
    }

    event.setCancelled(true);

    Bukkit.getConsoleSender().sendMessage("<" + player.getDisplayName() + "> " + msg);
    for(Player other : Bukkit.getServer().getOnlinePlayers())
       {
        if(other.getLocation().getWorld() == player.getLocation().getWorld())
        {
            if(other.getLocation().distance(player.getLocation()) <= maxDist)
            {
                other.sendMessage(ChatColor.RESET + "<" + player.getDisplayName() + "> " + msg);
            }
        }
       }
}
项目:ChatModerator    文件:ChatModeratorListener.java   
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerChat(final PlayerChatEvent event) {
    Zone chatZone = this.getZoneManager().getZone(ZoneType.CHAT);

    if (!(chatZone.isEnabled()) || event.getPlayer() == null) {
        return;
    }

    String message = Preconditions.checkNotNull(event, "Event").getMessage();
    Player player = event.getPlayer();

    FixedMessage fixedMessage = new FixedMessage(message, Instant.now());

    for (Filter filter : this.getFilterManager().getFiltersForZone(chatZone)) {
        if (fixedMessage.getFixed() == null || fixedMessage.getFixed().equals("")) {
            break;
        }

        filter.filter(fixedMessage, player, ZoneType.CHAT, event);
    }
    this.plugin.getPlayerManager().getViolationSet(player).setLastMessage(fixedMessage);

    event.setMessage(fixedMessage.getOriginal());

    for (Violation v : plugin.getPlayerManager().getViolationSet(player).getViolationsForTime(fixedMessage.getTimeSent())) {
        if (v.isCancelled()) {
            event.setMessage(null);
            event.setCancelled(true);
            break;
        }

        if (v.isFixed()) {
            event.setMessage(fixedMessage.getFixed());
        }
    }

    if (event.getMessage() == null) {
        event.setCancelled(true);
    }
}
项目:Skript    文件:PlayerChatEventHandler.java   
public final static void registerChatEvent(final EventPriority priority, final EventExecutor executor, final boolean ignoreCancelled) {
    if (Skript.classExists("org.bukkit.event.player.AsyncPlayerChatEvent"))
        Bukkit.getPluginManager().registerEvent(AsyncPlayerChatEvent.class, new Listener() {}, priority, executor, Skript.getInstance(), ignoreCancelled);
    else
        Bukkit.getPluginManager().registerEvent(PlayerChatEvent.class, new Listener() {}, priority, executor, Skript.getInstance(), ignoreCancelled);
}
项目:JAATP    文件:ChatFormat.java   
@EventHandler
public void onChat(PlayerChatEvent evt){

    String message = evt.getMessage();
    String player = evt.getPlayer().getDisplayName();
    String pex_prefix = "";

    //PEX
    if(HookManager.isEnabled(Bukkit.getPluginManager().getPlugin("PermissionsEx"))){

        pex_prefix = HookManager.getPexHook().getPrefix(evt.getPlayer());


    }



    if(!MainConfig.USE_CUSTOM_FORMAT) return;
    evt.setFormat(MainConfig.CUSTOM_CHAT_FORMAT.replaceAll("\\{MESSAGE}", message).replaceAll("\\{PLAYER}", player).replaceAll("\\{PEX_PREFIX}", pex_prefix));


}
项目:xEssentials-deprecated-bukkit    文件:AntiSwearEvent.java   
@EventHandler
public void onChat(PlayerChatEvent e) {
    if(e.isCancelled()) {
        return;
    }

    boolean warning = false;

    Pattern pat = Pattern.compile("[A-Za-z]");
    Pattern p = Pattern.compile(pl.getConfiguration().getChatConfig().getSwearWords(), Pattern.CASE_INSENSITIVE);

    StringBuilder build = new StringBuilder(e.getMessage());

    Matcher match = p.matcher(e.getMessage());

    while(match.find()) {
        if(pl.getConfiguration().getChatConfig().isSwearWarningEnabled()) {
            if(match.group().length() > 0) {
                if(!warning) { //if true it means we ignore it because a chat could have more swear words than just one we count 1 warning per message.
                    warning = true;
                    if(warnings.containsKey(e.getPlayer().getName())) {
                        int level = warnings.get(e.getPlayer().getName());
                        if((level+1) > pl.getConfiguration().getChatConfig().getMaxWarningLevel()) {
                            warnings.remove(e.getPlayer().getName());
                            if(pl.getConfiguration().getDebugConfig().isEnabled()) {
                                xEssentials.log("the console should now sent this command: " + pl.getConfiguration().getChatConfig().getWarningCommand().replaceAll("%p", e.getPlayer().getName()), LogType.DEBUG);
                            }
                            Bukkit.dispatchCommand(Bukkit.getConsoleSender(), pl.getConfiguration().getChatConfig().getWarningCommand().replaceAll("%p", e.getPlayer().getName()));
                            e.setCancelled(true);
                            return; //no need to go futher within the message.
                        } else {
                            warnings.put(e.getPlayer().getName(), (level+1));
                            sendMessage(e.getPlayer(), pl.getConfiguration().getChatConfig().getWarningMessage().replaceAll("%w", (level+1)+"/"+pl.getConfiguration().getChatConfig().getMaxWarningLevel()));
                        }
                    } else {
                        warnings.put(e.getPlayer().getName(), 1);
                        sendMessage(e.getPlayer(), pl.getConfiguration().getChatConfig().getWarningMessage().replaceAll("%w", "1" + "/"+pl.getConfiguration().getChatConfig().getMaxWarningLevel()));
                    }
                }
            }
        }

        build.replace(match.start(), match.end(), pat.matcher(match.group()).replaceAll("*"));
    }
    e.setMessage(build.toString());     
}
项目:xEssentials-deprecated-bukkit    文件:AntiAddvertiseEvent.java   
@EventHandler
public void onAntiAddvertise(PlayerChatEvent e) {
    XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
    e.setMessage(ipcheck(e.getMessage(), xp));
}
项目:xEssentials-deprecated-bukkit    文件:PlayerChatSmilleyEvent.java   
public PlayerChatSmilleyEvent(PlayerChatEvent e, String[] CalledSmilleys, xEssentials pl) {
    super(e.getPlayer());
    this.e = e;
    this.CalledSmilleys = CalledSmilleys;
    this.pl = pl;
}
项目:xEssentials-deprecated-bukkit    文件:PlayerChatHighLightEvent.java   
public PlayerChatHighLightEvent(PlayerChatEvent e, String[] CalledPlayerNames, xEssentials pl) {
    super(e.getPlayer());
    this.e = e;
    this.CalledPlayerNames = CalledPlayerNames;
    this.pl = pl;
}