AntiSwear Plugin Help

Discussion in 'Plugin Development' started by Heirteir, Jan 28, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Heirteir

    If anyone could please help me i have a lot of questions and i can't describe it to well so if someone could please add me on skype : ugmtgaming Please help me i really need help with plugin creation because it seems really awesome and fun to do so please add me and help me with this i need it.
     
  2. Offline

    WizKhalifa

    Hundreds of antiSwear plugins out there. Recommend searching the Get Plugins section.
    If it's an original idea, you should post a thread describing it in detail in the Plugin Requests section.
    Good luck!
     
  3. Offline

    Heirteir

    I am doing this for a core plugin im trying to create. I'm also trying to learn how to code my own plugins. I am making it my own way that is actually quite easy and useful and i would enjoy is I could get some help.
     
  4. Offline

    Cryices

    Asyncplayerchatevent, check if it contains whatever your checking for.
     
  5. Offline

    Heirteir

    it does this is my code so far I want it to block the message like "you ****ing suck" but so far i can't even get it to block the word... here is my code please rocommend a fix for me
    Code:java
    1. package me.heirteir.configs;
    2.  
    3. import java.util.List;
    4.  
    5. import org.bukkit.ChatColor;
    6. import org.bukkit.command.Command;
    7. import org.bukkit.command.CommandSender;
    8. import org.bukkit.configuration.file.FileConfiguration;
    9. import org.bukkit.entity.Player;
    10. import org.bukkit.event.EventHandler;
    11. import org.bukkit.event.Listener;
    12. import org.bukkit.event.player.AsyncPlayerChatEvent;
    13. import org.bukkit.plugin.java.JavaPlugin;
    14.  
    15. public class Main
    16. extends JavaPlugin
    17. implements Listener
    18. {
    19. @EventHandler
    20. public void onPlayerChat (AsyncPlayerChatEvent e)
    21. {
    22. for (String word : e.getMessage().split(" "))
    23. {
    24.  
    25. if(getConfig().getStringList("bannedwords.").contains(word))
    26. {
    27. if (e.getPlayer().hasPermission("AntiSwear.Swear"))
    28. {
    29. e.setCancelled(true);
    30. }
    31. else
    32. {
    33. e.setCancelled(true);
    34. e.getPlayer().sendMessage(ChatColor.RED + "Please Don't Use That Sort Of Language!");
    35. }
    36. }
    37. }
    38. }
    39. public void onEnable()
    40. {
    41. setupConfig(getConfig());
    42. saveConfig();
    43. }
    44. public void setupConfig (FileConfiguration e)
    45. {
    46. e.set("wordamount", "1");
    47. e.set("bannedwords", "fuck");
    48. }
    49. @Override
    50. public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
    51. Player player = (Player) sender;
    52. if (sender instanceof Player)
    53. {
    54. if (commandLabel.equalsIgnoreCase("curseadd"))
    55. {
    56. if (args.length == 0)
    57. {
    58. player.sendMessage(ChatColor.RED + "Usage: /curseadd <bannedword>");
    59. }
    60. if (args.length == 1)
    61. {
    62. int x = getConfig().getInt("wordamount");
    63. x++;
    64. getConfig().set("wordamount", x);
    65. getConfig().set("bannedwords."+x, args[0]);
    66. saveConfig();
    67. }
    68. if (args.length >= 2)
    69. {
    70. player.sendMessage(ChatColor.RED + "Usage: /curseadd <bannedword>");
    71. }
    72. }
    73. }
    74.  
    75. return false;
    76. }
    77.  
    78.  
    79. }
    80.  


    So far everything works except for the part where i block the words someone please help me out
     
Thread Status:
Not open for further replies.

Share This Page