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.
@Kermit_23 I don't really know what you want. You can check the Ip of the joining player in the AsyncPlayerPreLoginEvent or the PlayerLoginEvent (and probably some more).
@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
@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.
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
@Kermit_23 So the reading from the webpage is your problem? Or the checking of the joined player's IP?
reading from it and banning the player that tries to join from that ip found in the list. @I Al Istannen
@Kermit_23 Why not read it async every ... time and then banning the IP's? Banning needs to happen sync though.
@timtower The read thingy I don't know how to figure it out EDITED: FIGURED IT OUT 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.
@Kermit_23 How do you ban them? Just adding them to the banned-ips probably won't work. What code do you use?
@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.
@Kermit_23 "final String ip = s.nextLine();" There is your string. Remove the final and do the replacement like timtower said.
@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.
*BUMP* EDIT: FIXED WITH THE BANNING NOW ANOTHER ERROR BUT IM MAKING A NEW TOPIC BECAUSE THERE IS ANOTHER PROBLEM!
@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).