Solved Ban list

Discussion in 'Plugin Development' started by Kermit_23, May 30, 2016.

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

    Kermit_23

    Code:. http://pastebin.com/8VJ28ZD0 (Couldn't paste it here, it just wraps it and spreads it)

    Problem:
    . I can't see a way how I could make it so that if a player that has an IP from there would try to join, it gets banned

    What you can do to recreate the problem:. Nothing

    Possible problematic line(s):
    . No problems in the line

    Error message (If any):
    . Nada

    What you have tried:
    . Nothing yet.
     
  2. Offline

    I Al Istannen

  3. Offline

    N00BHUN73R

    @Kermit_23
    What is the issue? Your code looks like it should work technically.. What does it not do or do that you don't want? Please elaborate
     
  4. Offline

    Zombie_Striker

    @Kermit_23 @N00BHUN73R
    It seems you are creating a plugin that banns player based on their IP. Bukkit already does this for you. Use the command /ban-ip to ban an IP from your server. If you want to access the banned ips, they are stored in the banned-ip.json file in the directory where the server jar is located.
     
  5. Offline

    Kermit_23

    no, I want to create an Anti BOT that it will download or read the blacklist. If a player ip is there, it would get ban but I can't see a way how to make it that it downloads and reat the text file, that is my problem.
    P.S. its hard to ban ip 200-300 ip's
     
  6. Offline

    I Al Istannen

    @Kermit_23
    So the reading from the webpage is your problem? Or the checking of the joined player's IP?
     
  7. Offline

    Kermit_23

    reading from it and banning the player that tries to join from that ip found in the list.
    @I Al Istannen
     
  8. Offline

    timtower Administrator Administrator Moderator

    @Kermit_23 Why not read it async every ... time and then banning the IP's? Banning needs to happen sync though.
     
  9. Offline

    Kermit_23

    @timtower The read thingy I don't know how to figure it out

    EDITED: FIGURED IT OUT :D it reads the content of the IP and it bans them and add them to banned-ips.json

    @timtower Now another problem, it allows the banned-ip players to join, Even if they are banned-ip ;(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  10. Offline

    I Al Istannen

    @Kermit_23
    How do you ban them? Just adding them to the banned-ips probably won't work. What code do you use?
     
  11. Offline

    Kermit_23

  12. Offline

    timtower Administrator Administrator Moderator

  13. Offline

    Kermit_23

    @timtower The problem is that I don't know regex to replace : and after : with nothing.
     
  14. Offline

    timtower Administrator Administrator Moderator

    @Kermit_23 You can also just not put them in the list.
     
  15. Offline

    Kermit_23

    @timtower it is hard to remove 2000 ports
     
  16. Offline

    timtower Administrator Administrator Moderator

  17. Offline

    Kermit_23

    @timtower how should I use it? I am grabbing the ips and ports from my blacklist.txt that its hosted, I don't know how to replace them before they reach the file.
     
  18. Offline

    I Al Istannen

    @Kermit_23
    "final String ip = s.nextLine();"
    There is your string. Remove the final and do the replacement like timtower said.
     
    timtower likes this.
  19. Offline

    Kermit_23

    @I Al Istannen @timtower I have figured it out 3 minutes ago, anyways thank you guys for your time! I will reply if something strange happens!

    @I Al Istannen @timtower Well, I have removed the ports, but the players can still join, I don't know why because all of their IP are in the banned-ips.json and I have compared the ips and they are there.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  20. Offline

    Kermit_23

    *BUMP*
    EDIT: FIXED WITH THE BANNING NOW ANOTHER ERROR BUT IM MAKING A NEW TOPIC BECAUSE THERE IS ANOTHER PROBLEM!
     
    Last edited: Jun 2, 2016
  21. Offline

    I Al Istannen

    @Kermit_23
    Well, if it really doesn't work, you can implement the banning yourself:
    Listen to the async event, so you don't need to run a async runnable. Then set the result to BANNED if they should be. Also download the List just ONCE and cache it, will increase the performance by a ton. Just check periodically for changes (like every 10 minutes or so).
     
Thread Status:
Not open for further replies.

Share This Page