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


Java PluginDescriptionFile.getName方法代码示例

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


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

示例1: loadPlugin

import org.bukkit.plugin.PluginDescriptionFile; //导入方法依赖的package包/类
public void loadPlugin(Plugin pl, PluginDescriptionFile description) throws InvalidPluginException {
    valid(pl);

    SubPlugin sub = (SubPlugin) pl;
    valid(sub, description);

    sub.setLoader(this);
    sub.setDescription(description);
    sub.setParent(plugin);

    val logger = plugin.getLogger();
    val log = "[Sub|" + description.getName() + "] ";

    sub.setLogger(new Logger(sub.getClass().getCanonicalName(), null) {
        public void log(LogRecord record) {
            record.setMessage(log + record.getMessage());
            logger.log(record);
        }
    });
    Fun.load(sub);
    Bukkit.getPluginManager().enablePlugin(sub);
}
 
开发者ID:caoli5288,项目名称:economy,代码行数:23,代码来源:SubPluginLoader.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: 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

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