mirror of
https://github.com/TotalFreedomMC/TF-Captchafy.git
synced 2024-12-22 16:25:15 +00:00
Fixed a bug that incorrectly displayed the port.
This commit is contained in:
parent
359c883cd6
commit
f6239eb73d
3 changed files with 15 additions and 1 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/target/
|
|
@ -69,6 +69,7 @@ public class Capatchafy extends JavaPlugin
|
||||||
}
|
}
|
||||||
enabled = configs.config.getBoolean("always-on");
|
enabled = configs.config.getBoolean("always-on");
|
||||||
server = HttpdServer.startServer();
|
server = HttpdServer.startServer();
|
||||||
|
listeners.setURLMessage();
|
||||||
Bukkit.getLogger().info("[Capatchafy] Running in security level " + securityLevel + ".");
|
Bukkit.getLogger().info("[Capatchafy] Running in security level " + securityLevel + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,8 @@ public class Listeners implements Listener
|
||||||
public long removeAllPointsTime = 10L; //Remove all points after x seconds.
|
public long removeAllPointsTime = 10L; //Remove all points after x seconds.
|
||||||
public int maxAttacks = 3; //Set to 0 to disable this function.
|
public int maxAttacks = 3; //Set to 0 to disable this function.
|
||||||
|
|
||||||
|
public static String url;
|
||||||
|
|
||||||
//TODO If IP matches IP in TFM, dont force admins to verify.
|
//TODO If IP matches IP in TFM, dont force admins to verify.
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerLogin(PlayerPreLoginEvent event)
|
public void onPlayerLogin(PlayerPreLoginEvent event)
|
||||||
|
@ -50,7 +52,7 @@ public class Listeners implements Listener
|
||||||
if (!Capatchafy.configs.isAuthorized(ip))
|
if (!Capatchafy.configs.isAuthorized(ip))
|
||||||
{
|
{
|
||||||
event.disallow(PlayerPreLoginEvent.Result.KICK_OTHER, ChatColor.RED + "" + ChatColor.BOLD + "Yikes, we're under attack! Please solve the capatcha.\n" +
|
event.disallow(PlayerPreLoginEvent.Result.KICK_OTHER, ChatColor.RED + "" + ChatColor.BOLD + "Yikes, we're under attack! Please solve the capatcha.\n" +
|
||||||
ChatColor.WHITE + "Please go to " + ChatColor.GOLD + HttpdServer.BASE_URI.replaceAll(":80", "") + "capatcha/" + ChatColor.WHITE + " and solve the capatcha.\n" +
|
ChatColor.WHITE + "Please go to " + ChatColor.GOLD + url + ChatColor.WHITE + " and solve the capatcha.\n" +
|
||||||
"Once solved successfully, you will be able to join.");
|
"Once solved successfully, you will be able to join.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -95,4 +97,14 @@ public class Listeners implements Listener
|
||||||
}
|
}
|
||||||
lastLogin = currentTime;
|
lastLogin = currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setURLMessage()
|
||||||
|
{
|
||||||
|
if (Capatchafy.configs.getPort().equals("80"))
|
||||||
|
{
|
||||||
|
url = Capatchafy.configs.getHostname() + "/capatcha";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
url = Capatchafy.configs.getHostname() + ":" + Capatchafy.configs.getPort() + "/capatcha";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue