From 336f27f07857399057f3706cca4ac30e90319778 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Tue, 21 Apr 2020 12:22:42 +0100 Subject: [PATCH] Only check update if premium. Add bstats bars for premium vs not. --- .../java/com/plotsquared/bukkit/BukkitMain.java | 13 ++++++++++++- .../plotsquared/bukkit/listener/PlayerEvents.java | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index 42faf6beb..c03423119 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -190,7 +190,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain return; } - if (Settings.Enabled_Components.UPDATE_NOTIFICATIONS) { + if (PremiumVerification.isPremium() && Settings.Enabled_Components.UPDATE_NOTIFICATIONS) { new UpdateUtility(this).updateChecker(); } @@ -717,6 +717,17 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } return map; })); + metrics.addCustomChart(new Metrics.SimpleBarChart("premium", () -> { + final Map 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() { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java index d88ced453..e0c2ac89d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java @@ -98,6 +98,7 @@ import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotInventory; import com.plotsquared.core.plot.message.PlotMessage; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.util.PremiumVerification; import com.plotsquared.core.util.StringWrapper; import com.plotsquared.core.util.EntityUtil; import com.plotsquared.core.util.MainUtil; @@ -660,7 +661,7 @@ public class PlayerEvents extends PlotListener implements Listener { }, 20); if (pp.hasPermission(Captions.PERMISSION_ADMIN_UPDATE_NOTIFICATION.getTranslated()) - && Settings.Enabled_Components.UPDATE_NOTIFICATIONS) { + && Settings.Enabled_Components.UPDATE_NOTIFICATIONS && PremiumVerification.isPremium()) { try { HttpsURLConnection connection = (HttpsURLConnection) new URL( "https://api.spigotmc.org/simple/0.1/index.php?action=getResource&id=77506")