Add timeout to Verygames call
This commit is contained in:
parent
a5956555a5
commit
5d21d1bb87
@ -857,6 +857,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
* @param player The player to process.
|
* @param player The player to process.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void getVerygamesIp(final Player player)
|
public void getVerygamesIp(final Player player)
|
||||||
{
|
{
|
||||||
final String name = player.getName().toLowerCase();
|
final String name = player.getName().toLowerCase();
|
||||||
@ -872,6 +873,8 @@ public class AuthMe extends JavaPlugin {
|
|||||||
try {
|
try {
|
||||||
URL url = new URL(sUrl);
|
URL url = new URL(sUrl);
|
||||||
URLConnection urlCon = url.openConnection();
|
URLConnection urlCon = url.openConnection();
|
||||||
|
urlCon.setConnectTimeout(5000);
|
||||||
|
urlCon.setReadTimeout(5000);
|
||||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(urlCon.getInputStream()))) {
|
try (BufferedReader in = new BufferedReader(new InputStreamReader(urlCon.getInputStream()))) {
|
||||||
String inputLine = in.readLine();
|
String inputLine = in.readLine();
|
||||||
if (!StringUtils.isEmpty(inputLine) && !inputLine.equalsIgnoreCase("error")
|
if (!StringUtils.isEmpty(inputLine) && !inputLine.equalsIgnoreCase("error")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user