use of cn.nukkit.plugin.Plugin in project Nukkit by Nukkit.
the class MetadataStore method setMetadata.
public void setMetadata(Object subject, String metadataKey, MetadataValue newMetadataValue) {
if (newMetadataValue == null) {
throw new ServerException("Value cannot be null");
}
Plugin owningPlugin = newMetadataValue.getOwningPlugin();
if (owningPlugin == null) {
throw new PluginException("Plugin cannot be null");
}
String key = this.disambiguate((Metadatable) subject, metadataKey);
Map<Plugin, MetadataValue> entry = this.metadataMap.computeIfAbsent(key, k -> new WeakHashMap<>(1));
entry.put(owningPlugin, newMetadataValue);
}
use of cn.nukkit.plugin.Plugin in project Nukkit by Nukkit.
the class PluginsCommand method sendPluginList.
private void sendPluginList(CommandSender sender) {
String list = "";
Map<String, Plugin> plugins = sender.getServer().getPluginManager().getPlugins();
for (Plugin plugin : plugins.values()) {
if (list.length() > 0) {
list += TextFormat.WHITE + ", ";
}
list += plugin.isEnabled() ? TextFormat.GREEN : TextFormat.RED;
list += plugin.getDescription().getFullName();
}
sender.sendMessage(new TranslationContainer("nukkit.command.plugins.success", new String[] { String.valueOf(plugins.size()), list }));
}
Aggregations