Adds a toggle-able admin alert when any admin joins the server
This commit is contained in:
		@@ -147,7 +147,12 @@ public enum ConfigOption {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Whether to enable debug output for debugging permissions
 | 
					     * Whether to enable debug output for debugging permissions
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    PERMISSION_DEBUG("debugging.permissionDebug", "Whether to enable permission debugging output", false);
 | 
					    PERMISSION_DEBUG("debugging.permissionDebug", "Whether to enable permission debugging output", false),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Whether to alert admins about new updates
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    ADMIN_UPDATE_ALERT("adminUpdateAlert", "Whether to alert admins about new plugin updates", true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final String configNode;
 | 
					    private final String configNode;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -319,6 +319,15 @@ public final class StargateConfig {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets whether admins should be alerted about new plugin updates
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return <p>Whether admins should be alerted about new updates</p>
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public boolean alertAdminsAboutUpdates() {
 | 
				
			||||||
 | 
					        return (boolean) configOptions.get(ConfigOption.ADMIN_UPDATE_ALERT);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Loads all config values
 | 
					     * Loads all config values
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,7 @@ import net.knarcraft.stargate.utility.BungeeHelper;
 | 
				
			|||||||
import net.knarcraft.stargate.utility.MaterialHelper;
 | 
					import net.knarcraft.stargate.utility.MaterialHelper;
 | 
				
			||||||
import net.knarcraft.stargate.utility.PermissionHelper;
 | 
					import net.knarcraft.stargate.utility.PermissionHelper;
 | 
				
			||||||
import net.knarcraft.stargate.utility.UUIDMigrationHelper;
 | 
					import net.knarcraft.stargate.utility.UUIDMigrationHelper;
 | 
				
			||||||
 | 
					import net.knarcraft.stargate.utility.UpdateChecker;
 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
import org.bukkit.GameMode;
 | 
					import org.bukkit.GameMode;
 | 
				
			||||||
import org.bukkit.block.Block;
 | 
					import org.bukkit.block.Block;
 | 
				
			||||||
@@ -48,14 +49,22 @@ public class PlayerEventListener implements Listener {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    @EventHandler
 | 
					    @EventHandler
 | 
				
			||||||
    public void onPlayerJoin(PlayerJoinEvent event) {
 | 
					    public void onPlayerJoin(PlayerJoinEvent event) {
 | 
				
			||||||
 | 
					        Player player = event.getPlayer();
 | 
				
			||||||
        //Migrate player name to UUID if necessary
 | 
					        //Migrate player name to UUID if necessary
 | 
				
			||||||
        UUIDMigrationHelper.migrateUUID(event.getPlayer());
 | 
					        UUIDMigrationHelper.migrateUUID(player);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Notify joining admins about the available update
 | 
				
			||||||
 | 
					        String availableUpdate = Stargate.getUpdateAvailable();
 | 
				
			||||||
 | 
					        if (availableUpdate != null && Stargate.getStargateConfig().alertAdminsAboutUpdates() &&
 | 
				
			||||||
 | 
					                player.hasPermission("stargate.admin")) {
 | 
				
			||||||
 | 
					            String updateMessage = UpdateChecker.getUpdateAvailableString(availableUpdate, Stargate.getPluginVersion());
 | 
				
			||||||
 | 
					            Stargate.getMessageSender().sendErrorMessage(player, updateMessage);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!Stargate.getGateConfig().enableBungee()) {
 | 
					        if (!Stargate.getGateConfig().enableBungee()) {
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Player player = event.getPlayer();
 | 
					 | 
				
			||||||
        //Check if the player is waiting to be teleported to a stargate
 | 
					        //Check if the player is waiting to be teleported to a stargate
 | 
				
			||||||
        String destination = BungeeHelper.removeFromQueue(player.getUniqueId());
 | 
					        String destination = BungeeHelper.removeFromQueue(player.getUniqueId());
 | 
				
			||||||
        if (destination == null) {
 | 
					        if (destination == null) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,7 @@
 | 
				
			|||||||
# mainSignColor - The color used for drawing signs (Default: BLACK).
 | 
					# mainSignColor - The color used for drawing signs (Default: BLACK).
 | 
				
			||||||
# highlightSignColor - The color used for sign markings (Default: WHITE)
 | 
					# highlightSignColor - The color used for sign markings (Default: WHITE)
 | 
				
			||||||
# verifyPortals - Whether all the non-sign blocks are checked to match the gate layout when a stargate is loaded.
 | 
					# verifyPortals - Whether all the non-sign blocks are checked to match the gate layout when a stargate is loaded.
 | 
				
			||||||
 | 
					# adminUpdateAlert - Whether to alert admins about new plugin updates
 | 
				
			||||||
# I------------I-------------I #
 | 
					# I------------I-------------I #
 | 
				
			||||||
# stargate economy options #
 | 
					# stargate economy options #
 | 
				
			||||||
# I------------I-------------I #
 | 
					# I------------I-------------I #
 | 
				
			||||||
@@ -36,6 +37,7 @@
 | 
				
			|||||||
# permissionDebug - This will output any and all Permissions checks to console, used for permissions debugging (Requires debug: true)
 | 
					# permissionDebug - This will output any and all Permissions checks to console, used for permissions debugging (Requires debug: true)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
language: en
 | 
					language: en
 | 
				
			||||||
 | 
					adminUpdateAlert: true
 | 
				
			||||||
folders:
 | 
					folders:
 | 
				
			||||||
  portalFolder: plugins/Stargate/portals/
 | 
					  portalFolder: plugins/Stargate/portals/
 | 
				
			||||||
  gateFolder: plugins/Stargate/gates/
 | 
					  gateFolder: plugins/Stargate/gates/
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user