本文整理汇总了Java中net.gravitydevelopment.updater.Updater类的典型用法代码示例。如果您正苦于以下问题:Java Updater类的具体用法?Java Updater怎么用?Java Updater使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Updater类属于net.gravitydevelopment.updater包,在下文中一共展示了Updater类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEnable
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
public void onEnable()
{
saveDefaultConfig();
reloadConfig();
//updateConfig();
c = new StorageManager(this);
c.syncPackages(true);
gui = new GUIManager(this);
cmd = new Credits(this);
ccmd = new CommandListener(this);
getCommand("credits").setExecutor(cmd);
log("credits enabled");
if (getConfig().getBoolean("enable-updater"))
{
@SuppressWarnings("unused")
Updater updater = new Updater(this, 61111, this.getFile(), Updater.UpdateType.DEFAULT, true);
log("updater running");
}
}
示例2: setupUpdater
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
private void setupUpdater() {
if (config.getConfig().autoUpdate.getValue()) {
final File file = this.getFile();
final Plugin plugin = this;
getServer().getScheduler().runTaskAsynchronously(this, new Runnable() {
@Override
public void run() {
verboseLog("Checking for a new update...");
Updater updater = new Updater(plugin, PROJECT_ID, file, Updater.UpdateType.DEFAULT, false);
update = updater.getResult() == Updater.UpdateResult.SUCCESS;
verboseLog("Update available: " + update);
if (update) {
updateDetails = updater.getLatestName() + " for " + updater.getLatestGameVersion();
}
}
});
}
}
示例3: getUpdateMessages
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
@Override
public List<String> getUpdateMessages() {
if (updater.getResult() == Updater.UpdateResult.UPDATE_AVAILABLE) {
//Updater knows local and remote versions are different, but not if it's an update
String remoteVersion = updater.getLatestName().replaceAll("[A-Za-z\\s]", "");
if (VersionChecker.shouldUpdate(currentVersion, remoteVersion)) {
return Arrays.asList(
ChatColor.BLUE + "An update for OldCombatMechanics to version " + remoteVersion + " is available!",
ChatColor.BLUE + "Click here to download it: " + ChatColor.GRAY + updater.getLatestFileLink()
);
}
}
return Collections.emptyList();
}
示例4: onEnable
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
@Override
public void onEnable() {
if (Settings.isAutoUpdateEnabled()) {
new Updater(this, 88505, getFile(), Updater.UpdateType.DEFAULT, true);
}
try {
MetricsLite metrics = new MetricsLite(this);
metrics.start();
} catch (IOException e) {
getLogger().info("Failed to submit statistics to MCStats!");
}
instance = this;
// Register the event listener
getServer().getPluginManager().registerEvents(new EnderBowListener(), this);
// Register the command
getCommand("enderbow").setExecutor(new EnderBowCommand());
// Create the recipe
ShapedRecipe enderBowRecipe = new ShapedRecipe(getEnderBow());
enderBowRecipe.shape("eee", "ebe", "eee");
enderBowRecipe.setIngredient('e', Material.ENDER_PEARL);
enderBowRecipe.setIngredient('b', Material.BOW);
// Add the recipe
getServer().addRecipe(enderBowRecipe);
}
示例5: update
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
/**
* TODO
*/
public void update() {
if (!Main.getInstance().getConfig().getBoolean("general.updater.checkForUpdates")) {
return;
}
if (Main.getInstance().getConfig().getBoolean("general.updater.auto-download")) {
new Updater(Main.getInstance(), 54358, Main.getInstance().getFile(), Updater.UpdateType.DEFAULT, true);
} else {
Updater updater = new Updater(Main.getInstance(), 54358, Main.getInstance().getFile(), Updater.UpdateType.NO_DOWNLOAD, false);
Main.getInstance().getLogger().log(Level.INFO, "An update is available: v" + updater.getLatestName().substring(17));
}
// TODO
}
示例6: getUpdateMessages
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
private String[] getUpdateMessages(){
String[] updateMessages = new String[2];
boolean useSpigot = false;
String updates = plugin.getConfig().getString("updates");
if(updates.equalsIgnoreCase("spigot")
|| (!updates.equalsIgnoreCase("bukkit") && Bukkit.getVersion().toLowerCase().contains("spigot")
)) useSpigot = true;
if(useSpigot){
Mes.debug("Using Spigot update checker");
//Get messages from Spigot update checker
if(SUC.getResult().name().equalsIgnoreCase("UPDATE_AVAILABLE")){
//An update is available
updateMessages[0] = Mes.getStringNoPrefix("main.updateAvailable").replaceAll("%version%", SUC.getVersion());
updateMessages[1] = Mes.getStringNoPrefix("main.updateAvailableLink").replaceAll("%link%", "https://www.spigotmc.org/resources/hotels.2047/updates/");
}
}
else{//Get messages from bukkit update checker
Mes.debug("Using Bukkit update checker");
Updater updater = new Updater(plugin, 70177, pluginFile, Updater.UpdateType.NO_DOWNLOAD, false);
if(updater.getResult().equals(UpdateResult.UPDATE_AVAILABLE)){
//Updater knows local and remote versions are different, but not if it's an update
String remoteVersion = updater.getLatestName().replaceAll("[A-Za-z\\s]", "");
if(shouldUpdate(plugin.getDescription().getVersion(), remoteVersion)){
updateMessages[0] = Mes.getStringNoPrefix("main.updateAvailable").replaceAll("%version%", remoteVersion);
updateMessages[1] = Mes.getStringNoPrefix("main.updateAvailableLink").replaceAll("%link%", updater.getLatestFileLink());
}
}
}
return updateMessages;
}
示例7: onCommand
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
@Override
public void onCommand(CommandSender sender, Command cmd, String alias,
String[] args) {
if (!sender.hasPermission("bashmulticommand.update")) {
sender.sendMessage(BashMultiCommand.plugin.strings
.get("noPermission"));
return;
}
if (args.length < 1 || args[0].equalsIgnoreCase(this.commandName)) {
BashMultiCommand.plugin.loadUpdator(Updater.UpdateType.DEFAULT);
if (BashMultiCommand.plugin.updater.getResult() == Updater.UpdateResult.SUCCESS)
sender.sendMessage(BashMultiCommand.plugin.strings
.get("downloadSuccess"));
else
sender.sendMessage(BashMultiCommand.plugin.strings
.get("downloadFailed"));
return;
}
if (args[0].equalsIgnoreCase(BashMultiCommand.plugin.strings
.get("check")[0])) {
BashMultiCommand.plugin.loadUpdator(Updater.UpdateType.NO_DOWNLOAD);
if (BashMultiCommand.plugin.updater.getResult() == Updater.UpdateResult.UPDATE_AVAILABLE)
sender.sendMessage(BashMultiCommand.plugin.strings
.get("newUpdate"));
else
sender.sendMessage(BashMultiCommand.plugin.strings
.get("noNewUpdate"));
} else
sender.sendMessage(Strings.replaceAll(
BashMultiCommand.plugin.strings.get("incorrectArguments"),
"%command%", this.commandName));
}
示例8: run
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
@Override
public void run() {
updater = new GravityUpdater(plugin, 72299, pluginFile, Updater.UpdateType.NO_DOWNLOAD, true);
isUpdateAvailable = updater.getResult() == Updater.UpdateResult.UPDATE_AVAILABLE;
if(isUpdateAvailable) {
new UpdateNotifier(sender, download).runTask(plugin);
}
}
示例9: onPlayerJoin
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
if (plugin.hasPermission(event.getPlayer(), "commandit.update", false)) {
Updater u = plugin.getUpdater();
if (u != null && u.getResult() == Updater.UpdateResult.UPDATE_AVAILABLE) {
Message.sendMessage(event.getPlayer(), "update.notify", u.getLatestName());
}
}
}
示例10: BukkitUpdateSource
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
public BukkitUpdateSource(OCMMain plugin, File pluginFile) {
this.updater = new Updater(plugin, 98233, pluginFile, Updater.UpdateType.NO_DOWNLOAD, false);
this.currentVersion = plugin.getDescription().getVersion();
}
示例11: onEnable
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
@Override
public void onEnable() {
plugin = this;
// Load configs and locale
try {
// Must load configs in this order!
Config.loadConfig();
strings = new Strings();
UUIDManager.loadCache();
HashMap<UUID, Boolean> playerEnables = SLAPI
.loadFile(enabledDataPath);
if (playerEnables != null)
PlayerManager.playerEnables = playerEnables;
} catch (Exception e) {
getLogger()
.severe(ChatColor.DARK_RED
+ "Error loading config and/or localization! BashMultiCommand will now disable!");
e.printStackTrace();
getServer().getPluginManager().disablePlugin(this);
return;
}
// Setup the listeners
chatListener = new ChatListener();
if (loginListener == null)
loginListener = new LoginListener();
// Load updater
if (Config.autoUpdateEnabled)
if (Config.autoDownload)
loadUpdator(Updater.UpdateType.DEFAULT);
else
loadUpdator(Updater.UpdateType.NO_DOWNLOAD);
// Load commands
commandExecutor = new BMCCommandExecutor();
commandExecutor.loadCommands();
getCommand("BashMultiCommand").setExecutor(commandExecutor);
enabled = true;
}
示例12: loadUpdator
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
public void loadUpdator(UpdateType updateType) {
if (Config.autoUpdateEnabled)
this.updater = new Updater(BashMultiCommand.plugin, 80942,
BashMultiCommand.plugin.getFile(), updateType, false);
}
示例13: downloadUpdate
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
public void downloadUpdate() {
updater = new GravityUpdater(plugin, 72299, pluginFile, Updater.UpdateType.NO_VERSION_CHECK, true);
isUpdated = true;
}
示例14: getUpdater
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
/**
* @return Handler for the updater system
*/
public Updater getUpdater() {
return updater;
}
示例15: onEnable
import net.gravitydevelopment.updater.Updater; //导入依赖的package包/类
@Override
public void onEnable() {
saveDefaultConfig();
Bukkit.getServer().getPluginManager().registerEvents(this, this);
try {
Metrics metrics = new Metrics(this);
Graph weaponsUsedGraph = metrics.createGraph("TEST");
weaponsUsedGraph.addPlotter(new Metrics.Plotter("1") {
@Override
public int getValue() {
return 4; // Number of players who used a diamond sword
}
});
weaponsUsedGraph.addPlotter(new Metrics.Plotter("2") {
@Override
public int getValue() {
return 17;
}
});
metrics.start();
} catch (IOException e) {
this.getLogger().warning("Couldn't submit stats to Metrics!");
}
@SuppressWarnings("unused")
Updater updater = new Updater(this, 66804, getFile(), UpdateType.DEFAULT, true);
}