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


Java PluginDescriptionFile.getVersion方法代码示例

本文整理汇总了Java中org.bukkit.plugin.PluginDescriptionFile.getVersion方法的典型用法代码示例。如果您正苦于以下问题:Java PluginDescriptionFile.getVersion方法的具体用法?Java PluginDescriptionFile.getVersion怎么用?Java PluginDescriptionFile.getVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.plugin.PluginDescriptionFile的用法示例。


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

示例1: InfoCommand

import org.bukkit.plugin.PluginDescriptionFile; //导入方法依赖的package包/类
public InfoCommand(PluginDescriptionFile pdf) {
    this.infoMsg = new String[] {
            ChatColor.AQUA + "NBTProxy Info:",
            ChatColor.AQUA + "  Description: " + ChatColor.YELLOW + pdf.getDescription(),
            ChatColor.AQUA + "  Version: " + ChatColor.YELLOW + pdf.getVersion(),
            ChatColor.AQUA + "  Authors: " + ChatColor.YELLOW + pdf.getAuthors(),
            ChatColor.AQUA + "  Website: " + ChatColor.YELLOW + pdf.getWebsite()
    };
    HoverEvent clickToCopyToolTip = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(ChatColor.AQUA + "Click to paste the version into your chatbox."));
    ComponentBuilder msg = new ComponentBuilder("\nNBTProxy Info:\n").color(ChatColor.AQUA);
    appendInfoString(msg, clickToCopyToolTip, "Description", pdf.getDescription());
    appendInfoString(msg, clickToCopyToolTip, "Version", pdf.getVersion());
    appendInfoString(msg, clickToCopyToolTip, "Authors", pdf.getAuthors().toString());
    appendInfoString(msg, clickToCopyToolTip, "Website", pdf.getWebsite());
    this.infoMsgPretty = msg.create();
}
 
开发者ID:MrBlobman,项目名称:NBTProxy,代码行数:17,代码来源:InfoCommand.java

示例2: onLoad

import org.bukkit.plugin.PluginDescriptionFile; //导入方法依赖的package包/类
/**
 * Constructor. Do some setup stuff.
 */
@Override
public void onLoad() 
{	
	// Grab a name and version from the plugin's description file.
	PluginDescriptionFile pdfFile = this.getDescription();
	pluginName = pdfFile.getName();
	pluginVersion = pdfFile.getVersion();
	permissions = new PermissionsHandler();
	if (useConfig)
		if (!loadConfig())
		{
			this.logSevere("Could not load configuration for " + getPluginName() + "! This may break the plugin!");
		}
		else
		{
			if (getConfig().contains("debug"))
			{
				debugMode = getConfig().getBoolean("debug");
			}
		}
}
 
开发者ID:cppchriscpp,项目名称:TravelPortals,代码行数:25,代码来源:PluginBase.java

示例3: onEnable

import org.bukkit.plugin.PluginDescriptionFile; //导入方法依赖的package包/类
public void onEnable()
{
	for(String command : plugin.getDescription().getCommands().keySet())
	{
		final PluginCommand cmd = plugin.getCommand(command);
		if(cmd != null)
			cmd.setExecutor(this);
	}
	// Краткое описание плагина в двух строчках: оно нам пригодится ниже
	final PluginDescriptionFile description = plugin.getDescription();
	helpHeader[0] = "{_LP}" + description.getName()
		+ " {_LS}"   + description.getVersion()
		+ " {_LP}© " + description.getAuthors().get(0);
	helpHeader[1] = "{_LP}Website: {GOLD}" + description.getWebsite();
}
 
开发者ID:RuBukkit,项目名称:RuBukkit-Template,代码行数:16,代码来源:BukkitCommands.java

示例4: onEnable

import org.bukkit.plugin.PluginDescriptionFile; //导入方法依赖的package包/类
public void onEnable() {
	instance = this;

	PluginManager pm = getServer().getPluginManager();
	pm.registerEvents(playerListener, this);
	pm.registerEvents(entityListener, this);
	pm.registerEvents(blockListener, this);
	pm.registerEvents(inventoryListener, this);
	

	
	PluginDescriptionFile pdfFile = this.getDescription();
	version = pdfFile.getVersion();

	BlocksInfo.loadBlocksInfo();
	loadProperties();
	PermissionInterface.setupPermissions(this);
	
	PluginManager manager = getServer().getPluginManager();
	 
       manager.registerEvents(new TeleportFix(this, this.getServer()), this);
	
	structureUpdateScheduler();

	System.out.println(pdfFile.getName() + " " + version + " plugin enabled");
}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:27,代码来源:NavyCraft.java

示例5: onEnable

import org.bukkit.plugin.PluginDescriptionFile; //导入方法依赖的package包/类
public void onEnable() {
	File configFile = new File(this.getDataFolder(), "config.yml");

       if (!configFile.exists()) {
           saveDefaultConfig();
       }

       Path dataFolder = getDataFolder().toPath();
       Configuration checkConfig = YamlConfiguration.loadConfiguration(configFile);
       checkConfigVersions(checkConfig, dataFolder);

       File i18nFolder = new File(getDataFolder(), "i18n");
       i18nFolder.mkdirs();

	config = new TradeConfiguration(getConfig());
       I18NManager.setGlobalBuilder(I18NBuilder.builder()
           .setFileSystemFolder(i18nFolder)
           .setClasspathFolder(I18N_CLASSPATH_FOLDER)
           .setLoadingMode(I18N.LoadingMode.FILE_SYSTEM)
           .setLocale(config.getLocale())
           .setLogger(getLogger()));
       i18nManager = new I18NManager();
	
	initVaultHook();
	
	itemControlManager = new ItemControlManager(config);
       worldControlManager = new WorldControlManager(config);
	
	factory = new TradeFactory(this, config, econ, itemControlManager);
	
	getCommand("trade").setExecutor(new CommandTrade(this));
	movementTask = getServer().getScheduler().runTaskTimer(this, new MoveCheckerRunnable(factory, config), 20L, 30L);

	try {
		Metrics metrics = new Metrics(this);
		metrics.start();
	} catch (IOException e) {
		getLogger().warning("Could not start metrics service: " + e);
	}

       PluginDescriptionFile pdf = getDescription();
       String version = pdf.getVersion();

       getLogger().info("SimpleTrading v" + version + " enabled!");
}
 
开发者ID:xaniox,项目名称:simple-trading,代码行数:46,代码来源:SimpleTrading.java

示例6: postPlugin

import org.bukkit.plugin.PluginDescriptionFile; //导入方法依赖的package包/类
private void postPlugin(final boolean isPing) throws IOException {
    final PluginDescriptionFile description = plugin.getDescription();
    final String pluginName = description.getName();
    final boolean onlineMode = Bukkit.getServer().getOnlineMode();
    final String pluginVersion = description.getVersion();
    final String serverVersion = Bukkit.getVersion();
    final int playersOnline = getOnlinePlayers().size();

    final StringBuilder data = new StringBuilder();

    data.append(encode("guid")).append('=').append(encode(guid));
    encodeDataPair(data, "version", pluginVersion);
    encodeDataPair(data, "server", serverVersion);
    encodeDataPair(data, "players", Integer.toString(playersOnline));
    encodeDataPair(data, "revision", String.valueOf(6));

    final String osname = System.getProperty("os.name");
    String osarch = System.getProperty("os.arch");
    final String osversion = System.getProperty("os.version");
    final String java_version = System.getProperty("java.version");
    final int coreCount = Runtime.getRuntime().availableProcessors();

    if (osarch.equals("amd64")) {
        osarch = "x86_64";
    }

    encodeDataPair(data, "osname", osname);
    encodeDataPair(data, "osarch", osarch);
    encodeDataPair(data, "osversion", osversion);
    encodeDataPair(data, "cores", Integer.toString(coreCount));
    encodeDataPair(data, "online-mode", Boolean.toString(onlineMode));
    encodeDataPair(data, "java_version", java_version);

    if (isPing) {
        encodeDataPair(data, "ping", "true");
    }

    final URL url = new URL("http://mcstats.org" + String.format("/report/%s", new Object[] { encode(pluginName) }));
    URLConnection connection;
    if (isMineshafterPresent()) {
        connection = url.openConnection(Proxy.NO_PROXY);
    } else {
        connection = url.openConnection();
    }

    connection.setDoOutput(true);

    final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
    writer.write(data.toString());
    writer.flush();

    final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    final String response = reader.readLine();

    writer.close();
    reader.close();

    if (response == null || response.startsWith("ERR")) {
        throw new IOException(response);
    }
}
 
开发者ID:tastybento,项目名称:beaconz,代码行数:62,代码来源:Metrics.java

示例7: postPlugin

import org.bukkit.plugin.PluginDescriptionFile; //导入方法依赖的package包/类
private void postPlugin(final boolean isPing) throws IOException {
final PluginDescriptionFile description = plugin.getDescription();
final String pluginName = description.getName();
final boolean onlineMode = Bukkit.getServer().getOnlineMode();
final String pluginVersion = description.getVersion();
final String serverVersion = Bukkit.getVersion();
final int playersOnline = getOnlinePlayers().size();

final StringBuilder data = new StringBuilder();

data.append(encode("guid")).append('=').append(encode(guid));
encodeDataPair(data, "version", pluginVersion);
encodeDataPair(data, "server", serverVersion);
encodeDataPair(data, "players", Integer.toString(playersOnline));
encodeDataPair(data, "revision", String.valueOf(6));

final String osname = System.getProperty("os.name");
String osarch = System.getProperty("os.arch");
final String osversion = System.getProperty("os.version");
final String java_version = System.getProperty("java.version");
final int coreCount = Runtime.getRuntime().availableProcessors();

if (osarch.equals("amd64")) {
    osarch = "x86_64";
}

encodeDataPair(data, "osname", osname);
encodeDataPair(data, "osarch", osarch);
encodeDataPair(data, "osversion", osversion);
encodeDataPair(data, "cores", Integer.toString(coreCount));
encodeDataPair(data, "online-mode", Boolean.toString(onlineMode));
encodeDataPair(data, "java_version", java_version);

if (isPing) {
    encodeDataPair(data, "ping", "true");
}

final URL url = new URL("http://mcstats.org" + String.format("/report/%s", new Object[] { encode(pluginName) }));
URLConnection connection;
if (isMineshafterPresent()) {
    connection = url.openConnection(Proxy.NO_PROXY);
} else {
    connection = url.openConnection();
}

connection.setDoOutput(true);

final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
writer.write(data.toString());
writer.flush();

final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
final String response = reader.readLine();

writer.close();
reader.close();

if (response == null || response.startsWith("ERR")) {
    throw new IOException(response);
}
   }
 
开发者ID:tastybento,项目名称:askygrid,代码行数:62,代码来源:Metrics.java


注:本文中的org.bukkit.plugin.PluginDescriptionFile.getVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。