Only check update if premium. Add bstats bars for premium vs not.

This commit is contained in:
dordsor21 2020-04-21 12:22:42 +01:00
parent 92ef0d723b
commit 336f27f078
2 changed files with 14 additions and 2 deletions

View File

@ -190,7 +190,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
return; return;
} }
if (Settings.Enabled_Components.UPDATE_NOTIFICATIONS) { if (PremiumVerification.isPremium() && Settings.Enabled_Components.UPDATE_NOTIFICATIONS) {
new UpdateUtility(this).updateChecker(); new UpdateUtility(this).updateChecker();
} }
@ -717,6 +717,17 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
} }
return map; return map;
})); }));
metrics.addCustomChart(new Metrics.SimpleBarChart("premium", () -> {
final Map<String, Integer> map = new HashMap<>();
if(PremiumVerification.isPremium()) {
map.put("Premium", 1);
map.put("Non-Premium", 0);
} else {
map.put("Premium", 0);
map.put("Non-Premium", 1);
}
return map;
}));
} }
@Override public ChunkManager initChunkManager() { @Override public ChunkManager initChunkManager() {

View File

@ -98,6 +98,7 @@ import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.plot.PlotInventory; import com.plotsquared.core.plot.PlotInventory;
import com.plotsquared.core.plot.message.PlotMessage; import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.PremiumVerification;
import com.plotsquared.core.util.StringWrapper; import com.plotsquared.core.util.StringWrapper;
import com.plotsquared.core.util.EntityUtil; import com.plotsquared.core.util.EntityUtil;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
@ -660,7 +661,7 @@ public class PlayerEvents extends PlotListener implements Listener {
}, 20); }, 20);
if (pp.hasPermission(Captions.PERMISSION_ADMIN_UPDATE_NOTIFICATION.getTranslated()) if (pp.hasPermission(Captions.PERMISSION_ADMIN_UPDATE_NOTIFICATION.getTranslated())
&& Settings.Enabled_Components.UPDATE_NOTIFICATIONS) { && Settings.Enabled_Components.UPDATE_NOTIFICATIONS && PremiumVerification.isPremium()) {
try { try {
HttpsURLConnection connection = (HttpsURLConnection) new URL( HttpsURLConnection connection = (HttpsURLConnection) new URL(
"https://api.spigotmc.org/simple/0.1/index.php?action=getResource&id=77506") "https://api.spigotmc.org/simple/0.1/index.php?action=getResource&id=77506")