Hello people, the awesome plugin not really that recently has flooded the Plugins/Codes section is here! no one is hypped ikr
-FEATURES
-VIDEO(S)
PS: I would like to get feedback and also bug reports!!!
SOURCE CODE
for some reason images weren't displayed
SPIGOT: https://www.spigotmc.org/resources/chatessentials.26203/
-FEATURES
- Sentences filter: Cancel some messages.
- Word replacer: Replace curse words for other words.
- Broadcaster (With & Without using the config file)
- Custom welcome messages!
- /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/