Adds a toggle-able admin alert when any admin joins the server
This commit is contained in:
parent
a61a03be33
commit
cfb4910977
@ -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) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
# mainSignColor - The color used for drawing signs (Default: BLACK).
|
||||
# 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.
|
||||
# adminUpdateAlert - Whether to alert admins about new plugin updates
|
||||
# I------------I-------------I #
|
||||
# stargate economy options #
|
||||
# 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)
|
||||
|
||||
language: en
|
||||
adminUpdateAlert: true
|
||||
folders:
|
||||
portalFolder: plugins/Stargate/portals/
|
||||
gateFolder: plugins/Stargate/gates/
|
||||
|
Loading…
x
Reference in New Issue
Block a user