mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-02-05 15:55:28 +01:00
Config Update
This commit is contained in:
parent
a5200fd5c1
commit
63151dc800
@ -19,17 +19,17 @@ import java.util.regex.Pattern;
|
|||||||
*/
|
*/
|
||||||
public class UpdateChecker implements Listener {
|
public class UpdateChecker implements Listener {
|
||||||
|
|
||||||
private PlaceholderAPIPlugin plugin;
|
private PlaceholderAPIPlugin plugin;
|
||||||
|
|
||||||
private final int resourceId = 6245;
|
private final int resourceId = 6245;
|
||||||
|
|
||||||
private static String latestVersion = "";
|
private static String latestVersion = "";
|
||||||
|
|
||||||
private static boolean updateAvailable = false;
|
private static boolean updateAvailable = false;
|
||||||
|
|
||||||
public UpdateChecker(PlaceholderAPIPlugin i) {
|
public UpdateChecker(PlaceholderAPIPlugin i) {
|
||||||
plugin = i;
|
plugin = i;
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||||
if (checkForUpdate()) {
|
if (checkForUpdate()) {
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||||
plugin.getLogger().info("An update for PlaceholderAPI (v" + getLatestVersion() + ") is available at:");
|
plugin.getLogger().info("An update for PlaceholderAPI (v" + getLatestVersion() + ") is available at:");
|
||||||
@ -39,17 +39,19 @@ public class UpdateChecker implements Listener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register() {
|
private void register() {
|
||||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onJoin(PlayerJoinEvent e) {
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
if (e.getPlayer().hasPermission("placeholderapi.updatenotify")) {
|
if (plugin.getConfig().getBoolean("warn_admin_update")) {
|
||||||
e.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', "&bAn update for &fPlaceholder&7API &e(&fPlaceholder&7API &fv" + getLatestVersion() + "&e)"));
|
if (e.getPlayer().hasPermission("placeholderapi.updatenotify")) {
|
||||||
e.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', "&bis available at &ehttps://www.spigotmc.org/resources/placeholderapi." + resourceId + "/"));
|
e.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', "&bAn update for &fPlaceholder&7API &e(&fPlaceholder&7API &fv" + getLatestVersion() + "&e)"));
|
||||||
}
|
e.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', "&bis available at &ehttps://www.spigotmc.org/resources/placeholderapi." + resourceId + "/"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSpigotVersion() {
|
private String getSpigotVersion() {
|
||||||
@ -96,10 +98,10 @@ public class UpdateChecker implements Listener {
|
|||||||
String[] split = Pattern.compile(".", Pattern.LITERAL).split(version.replace("v", ""));
|
String[] split = Pattern.compile(".", Pattern.LITERAL).split(version.replace("v", ""));
|
||||||
version = "";
|
version = "";
|
||||||
for (String s : split) {
|
for (String s : split) {
|
||||||
version += String.format("%4s", s);
|
version += String.format("%4s", s);
|
||||||
}
|
}
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,18 @@
|
|||||||
# Discord: https://discordapp.com/invite/7sndK3q
|
# Discord: https://discordapp.com/invite/7sndK3q
|
||||||
# No placeholders are provided with this plugin by default.
|
# No placeholders are provided with this plugin by default.
|
||||||
# Download placeholders: /papi ecloud
|
# Download placeholders: /papi ecloud
|
||||||
|
|
||||||
|
# Check if plugin is up to date
|
||||||
check_updates: true
|
check_updates: true
|
||||||
|
# Warn the admin if the plugin is out of date
|
||||||
|
warn_admin_update: true
|
||||||
|
# PlaceHolder cloud enabled
|
||||||
cloud_enabled: true
|
cloud_enabled: true
|
||||||
|
# Allow unverified Expansions
|
||||||
cloud_allow_unverified_expansions: false
|
cloud_allow_unverified_expansions: false
|
||||||
|
# Alternative meaning for true and false
|
||||||
boolean:
|
boolean:
|
||||||
'true': 'yes'
|
'true': 'yes'
|
||||||
'false': 'no'
|
'false': 'no'
|
||||||
|
# How you want to date formatted
|
||||||
date_format: MM/dd/yy HH:mm:ss
|
date_format: MM/dd/yy HH:mm:ss
|
||||||
|
Loading…
Reference in New Issue
Block a user