当前位置: 首页>>代码示例>>Java>>正文


Java SpigetUpdate类代码示例

本文整理汇总了Java中org.inventivetalent.update.spiget.SpigetUpdate的典型用法代码示例。如果您正苦于以下问题:Java SpigetUpdate类的具体用法?Java SpigetUpdate怎么用?Java SpigetUpdate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SpigetUpdate类属于org.inventivetalent.update.spiget包,在下文中一共展示了SpigetUpdate类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkUpdate

import org.inventivetalent.update.spiget.SpigetUpdate; //导入依赖的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: UpdateUtils

import org.inventivetalent.update.spiget.SpigetUpdate; //导入依赖的package包/类
public UpdateUtils(Plugin plugin) {
	su = new SpigetUpdate(plugin, 20873);
	su.setVersionComparator(new VersionComparator() {

		@Override
		public boolean isNewer(String currentVersion, String checkVersion) {
			long currentVersionLong = convertVersionToLong(currentVersion);
			long checkVersionLong = convertVersionToLong(checkVersion);
			return checkVersionLong > currentVersionLong;
		}
	});
}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:13,代码来源:UpdateUtils.java

示例3: onEnable

import org.inventivetalent.update.spiget.SpigetUpdate; //导入依赖的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

示例4: onEnable

import org.inventivetalent.update.spiget.SpigetUpdate; //导入依赖的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

示例5: onEnable

import org.inventivetalent.update.spiget.SpigetUpdate; //导入依赖的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.SpigetUpdate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。