本文整理汇总了Java中cn.nukkit.plugin.PluginDescription类的典型用法代码示例。如果您正苦于以下问题:Java PluginDescription类的具体用法?Java PluginDescription怎么用?Java PluginDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PluginDescription类属于cn.nukkit.plugin包,在下文中一共展示了PluginDescription类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getPluginDescription
import cn.nukkit.plugin.PluginDescription; //导入依赖的package包/类
@Override
public PluginDescription getPluginDescription(File file) {
try (JarFile jar = new JarFile(file)) {
JarEntry entry = jar.getJarEntry("plugin.yml");
if (entry == null) {
return null;
}
InputStream stream = jar.getInputStream(entry);
return new PokkitPluginDescription(stream);
} catch (Exception e) {
Bukkit.getServer().getLogger().log(Level.SEVERE, "Could not load plugin " + file.getName(), e);
return null;
}
}
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:16,代码来源:PokkitPluginLoader.java
示例2: PokkitPlugin
import cn.nukkit.plugin.PluginDescription; //导入依赖的package包/类
PokkitPlugin(JavaPlugin bukkit, PluginDescription pluginDescription, PluginLoader pluginLoader) throws IOException {
this.bukkit = Objects.requireNonNull(bukkit);
this.pluginDescription = Objects.requireNonNull(pluginDescription);
this.loader = Objects.requireNonNull(pluginLoader);
this.logger = new PluginLogger(this);
}
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:8,代码来源:PokkitPlugin.java
示例3: getLongQuery
import cn.nukkit.plugin.PluginDescription; //导入依赖的package包/类
public byte[] getLongQuery() {
ByteBuffer query = ByteBuffer.allocate(65536);
String plist = this.server_engine;
if (this.plugins.length > 0 && this.listPlugins) {
plist += ":";
for (Plugin p : this.plugins) {
PluginDescription d = p.getDescription();
plist += " " + d.getName().replace(";", "").replace(":", "").replace(" ", "_") + " " + d.getVersion().replace(";", "").replace(":", "").replace(" ", "_") + ";";
}
plist = plist.substring(0, plist.length() - 2);
}
query.put("splitnum".getBytes());
query.put((byte) 0x00);
query.put((byte) 128);
query.put((byte) 0x00);
LinkedHashMap<String, String> KVdata = new LinkedHashMap<>();
KVdata.put("hostname", this.serverName);
KVdata.put("gametype", this.gameType);
KVdata.put("game_id", GAME_ID);
KVdata.put("version", this.version);
KVdata.put("server_engine", this.server_engine);
KVdata.put("plugins", plist);
KVdata.put("map", this.map);
KVdata.put("numplayers", String.valueOf(this.numPlayers));
KVdata.put("maxplayers", String.valueOf(this.maxPlayers));
KVdata.put("whitelist", this.whitelist);
KVdata.put("hostip", this.ip);
KVdata.put("hostport", String.valueOf(this.port));
for (Map.Entry<String, String> entry : KVdata.entrySet()) {
query.put(entry.getKey().getBytes(StandardCharsets.UTF_8));
query.put((byte) 0x00);
query.put(entry.getValue().getBytes(StandardCharsets.UTF_8));
query.put((byte) 0x00);
}
query.put(new byte[]{0x00, 0x01}).put("player_".getBytes()).put(new byte[]{0x00, 0x00});
for (Player player : this.players) {
query.put(player.getName().getBytes(StandardCharsets.UTF_8));
query.put((byte) 0x00);
}
query.put((byte) 0x00);
return Arrays.copyOf(query.array(), query.position());
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:49,代码来源:QueryRegenerateEvent.java
示例4: execute
import cn.nukkit.plugin.PluginDescription; //导入依赖的package包/类
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
if (!this.testPermission(sender)) {
return true;
}
if (args.length == 0) {
sender.sendMessage(new TranslationContainer("nukkit.server.info.extended", new String[]{
sender.getServer().getName(),
sender.getServer().getNukkitVersion(),
sender.getServer().getCodename(),
sender.getServer().getApiVersion(),
sender.getServer().getVersion(),
String.valueOf(ProtocolInfo.CURRENT_PROTOCOL)
}));
} else {
String pluginName = "";
for (String arg : args) pluginName += arg + " ";
pluginName = pluginName.trim();
final boolean[] found = {false};
final Plugin[] exactPlugin = {sender.getServer().getPluginManager().getPlugin(pluginName)};
if (exactPlugin[0] == null) {
pluginName = pluginName.toLowerCase();
final String finalPluginName = pluginName;
sender.getServer().getPluginManager().getPlugins().forEach((s, p) -> {
if (s.toLowerCase().contains(finalPluginName)) {
exactPlugin[0] = p;
found[0] = true;
}
});
} else {
found[0] = true;
}
if (found[0]) {
PluginDescription desc = exactPlugin[0].getDescription();
sender.sendMessage(TextFormat.DARK_GREEN + desc.getName() + TextFormat.WHITE + " version " + TextFormat.DARK_GREEN + desc.getVersion());
if (desc.getDescription() != null) {
sender.sendMessage(desc.getDescription());
}
if (desc.getWebsite() != null) {
sender.sendMessage("Website: " + desc.getWebsite());
}
List<String> authors = desc.getAuthors();
final String[] authorsString = {""};
authors.forEach((s) -> authorsString[0] += s);
if (authors.size() == 1) {
sender.sendMessage("Author: " + authorsString[0]);
} else if (authors.size() >= 2) {
sender.sendMessage("Authors: " + authorsString[0]);
}
} else {
sender.sendMessage(new TranslationContainer("nukkit.command.version.noSuchPlugin"));
}
}
return true;
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:58,代码来源:VersionCommand.java
示例5: execute
import cn.nukkit.plugin.PluginDescription; //导入依赖的package包/类
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
if (!this.testPermission(sender)) {
return true;
}
if (args.length == 0) {
sender.sendMessage(sender.getServer().getLanguage().translateString("nukkit.server.info.extended", new String[]{
sender.getServer().getName(),
sender.getServer().getNukkitVersion(),
sender.getServer().getCodename(),
sender.getServer().getApiVersion(),
sender.getServer().getVersion(),
String.valueOf(ProtocolInfo.CURRENT_PROTOCOL)
}) + "使用しているJupiterのバージョンは" + sender.getServer().getJupiterVersion() + "です。");
} else {
String pluginName = "";
for (String arg : args) pluginName += arg + " ";
pluginName = pluginName.trim();
final boolean[] found = {false};
final Plugin[] exactPlugin = {sender.getServer().getPluginManager().getPlugin(pluginName)};
if (exactPlugin[0] == null) {
pluginName = pluginName.toLowerCase();
final String finalPluginName = pluginName;
sender.getServer().getPluginManager().getPlugins().forEach((s, p) -> {
if (s.toLowerCase().contains(finalPluginName)) {
exactPlugin[0] = p;
found[0] = true;
}
});
} else {
found[0] = true;
}
if (found[0]) {
PluginDescription desc = exactPlugin[0].getDescription();
sender.sendMessage(TextFormat.DARK_GREEN + desc.getName() + TextFormat.WHITE + " version " + TextFormat.DARK_GREEN + desc.getVersion());
if (desc.getDescription() != null) {
sender.sendMessage(desc.getDescription());
}
if (desc.getWebsite() != null) {
sender.sendMessage("Website: " + desc.getWebsite());
}
List<String> authors = desc.getAuthors();
final String[] authorsString = {""};
authors.forEach((s) -> authorsString[0] += s);
if (authors.size() == 1) {
sender.sendMessage("Author: " + authorsString[0]);
} else if (authors.size() >= 2) {
sender.sendMessage("Authors: " + authorsString[0]);
}
} else {
sender.sendMessage(new TranslationContainer("nukkit.command.version.noSuchPlugin"));
}
}
return true;
}
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:58,代码来源:VersionCommand.java
示例6: getDescription
import cn.nukkit.plugin.PluginDescription; //导入依赖的package包/类
@Override
public PluginDescriptionFile getDescription() {
PluginDescription nukkitDescription = nukkit.getDescription();
return new PluginDescriptionFile(nukkitDescription.getName(), nukkitDescription.getVersion(),
nukkitDescription.getMain());
}
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:7,代码来源:PokkitPlugin.java
注:本文中的cn.nukkit.plugin.PluginDescription类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论