本文整理汇总了Java中org.bukkit.configuration.MemoryConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java MemoryConfiguration类的具体用法?Java MemoryConfiguration怎么用?Java MemoryConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MemoryConfiguration类属于org.bukkit.configuration包,在下文中一共展示了MemoryConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: read
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
@Override
public Object read(String key, ConfigurationSection section) {
List<?> list;
if (section.isConfigurationSection(key)) {
list = new ArrayList<>(section.getConfigurationSection(key).getValues(false).values());
} else {
list = section.getList(key);
}
Object array = Array.newInstance(type, list.size());
for (int i = 0; i < list.size(); i++) {
Object obj = list.get(i);
ConfigurationSection dummySection = new MemoryConfiguration();
dummySection.set("dummy", obj);
Array.set(array, i, handler.adaptIn(dummySection, "dummy", obj.getClass()));
}
return array;
}
开发者ID:mkotb,项目名称:ConfigAPI,代码行数:23,代码来源:ArrayAdapter.java
示例2: read
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
@Override
public Collection read(String key, ConfigurationSection section) {
Collection collection;
List<?> originalList;
if (section.isConfigurationSection(key)) {
originalList = new ArrayList<>(section.getConfigurationSection(key).getValues(false).values());
} else {
originalList = section.getList(key);
}
try {
collection = implementationClass.getDeclaredConstructor(int.class).newInstance(originalList.size());
} catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
throw new InternalProcessingException("Could not create new instance of " + implementationClass.getName(), e);
}
for (Object obj: originalList) {
ConfigurationSection dummySection = new MemoryConfiguration();
dummySection.set("dummy", obj);
collection.add(handler.adaptIn(dummySection, "dummy", type));
}
return collection;
}
开发者ID:mkotb,项目名称:ConfigAPI,代码行数:27,代码来源:CollectionAdapter.java
示例3: replaceParameters
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
public static ConfigurationSection replaceParameters(ConfigurationSection configuration, ConfigurationSection parameters)
{
if (configuration == null) return null;
ConfigurationSection replaced = new MemoryConfiguration();
Set<String> keys = configuration.getKeys(false);
for (String key : keys) {
Object value = configuration.get(key);
if (value == null) continue;
Object replacement = replaceParameters(value, parameters);
if (replacement != null) {
replaced.set(key, replacement);
}
}
return replaced;
}
开发者ID:elBukkit,项目名称:MagicLib,代码行数:19,代码来源:ConfigurationUtils.java
示例4: save
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
public void save(ConfigurationSection configuration) {
List<ConfigurationSection> mobsConfigurations = new ArrayList<ConfigurationSection>();
for (ArenaMobSpawner mob : mobs) {
ConfigurationSection section = new MemoryConfiguration();
mob.save(section);
mobsConfigurations.add(section);
}
configuration.set("mobs", mobsConfigurations);
configuration.set("spell_start", startSpell);
configuration.set("spell_end", endSpell);
List<String> mobSpawnList = new ArrayList<String>();
for (Location spawn : mobSpawns) {
mobSpawnList.add(ConfigurationUtils.fromLocation(spawn));
}
configuration.set("mob_spawns", mobSpawnList);
}
开发者ID:elBukkit,项目名称:MagicArenas,代码行数:18,代码来源:ArenaStage.java
示例5: getItemAttributes
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
private Configuration getItemAttributes(ItemStack stack) {
AttributeStorage storage = AttributeStorage.newTarget(stack, STB_ATTRIBUTE_ID);
YamlConfiguration conf = new YamlConfiguration();
try {
String s = storage.getData("");
if (s != null) {
conf.loadFromString(s);
if (Debugger.getInstance().getLevel() > 2) {
Debugger.getInstance().debug(3, "get item attributes for " + STBUtil.describeItemStack(stack) + ":");
for (String k : conf.getKeys(false)) {
Debugger.getInstance().debug(3, "- " + k + " = " + conf.get(k));
}
}
return conf;
} else {
throw new IllegalStateException("ItemStack " + stack + " has no STB attribute data!");
}
} catch (InvalidConfigurationException e) {
e.printStackTrace();
return new MemoryConfiguration();
}
}
开发者ID:desht,项目名称:sensibletoolbox,代码行数:23,代码来源:STBItemRegistry.java
示例6: LoadFromList
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static List<OreRule> LoadFromList (List<Map<?, ?>> configList) {
List<OreRule> result = new ArrayList<OreRule>();
if (configList == null)
return result;
for (Map<?, ?> item : configList) {
Map<String, Object> castItem = (Map<String, Object>)item;
MemoryConfiguration config = new MemoryConfiguration();
config.addDefaults(castItem);
result.add(new OreRule(config.getDefaults()));
}
return result;
}
开发者ID:jaquadro,项目名称:OrePlus,代码行数:17,代码来源:OreRule.java
示例7: LoadFromList
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static List<ClearRule> LoadFromList (List<Map<?, ?>> configList) {
List<ClearRule> result = new ArrayList<ClearRule>();
if (configList == null)
return result;
for (Map<?, ?> item : configList) {
Map<String, Object> castItem = (Map<String, Object>)item;
MemoryConfiguration config = new MemoryConfiguration();
config.addDefaults(castItem);
result.add(new ClearRule(config.getDefaults()));
}
return result;
}
开发者ID:jaquadro,项目名称:OrePlus,代码行数:17,代码来源:ClearRule.java
示例8: _getKitTimestamps
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
private ConfigurationSection _getKitTimestamps()
{
if (config.isConfigurationSection("timestamps.kits"))
{
final ConfigurationSection section = config.getConfigurationSection("timestamps.kits");
final ConfigurationSection newSection = new MemoryConfiguration();
for (String command : section.getKeys(false))
{
if (section.isLong(command))
{
newSection.set(command.toLowerCase(Locale.ENGLISH), section.getLong(command));
}
else if (section.isInt(command))
{
newSection.set(command.toLowerCase(Locale.ENGLISH), (long)section.getInt(command));
}
}
return newSection;
}
return new MemoryConfiguration();
}
开发者ID:Curtis3321,项目名称:Essentials,代码行数:23,代码来源:UserData.java
示例9: _getCommandCosts
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
public ConfigurationSection _getCommandCosts()
{
if (config.isConfigurationSection("command-costs"))
{
final ConfigurationSection section = config.getConfigurationSection("command-costs");
final ConfigurationSection newSection = new MemoryConfiguration();
for (String command : section.getKeys(false))
{
if (section.isDouble(command))
{
newSection.set(command.toLowerCase(Locale.ENGLISH), section.getDouble(command));
}
else if (section.isInt(command))
{
newSection.set(command.toLowerCase(Locale.ENGLISH), (double)section.getInt(command));
}
}
return newSection;
}
return null;
}
开发者ID:Curtis3321,项目名称:Essentials,代码行数:22,代码来源:Settings.java
示例10: _getKits
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
public ConfigurationSection _getKits()
{
if (config.isConfigurationSection("kits"))
{
final ConfigurationSection section = config.getConfigurationSection("kits");
final ConfigurationSection newSection = new MemoryConfiguration();
for (String kitItem : section.getKeys(false))
{
if (section.isConfigurationSection(kitItem))
{
newSection.set(kitItem.toLowerCase(Locale.ENGLISH), section.getConfigurationSection(kitItem));
}
}
return newSection;
}
return null;
}
开发者ID:Curtis3321,项目名称:Essentials,代码行数:18,代码来源:Settings.java
示例11: read
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
@Override
public Map read(String key, ConfigurationSection section) {
ConfigurationSection originalMap = section.getConfigurationSection(key);
Map map = new HashMap();
originalMap.getValues(false).forEach((k, v) -> {
ConfigurationSection dummySection = new MemoryConfiguration();
dummySection.set("dummy", v);
map.put(k, handler.adaptIn(dummySection, "dummy", valueClass));
});
return map;
}
开发者ID:mkotb,项目名称:ConfigAPI,代码行数:15,代码来源:MapAdapter.java
示例12: getConfig
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
public ConfigurationSection getConfig() {
ConfigurationSection section = new MemoryConfiguration();
section.set("id", id);
section.set("world", world.getName());
section.set("image", imgName);
return section;
}
开发者ID:leMaik,项目名称:RpgPlus,代码行数:8,代码来源:SavedMap.java
示例13: testFlatten
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
@Test
public void testFlatten() throws Exception {
ConfigurationSection config = new MemoryConfiguration();
config.set("foo", "bar");
config.set("deeply.nested.property", "value");
Map<String, String> flattened = ConfigurationSectionUtil.flatten(config);
assertEquals(2, flattened.size());
assertEquals("bar", flattened.get("foo"));
assertEquals("value", flattened.get("deeply.nested.property"));
}
开发者ID:leMaik,项目名称:RpgPlus,代码行数:12,代码来源:ConfigurationSectionUtilTest.java
示例14: loadResource
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
/**
* Loads a file into memory as a MemoryConfiguration
*
* @param file The file to load, then delete after loading
* @return The MemoryConfiguration resulting from loading the file
*/
public static MemoryConfiguration loadResource(String file) {
initFiles(file);
FileConfiguration fc = loadFile(file);
MemoryConfiguration mc = new MemoryConfiguration(fc);
deleteFile(file);
return mc;
}
开发者ID:RoyalDev,项目名称:PopulationDensity,代码行数:14,代码来源:Lib.java
示例15: serialize
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
public static MemorySection serialize(Transaction transaction) {
MemoryConfiguration serialized = new MemoryConfiguration();
serialized.set("sender", transaction.getSender().toString());
serialized.set("itemstack", transaction.getItemStack());
serialized.set("timestamp", transaction.getTimeStamp());
serialized.set("lifetime", transaction.getLifeTime());
return serialized;
}
开发者ID:bendem,项目名称:ItemToChat,代码行数:11,代码来源:Transaction.java
示例16: toConfigurationSection
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
public static ConfigurationSection toConfigurationSection(Map<?, ?> nodeMap) {
ConfigurationSection newSection = new MemoryConfiguration();
for (Map.Entry<?, ?> entry : nodeMap.entrySet()) {
set(newSection, entry.getKey().toString(), entry.getValue());
}
return newSection;
}
开发者ID:Slikey,项目名称:EffectLib,代码行数:9,代码来源:ConfigUtils.java
示例17: cloneConfiguration
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
public static ConfigurationSection cloneConfiguration(ConfigurationSection section)
{
return addConfigurations(new MemoryConfiguration(), section);
}
开发者ID:elBukkit,项目名称:MagicLib,代码行数:5,代码来源:ConfigurationUtils.java
示例18: loadTemplate
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
@Override
protected void loadTemplate(ConfigurationSection template)
{
castOnNoTarget = true;
super.loadTemplate(template);
undoable = false;
requiresBuildPermission = false;
requiresBreakPermission = false;
usesBrush = template.getBoolean("uses_brush", false);
if (template.contains("actions"))
{
ConfigurationSection parameters = template.getConfigurationSection("parameters");
ConfigurationSection actionsNode = template.getConfigurationSection("actions");
Object baseActions = actionsNode.get("cast");
Collection<String> templateKeys = template.getKeys(false);
for (String templateKey : templateKeys)
{
if (templateKey.endsWith("_parameters"))
{
ConfigurationSection overrides = new MemoryConfiguration();
ConfigurationUtils.addConfigurations(overrides, template.getConfigurationSection(templateKey));
String handlerKey = templateKey.substring(0, templateKey.length() - 11);
handlerParameters.put(handlerKey, overrides);
// Auto-register base actions, kind of hacky to check for alternates though.
if (baseActions != null && !actionsNode.contains(handlerKey) && handlerKey.startsWith("alternate_"))
{
actionsNode.set(handlerKey, baseActions);
}
}
}
actionsNode = ConfigurationUtils.replaceParameters(actionsNode, parameters);
if (actionsNode != null)
{
Collection<String> actionKeys = actionsNode.getKeys(false);
for (String actionKey : actionKeys)
{
ActionHandler handler = new ActionHandler();
handler.load(this, actionsNode, actionKey);
handler.initialize(this, parameters);
usesBrush = usesBrush || handler.usesBrush();
undoable = undoable || handler.isUndoable();
requiresBuildPermission = requiresBuildPermission || handler.requiresBuildPermission();
requiresBreakPermission = requiresBreakPermission || handler.requiresBreakPermission();
actions.put(actionKey, handler);
}
}
}
undoable = template.getBoolean("undoable", undoable);
}
开发者ID:elBukkit,项目名称:MagicLib,代码行数:54,代码来源:ActionSpell.java
示例19: MemoryConfigurationOptions
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
protected MemoryConfigurationOptions(MemoryConfiguration configuration) {
super(configuration);
}
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:MemoryConfigurationOptions.java
示例20: configuration
import org.bukkit.configuration.MemoryConfiguration; //导入依赖的package包/类
public MemoryConfiguration configuration() {
return null;
}
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:MemoryConfigurationOptions.java
注:本文中的org.bukkit.configuration.MemoryConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论