Allow update checker to be disabled

(Only automatic update check on start; command is not affected)

Fixes #208
This commit is contained in:
Eric 2018-08-25 23:45:56 +02:00
parent 7032209ef7
commit cfeaf3cf8d
4 changed files with 16 additions and 4 deletions

View File

@ -333,6 +333,10 @@ public class ShopChest extends JavaPlugin {
}
private void checkForUpdates() {
if (!Config.enableUpdateChecker) {
return;
}
new BukkitRunnable() {
@Override
public void run() {

View File

@ -142,9 +142,10 @@ public class Config {
public static boolean confirmShopping;
/**
* Whether quality mode should be enabled
* <p>Whether the update checker should run on start and notify players on join.</p>
* The command is not affected by this setting and will continue to check for updates.
**/
public static boolean enableQualityMode;
public static boolean enableUpdateChecker;
/**
* Whether hologram interaction should be enabled
@ -479,7 +480,7 @@ public class Config {
hopperProtection = plugin.getConfig().getBoolean("hopper-protection");
explosionProtection = plugin.getConfig().getBoolean("explosion-protection");
confirmShopping = plugin.getConfig().getBoolean("confirm-shopping");
enableQualityMode = plugin.getConfig().getBoolean("enable-quality-mode");
enableUpdateChecker = plugin.getConfig().getBoolean("enable-update-checker");
enableHologramInteraction = plugin.getConfig().getBoolean("enable-hologram-interaction");
enableDebugLog = plugin.getConfig().getBoolean("enable-debug-log");
enableEconomyLog = plugin.getConfig().getBoolean("enable-economy-log");

View File

@ -7,6 +7,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import de.epiceric.shopchest.ShopChest;
import de.epiceric.shopchest.config.Config;
import de.epiceric.shopchest.config.Placeholder;
import de.epiceric.shopchest.language.LanguageUtils;
import de.epiceric.shopchest.language.Message;
@ -27,7 +28,7 @@ public class NotifyPlayerOnJoinListener implements Listener {
public void onPlayerJoin(PlayerJoinEvent e) {
final Player p = e.getPlayer();
if (plugin.isUpdateNeeded()) {
if (plugin.isUpdateNeeded() && Config.enableUpdateChecker) {
if (p.hasPermission(Permissions.UPDATE_NOTIFICATION)) {
Utils.sendUpdateMessage(plugin, p);
}

View File

@ -24,6 +24,12 @@ shop-info-item: "STICK"
# in order to prevent accidental purchases or sells.
confirm-shopping: false
# Set whether the plugin will check for updates on server start
# and notify permitted players on join.
# The command is not affected by this setting and will continue to
# check for updates.
enable-update-checker: true
# Set whether interaction with the hologram should be enabled.
# If set to true, a player can do the exact same thing with the
# hologram, as with the chest. You can even open the chest if you