Skip to content

Commit

Permalink
Merge pull request #43 from C0D3-M4513R/patch-bukkit-banned-whitelist
Browse files Browse the repository at this point in the history
Add null checks to ip check on login
  • Loading branch information
funkemunky authored Oct 30, 2023
2 parents 26cfc3e + 50e7059 commit bc66644
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
Expand Down Expand Up @@ -116,13 +118,17 @@ public void run() {
event.getPlayer().getUniqueId().toString());
return;
}

//If the IP is whitelisted, we don't want to kick them
if(AntiVPN.getInstance().getExecutor().isWhitelisted(event.getPlayer().getAddress().getAddress()
.getHostAddress())) {
log("IP is whitelisted: %s",
event.getPlayer().getAddress().getAddress().getHostAddress());
return;
{
//If the IP is whitelisted, we don't want to kick them
InetSocketAddress address = event.getPlayer().getAddress();
if (address != null){
InetAddress address1 = address.getAddress();
if (address1 != null && AntiVPN.getInstance().getExecutor().isWhitelisted(address1.getHostAddress())) {
log("IP is whitelisted: %s",
address1.getHostAddress());
return;
}
}
}

// If the countryList() size is zero, no need to check.
Expand Down

0 comments on commit bc66644

Please sign in to comment.