本文整理汇总了Java中org.inventivetalent.update.spiget.UpdateCallback类的典型用法代码示例。如果您正苦于以下问题:Java UpdateCallback类的具体用法?Java UpdateCallback怎么用?Java UpdateCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UpdateCallback类属于org.inventivetalent.update.spiget包,在下文中一共展示了UpdateCallback类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkUpdate
import org.inventivetalent.update.spiget.UpdateCallback; //导入依赖的package包/类
private void checkUpdate(){
SpigetUpdate updater = new SpigetUpdate(this,18431);
updater.setVersionComparator(VersionComparator.SEM_VER);
updater.checkForUpdate(new UpdateCallback() {
@Override
public void updateAvailable(String newVersion, String downloadUrl, boolean hasDirectDownload) {
if(instance.getConfig().getBoolean("AutoUpdate")) {
if (hasDirectDownload) {
if (updater.downloadUpdate()) {
getLogger().info("New version of the plugin downloaded and will be loaded on restart");
} else {
getLogger().warning("Update download failed, reason is " + updater.getFailReason());
}
}
}else{
getLogger().info("There is an update available please go download it");
}
}
@Override
public void upToDate() {
getLogger().info("You are using the latest version thanks");
}
});
}
开发者ID:Qballl,项目名称:WildernessTp,代码行数:26,代码来源:Wild.java
示例2: updateTest
import org.inventivetalent.update.spiget.UpdateCallback; //导入依赖的package包/类
@Test
public void updateTest() {
SpigetUpdateAbstract updateCheck = new SpigetUpdateAbstract(5341/*NickNamer*/, "1.0.0", Logger.getLogger("UpdateTest")) {
@Override
protected void dispatch(Runnable runnable) {
runnable.run();
}
};
updateCheck.checkForUpdate(new UpdateCallback() {
@Override
public void updateAvailable(String newVersion, String downloadUrl, boolean canAutoDownload) {
System.out.println("newVersion = [" + newVersion + "], downloadUrl = [" + downloadUrl + "], canAutoDownload = [" + canAutoDownload + "]");
assertTrue(downloadUrl.startsWith("https://spigotmc.org/resources/nicknamer-integrated-api.5341/download"));
assertFalse(canAutoDownload);
}
@Override
public void upToDate() {
System.out.println("up-to-date");
assertTrue("Resource is up-to-date, but should have an update", false);
}
});
}
开发者ID:InventivetalentDev,项目名称:SpigetUpdater,代码行数:26,代码来源:UpdateTest.java
示例3: on
import org.inventivetalent.update.spiget.UpdateCallback; //导入依赖的package包/类
@EventHandler
public void on(final PlayerJoinEvent event) {
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
for (AnimatedFrame frame : plugin.frameManager.getFrames()) {
frame.addViewer(event.getPlayer());
}
}
}, 20);
if (event.getPlayer().hasPermission("animatedframes.updatecheck")) {
plugin.spigetUpdate.checkForUpdate(new UpdateCallback() {
@Override
public void updateAvailable(String s, String s1, boolean b) {
plugin.updateAvailable = true;
event.getPlayer().sendMessage("§aA new version for §6AnimatedFrames §ais available (§7v" + s + "§a). Download it from https://r.spiget.org/5583");
}
@Override
public void upToDate() {
}
});
}
}
开发者ID:InventivetalentDev,项目名称:AnimatedFrames,代码行数:26,代码来源:PlayerListener.java
示例4: checkForUpdates
import org.inventivetalent.update.spiget.UpdateCallback; //导入依赖的package包/类
public void checkForUpdates(final CommandSender cs) {
su.checkForUpdate(new UpdateCallback() {
@Override
public void updateAvailable(String newVersion, String downloadUrl, boolean hasDirectDownload) {
cs.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7&l&m---------------&7&l[ &6TransportPipes " + TransportPipes.instance.getDescription().getVersion() + "&7&l]&7&l&m---------------"));
cs.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6Update available: &e" + newVersion));
TextComponent click = new TextComponent("Click");
click.setColor(net.md_5.bungee.api.ChatColor.GOLD);
TextComponent here = new TextComponent(" here ");
here.setColor(net.md_5.bungee.api.ChatColor.YELLOW);
here.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tpipes update"));
here.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click to download the latest version").create()));
TextComponent toUpdate = new TextComponent("to update the plugin");
toUpdate.setColor(net.md_5.bungee.api.ChatColor.GOLD);
((Player) cs).spigot().sendMessage(new TextComponent(click, here, toUpdate));
cs.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7&l&m--------------------------------------------"));
}
@Override
public void upToDate() {
}
});
}
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:28,代码来源:UpdateUtils.java
示例5: onEnable
import org.inventivetalent.update.spiget.UpdateCallback; //导入依赖的package包/类
@Override
public void onEnable() {
if (!Bukkit.getPluginManager().isPluginEnabled("NickNamer")) {
getLogger().severe("Please download & install NickNamer: https://www.spigotmc.org/resources/5341/");
throw new RuntimeException("NickNamer not installed");
}
saveDefaultConfig();
if (!skinFolder.exists()) {
skinFolder.mkdirs();
}
PluginAnnotations.loadAll(this, this);
skinClient = new MineskinClient();
new Metrics(this);
SpigetUpdate spigetUpdate = new SpigetUpdate(this, 25417);
spigetUpdate.checkForUpdate(new UpdateCallback() {
@Override
public void updateAvailable(String s, String s1, boolean b) {
getLogger().info("There is a new version available (" + s + "). Download it here: https://r.spiget.org/25417");
}
@Override
public void upToDate() {
getLogger().info("The plugin is up-to-date");
}
});
}
开发者ID:InventivetalentDev,项目名称:CustomSkins,代码行数:32,代码来源:CustomSkins.java
示例6: onEnable
import org.inventivetalent.update.spiget.UpdateCallback; //导入依赖的package包/类
@Override
public void onEnable() {
saveDefaultConfig();
NPCLib.logger = getLogger();
APIManager.initAPI(NPCLib.class);
pluginNpcRegistry = NPCLib.createRegistry(this);
Bukkit.getPluginManager().registerEvents(this, this);
PluginAnnotations.COMMAND.load(this, new SpawnCommands(this));
new Metrics(this);
SpigetUpdate spigetUpdate = new SpigetUpdate(this, 5853).setUserAgent("NPCLib/" + getDescription().getVersion()).setVersionComparator(VersionComparator.SEM_VER);
spigetUpdate.checkForUpdate(new UpdateCallback() {
@Override
public void updateAvailable(String s, String s1, boolean b) {
getLogger().info("A new version is available (" + s + "). Download it from https://r.spiget.org/5853");
}
@Override
public void upToDate() {
getLogger().info("The plugin is up-to-date.");
}
});
}
开发者ID:InventivetalentDev,项目名称:CompactNPCLib,代码行数:28,代码来源:NPCLibPlugin.java
示例7: onEnable
import org.inventivetalent.update.spiget.UpdateCallback; //导入依赖的package包/类
@Override
public void onEnable() {
if (!Bukkit.getPluginManager().isPluginEnabled("MapManager")) {
getLogger().warning("**************************************************");
getLogger().warning(" ");
getLogger().warning(" This plugin depends on MapManager ");
getLogger().warning(" https://r.spiget.org/19198 ");
getLogger().warning(" ");
getLogger().warning("**************************************************");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
saveDefaultConfig();
PluginAnnotations.CONFIG.load(this, this);
PluginAnnotations.COMMAND.load(this, new Commands(this));
frameManager = new FrameManager(this);
frameExecutor = Executors.newCachedThreadPool();
Bukkit.getPluginManager().registerEvents(interactListener = new InteractListener(this), this);
Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
getLogger().fine("Waiting 2 seconds before loading data...");
Bukkit.getScheduler().runTaskLaterAsynchronously(this, new Runnable() {
@Override
public void run() {
getLogger().info("Loading data...");
frameExecutor.execute(new Runnable() {
@Override
public void run() {
frameManager.readFramesFromFile();
getLogger().info("Loaded " + frameManager.size() + " frames.");
}
});
}
}, 40);
new Metrics(this);
spigetUpdate = new SpigetUpdate(this, 5583).setUserAgent("AnimatedFrames/" + getDescription().getVersion()).setVersionComparator(VersionComparator.SEM_VER);
spigetUpdate.checkForUpdate(new UpdateCallback() {
@Override
public void updateAvailable(String s, String s1, boolean b) {
updateAvailable = true;
getLogger().info("A new version is available (" + s + "). Download it from https://r.spiget.org/5583");
// getLogger().info("(If the above version is lower than the installed version, you are probably up-to-date)");
}
@Override
public void upToDate() {
getLogger().info("The plugin is up-to-date.");
}
});
}
开发者ID:InventivetalentDev,项目名称:AnimatedFrames,代码行数:56,代码来源:AnimatedFramesPlugin.java
注:本文中的org.inventivetalent.update.spiget.UpdateCallback类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论