[NEED HELP] AntiSignAdvertise plugin, some adding!

Discussion in 'Plugin Development' started by Peter25715, Aug 25, 2014.

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


    Hello, My name is Peter and I need help with my new plugin which is AntiSignAdvertise.
    It's working fine. Let me explain what it does and how it works fine..
    Please take a look at this code.. (Part from it) :
    1. else if (e.getLine(0).contains(" . com")) {
    2. e.setLine(0, ChatColor.DARK_RED + p.getName());
    3. e.setLine(1, "§4Advertises!");
    4. p.sendMessage("§cSign Advertising Is Not Allowed On This Server!, " + p.getName());
    5. e.setLine(2, "");
    6. e.setLine(3, "");

    This code right here works fine. But the problem is, Whenever someone types :
    .com / .COM / dot / DOT / com / net / .net / www / www. ...
    The sign text will be replaced to Your IGN and Advertises..
    My problem is, The player can make the .com or whatever else.. in the second, third and fourth and it will not block it. Please help me fix this problem..

    The second problem is, Whenever someone types .CoM it will not block it and it will appear normally.. Please give me a code to switch everything to small letters (Not in caps)..

    Thanks for reading. Please don't forget to help me!
    Do you know the solution for the second problem and don't know the first? Just tell me this is the solution of the second or the first! thanks! :D
  2. Offline


    • You're checking line 0, that's why they can do it in the other lines. Check lines 1, 2, and 3 also.
    • To switch everything to lowercase letters, use e.getLine(#).toLowerCase() and then set the line to that text.
  3. Offline


    SmooshCakez, Thanks a lot for helping, But can you please tell me how to check the lines 0, 1, 2 and 3 all at once? Cause I tried it and didn't work..
  4. Offline


    1. if (e.getLine(0).contains(".com or whatever") || e.getLine(1).contains(".com") || e.getLine(2).contains(".com")) // So on..
  5. Offline


    Oh! Thanks a lot! SmooshCakez,
    But sorry to see that the e.getLine(#).toLowerCase() didn't work :(
  6. Offline


    for (int i 0>= 3i++) {
    It won't work anyway. I can do "[dot] com", ",com", "c om" etc.
  7. Offline


    Konkz, It does not matter, Some noob members cannot find out how not to block it. But it does effect a lot if you have a lot of members on the server.
    Anyways.. I already added a lot of tricks that can a noob do :)
Thread Status:
Not open for further replies.

Share This Page