本文整理汇总了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);
}
示例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");
}
}
}
示例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();
}
示例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);
}
}
示例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);
}
}