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
|
||||
*/
|
||||
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;
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -13,6 +13,7 @@ import net.knarcraft.stargate.utility.BungeeHelper;
|
||||
import net.knarcraft.stargate.utility.MaterialHelper;
|
||||
import net.knarcraft.stargate.utility.PermissionHelper;
|
||||
import net.knarcraft.stargate.utility.UUIDMigrationHelper;
|
||||
import net.knarcraft.stargate.utility.UpdateChecker;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.block.Block;
|
||||
@ -48,14 +49,22 @@ public class PlayerEventListener implements Listener {
|
||||
*/
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
//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()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
//Check if the player is waiting to be teleported to a stargate
|
||||
String destination = BungeeHelper.removeFromQueue(player.getUniqueId());
|
||||
if (destination == null) {
|
||||
|
Reference in New Issue
Block a user