1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Chat Essentials v2.1

Discussion in 'Plugins/Codes' started by A Christmas Hangar, Jul 13, 2016.

  1. A Christmas Hangar

    A Christmas Hangar Member

    Joined:
    Sep 15, 2015
    Messages:
    2,542
    Likes Received:
    1,490
    Trophy Points:
    113
    Gender:
    Male
    Location:
    Kepler452B
    Home Page:
    Hello people, the awesome plugin not really that recently has flooded the Plugins/Codes section is here! no one is hypped ikr


    -FEATURES
    • Sentences filter: Cancel some messages.
    • Word replacer: Replace curse words for other words.
    • Broadcaster (With & Without using the config file)
    • Custom welcome messages!
    -COMMANDS
    • /bc + text, broadcast a message
    • /ChatEssentials displays an awesome thing!

    -VIDEO(S)



    PS: I would like to get feedback and also bug reports!!!



    SOURCE CODE


    Code:
    package chat.essentials;
    
    
    import java.util.List;
    import java.util.logging.Logger;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.EventPriority;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.AsyncPlayerChatEvent;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin implements Listener {
    
        public final Logger logger = Logger.getLogger("Minecraft");
    
        public static String chatcolor(String s){
            return ChatColor.translateAlternateColorCodes('&', s);
            }
        @EventHandler(priority=EventPriority.HIGHEST)
        public void handleJoin(PlayerJoinEvent event)
        {
            Player p = event.getPlayer();
            event.setJoinMessage(chatcolor(getConfig().getString("WelcomeMessage")));
      
        }
    
        List<String> blockedMessages = getConfig().getStringList("Blacklist");
    
        @EventHandler
        public void playerChatEvent(AsyncPlayerChatEvent event) {
    
        for (String blockedMessage : blockedMessages) {
        if(event.getMessage().contains(blockedMessage)) {
        event.setCancelled(true);
        event.getPlayer().sendMessage("" + ChatColor.RED + ChatColor.BOLD + "You're not allowed to say this. Bypassing the filter  may result in a mute." );
        return;
        }
        }
        }  
        public void onEnable()
        {
            getServer().getPluginManager().registerEvents(this, this);
            getConfig().options().copyDefaults(true);
            saveConfig();
        }
    
        public void onDisable()
        {
        }
    
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    
            Player player = (Player)sender;
           if (cmd.getName().equalsIgnoreCase("bc"))
                if (player.hasPermission("CE.Broadcast")) {
                int laengeArray = args.length;
                int indexArray = 0;
                String text = "";
                for (int i = 0; i < args.length; i++) {
                    text = text + args[i] + " ";
                }
                Bukkit.broadcastMessage(ChatColor.DARK_RED + "[Alert] " + ChatColor.RED + text);
            return true;
           }
    
        if (cmd.getName().equalsIgnoreCase("ChatEssentials")) {
            player.sendMessage(ChatColor.DARK_BLUE + "----------------------------------------");
            player.sendMessage(ChatColor.BLUE + "ChatEssentials v2 by Hangar555");
    
            player.sendMessage(ChatColor.GREEN + "Commands:");
            player.sendMessage(ChatColor.DARK_GREEN + "/ChatEssentials" + ChatColor.GOLD + ":" + ChatColor.GREEN + "Displays this message");
            player.sendMessage(ChatColor.DARK_GREEN + "/Broadcast" + ChatColor.GOLD + ":" + ChatColor.GREEN + "Broadcast the message written inconfig.yml!");
            player.sendMessage(ChatColor.GREEN + "Info:");
            player.sendMessage(ChatColor.DARK_GREEN + "This plugin is able to edit player messages, to prevent curse words");
            player.sendMessage(ChatColor.DARK_GREEN + "It can also intercept heavy messages");
            player.sendMessage(ChatColor.DARK_GREEN + "You are not allowed to edit and/or copy the plugin without the developer permission");
            player.sendMessage(ChatColor.DARK_BLUE + "----------------------------------------");
    
    
        return true;
    }
        return false;
    }
    }
    




    for some reason images weren't displayed




    SPIGOT: https://www.spigotmc.org/resources/chatessentials.26203/
     
  2. Anmazing

    Anmazing Helper Staff Member Helper

    Joined:
    Aug 7, 2014
    Messages:
    1,344
    Likes Received:
    1,153
    Trophy Points:
    113
    Gender:
    Male
    Screenshots are not working, probably because the website has CloudFlare protection.
     
  3. A Christmas Hangar

    A Christmas Hangar Member

    Joined:
    Sep 15, 2015
    Messages:
    2,542
    Likes Received:
    1,490
    Trophy Points:
    113
    Gender:
    Male
    Location:
    Kepler452B
    Home Page:
    Changed the pictures to texts :p
     
    Anmazing likes this.
  4. A Christmas Hangar

    A Christmas Hangar Member

    Joined:
    Sep 15, 2015
    Messages:
    2,542
    Likes Received:
    1,490
    Trophy Points:
    113
    Gender:
    Male
    Location:
    Kepler452B
    Home Page:
    ~Fixed a simple issue
    -This is the last version of CE. I'll work on a minigame (180 Seconds).