Skip to content

Commit

Permalink
Merge pull request #11 from TheDiscordian/SignificantlyLessHTTPCalls
Browse files Browse the repository at this point in the history
Only do HTTP calls if player has perms, only do one
  • Loading branch information
kadotcom authored Mar 14, 2024
2 parents 31c94da + 934cbb0 commit 9984747
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ public void onPlayerJoin(PlayerJoinEvent event) {
HealthManager.setMaxHealth(plugin.getConfig().getInt("HP.startHP"), event.getPlayer());
}

if(!HTTP.get("https://api.spigotmc.org/legacy/update.php?resource=99220").equalsIgnoreCase(plugin.getDescription().getVersion()) && !plugin.getDescription().getVersion().contains("Tested")){
if(event.getPlayer().isOp() || event.getPlayer().hasPermission(plugin.getConfig().getString("permissions.messages.outdatedPermissionMessage"))){
event.getPlayer().sendMessage("§f[§cLifeStolen§f] There is a new version of LifeStolen.\nYou are on "+ plugin.getDescription().getVersion() +" while the newest version is " + HTTP.get("https://api.spigotmc.org/legacy/update.php?resource=99220") + ".\nYou can get the newest version here. https://www.spigotmc.org/resources/lifestolen.99220/");
if(event.getPlayer().isOp() || event.getPlayer().hasPermission(plugin.getConfig().getString("permissions.messages.outdatedPermissionMessage"))){
String version = HTTP.get("https://api.spigotmc.org/legacy/update.php?resource=99220");
if(!version.equalsIgnoreCase(plugin.getDescription().getVersion()) && !plugin.getDescription().getVersion().contains("Tested")){
event.getPlayer().sendMessage("§f[§cLifeStolen§f] There is a new version of LifeStolen.\nYou are on "+ plugin.getDescription().getVersion() +" while the newest version is " + version + ".\nYou can get the newest version here. https://www.spigotmc.org/resources/lifestolen.99220/");
}
}

Expand Down

0 comments on commit 9984747

Please sign in to comment.