• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MemorySection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.bukkit.configuration.MemorySection的典型用法代码示例。如果您正苦于以下问题:Java MemorySection类的具体用法?Java MemorySection怎么用?Java MemorySection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MemorySection类属于org.bukkit.configuration包,在下文中一共展示了MemorySection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: reload

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
/**
 * Reloads the content from the fileSystem
 */
@Override
public void reload() {
    this.items.clear();
    this.plugin.reloadConfig();
    final Map<String, Object> data = ((MemorySection) this.plugin.getConfig().get("gui.items")).getValues(false);
    for (final String key : data.keySet()) {
        try {
            final GUIItemContainer container = new ItemContainer(0, ((MemorySection) data.get(key)).getValues(false));
            if (key.equals("suggest-heads")) {
                ((ItemContainer) container).setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Suggest Heads");
            }
            this.items.put(key, container);
        } catch (final Exception e) {
            PetBlocksPlugin.logger().log(Level.WARNING, "Failed to load guiItem " + key + '.', e);
        }
    }
}
 
开发者ID:Shynixn,项目名称:PetBlocks,代码行数:21,代码来源:FixedItemConfiguration.java


示例2: fixJoinDefaultPet

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
public void fixJoinDefaultPet(PetMeta petData) {
    final PetData petMeta = (PetData) petData;
    petMeta.setSkin(this.getData("join.settings.id"), (short) (int) this.getData("join.settings.damage"), this.getData("join.settings.skin"), this.getData("unbreakable"));
    petMeta.setEngine(this.engineController.getById(this.getData("join.settings.engine")));
    petMeta.setPetDisplayName(this.getData("join.settings.petname"));
    petMeta.setEnabled(this.getData("join.settings.enabled"));
    petMeta.setAge(this.getData("join.settings.age"));
    if (!((String) this.getData("join.settings.particle.name")).equalsIgnoreCase("none")) {
        final ParticleEffectMeta meta;
        try {
            meta = new ParticleEffectData(((MemorySection) this.getData("effect")).getValues(false));
            petMeta.setParticleEffectMeta(meta);
        } catch (final Exception e) {
            PetBlocksPlugin.logger().log(Level.WARNING, "Failed to load particle effect for join pet.");
        }
    }
}
 
开发者ID:Shynixn,项目名称:PetBlocks,代码行数:18,代码来源:Config.java


示例3: reload

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
/**
 * Reloads the content from the fileSystem
 */
@Override
public void reload() {
    this.particleCache.clear();
    this.plugin.reloadConfig();
    final Map<String, Object> data = ((MemorySection) this.plugin.getConfig().get("particles")).getValues(false);
    for (final String key : data.keySet()) {
        try {
            final GUIItemContainer container = new ItemContainer(Integer.parseInt(key), ((MemorySection) data.get(key)).getValues(false));
            final ParticleEffectMeta meta = new ParticleEffectData(((MemorySection) ((MemorySection) data.get(key)).getValues(false).get("effect")).getValues(true));
            this.particleCache.put(container, meta);
        } catch (final Exception e) {
            PetBlocksPlugin.logger().log(Level.WARNING, "Failed to load particle " + key + '.', e);
        }
    }
}
 
开发者ID:Shynixn,项目名称:PetBlocks,代码行数:19,代码来源:ParticleConfiguration.java


示例4: ArgsKnot

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public ArgsKnot(String name, MemorySection section)
{
	this.name = name;
	
	Map<String, Object> kids = section.getValues(false);
	
	for(Entry<String, Object> element : kids.entrySet())
	{
		String key = element.getKey();
		Object obj = element.getValue();
		
		if(obj instanceof MemorySection)
		{
			childreen.put(key, new ArgsKnot((MemorySection) obj));
		}
		else if(obj instanceof List)
		{
			if("args".equals(key))
			{
				argumentList = (List<String>) obj;
			}
		}
	}
}
 
开发者ID:Ecconia,项目名称:FusePort,代码行数:26,代码来源:FeedbackCreator.java


示例5: BallMetaEntity

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
BallMetaEntity(Map<String, Object> items) throws Exception {
    super();
    this.ballSkin = (String) items.get("skin");
    this.rotating = !(boolean) items.get("rotating");
    this.horizontalStrength = (double) items.get("horizontal-strength");
    this.verticalStrength = (double) items.get("vertical-strength");
    this.ballSpawnTime = (int) items.get("spawnduration");
    this.genericHitParticle = new SParticle(((MemorySection) items.get("particles.generic-hit")).getValues(true));
    this.playerTeamRedHitParticle = new SParticle(((MemorySection) items.get("particles.red-hit")).getValues(true));
    this.playerTeamBlueHitParticle = new SParticle(((MemorySection) items.get("particles.blue-hit")).getValues(true));
    this.ballSpawnParticle = new SParticle(((MemorySection) items.get("particles.spawn")).getValues(true));
    this.ballGoalParticle = new SParticle(((MemorySection) items.get("particles.goal")).getValues(true));
    this.genericHitSound = new FastSound(((MemorySection) items.get("sounds.generic-hit")).getValues(true));
    this.ballSpawnSound = new FastSound(((MemorySection) items.get("sounds.spawn")).getValues(true));
    this.ballGoalSound = new FastSound(((MemorySection) items.get("sounds.goal")).getValues(true));
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:17,代码来源:BallMetaEntity.java


示例6: LobbyMetaEntity

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
LobbyMetaEntity(Map<String, Object> items) throws Exception {
    super();
    if (items.get("spawnpoint") != null)
        this.lobbySpawn = new SLocation(((MemorySection) items.get("spawnpoint")).getValues(true));
    this.gameTime = (int) items.get("gameduration");
    this.countdown = (int) items.get("lobbyduration");
    for (int i = 0; i < 10000 && items.containsKey("signs.join." + i); i++)
        this.signLocations.add(new SLocation(((MemorySection) items.get("signs.join." + i)).getValues(true)));
    for (int i = 0; i < 10000 && items.containsKey("signs.leave." + i); i++)
        this.leaveSignLocations.add(new SLocation(((MemorySection) items.get("signs.leave." + i)).getValues(true)));
    for (int i = 0; i < 10000 && items.containsKey("signs.red." + i); i++)
        this.redTeamSignLocations.add(new SLocation(((MemorySection) items.get("signs.red." + i)).getValues(true)));
    for (int i = 0; i < 10000 && items.containsKey("signs.blue." + i); i++)
        this.blueTeamSignLocations.add(new SLocation(((MemorySection) items.get("signs.blue." + i)).getValues(true)));
    this.gameTitleMessage = (String) items.get("messages.countdown-title");
    this.gameSubTitleMessage = (String) items.get("messages.countdown-subtitle");
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:18,代码来源:LobbyMetaEntity.java


示例7: ArenaEntity

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
ArenaEntity(Map<String, Object> items, List<String> wallBouncing) throws Exception {
    super();
    this.setName(String.valueOf(items.get("id")));
    this.setCornerLocations(new SLocation(((MemorySection) items.get("corner-1")).getValues(true)).toLocation(), new SLocation(((MemorySection) items.get("corner-2")).getValues(true)).toLocation());
    this.alias = (String) items.get("name");
    this.isEnabled = (boolean) items.get("enabled");
    this.gameType = GameType.getGameTypeFromName((String) items.get("gamemode"));
    this.redGoal = new GoalEntity(((MemorySection) items.get("goals.red")).getValues(true));
    this.blueGoal = new GoalEntity(((MemorySection) items.get("goals.blue")).getValues(true));
    this.ballSpawnLocation = new SLocation(((MemorySection) items.get("ball.spawn")).getValues(true));
    this.properties = new BallMetaEntity(((MemorySection) items.get("ball.properties")).getValues(true));
    this.lobbyMetaEntity = new LobbyMetaEntity(((MemorySection) items.get("lobby")).getValues(true));
    if (items.get("event") != null)
        this.properties3 = new EventMetaEntity(((MemorySection) items.get("event")).getValues(true));

    final Map<String, Object> data = ((MemorySection) items.get("properties")).getValues(true);
    this.properties2 = new TeamMetaEntity(data);

    this.bounce_types = new ArrayList<>(wallBouncing);
    if (data.containsKey("boost-items"))
        this.boostItemHandler = new ItemSpawner(((MemorySection) data.get("boost-items")).getValues(true));
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:23,代码来源:ArenaEntity.java


示例8: init

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
public static boolean init(RPGInventory instance) {
    MemorySection config = (MemorySection) Config.getConfig().get("craft");
    if (!config.getBoolean("enabled") || !config.contains("extensions")) {
        return false;
    }

    try {
        capItem = ItemUtils.getTexturedItem(config.getString("extendable"));

        Set<String> extensionNames = config.getConfigurationSection("extensions").getKeys(false);
        for (String extensionName : extensionNames) {
            EXTENSIONS.add(new CraftExtension(extensionName, config.getConfigurationSection("extensions." + extensionName)));
        }
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }

    // Register listeners
    ProtocolLibrary.getProtocolManager().addPacketListener(new CraftListener(instance));
    return true;
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:23,代码来源:CraftManager.java


示例9: load

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
@Override
public void load(Config config) {
    super.load(config);

    Object object = config.get("event-key-loot");
    if (object instanceof MemorySection) {
        MemorySection section = (MemorySection) object;
        for (String key : section.getKeys(false)) {
            try {
                Object value = config.get(section.getCurrentPath() + '.' + key);
                if (value instanceof List<?>) {
                    List<?> list = (List<?>) value;
                    for (Object each : list) {
                        if (each instanceof String) {
                            inventories.put(key, InventorySerialisation.fromBase64((String) each));
                        }
                    }
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:25,代码来源:EventKey.java


示例10: reloadPlaytimeData

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
public void reloadPlaytimeData() {
	Object object = this.config.getConfig().get("playing-times");

	if (object instanceof MemorySection) {
		MemorySection section = (MemorySection) object;

		for (Object id : section.getKeys(false)) {
			this.totalPlaytimeMap.put(UUID.fromString((String) id), this.config.getConfig().getLong("playing-times." + id, 0L));
		}
	}

	long millis = System.currentTimeMillis();

	for (Player target : Bukkit.getOnlinePlayers()) {
		this.sessionTimestamps.put(target.getUniqueId(), millis);
	}
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:18,代码来源:PlayTimeManager.java


示例11: handleLoad

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
@Override
public void handleLoad() {
    // Clearing in case of configuration reload
    strings.clear();
    lists.clear();

    for (String path : base.getKeys(true)) {
        Object value = base.get(path);

        if (value == null || value instanceof MemorySection) {
            continue;
        }

        if (value instanceof String && !((String) value).isEmpty()) {
            strings.put(path, (String) value);
        } else if (value instanceof List && !((List) value).isEmpty()){
            lists.put(path, base.getStringList(path));
        }
    }
}
 
开发者ID:RealizedMC,项目名称:Duels,代码行数:21,代码来源:MessagesConfig.java


示例12: parse

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
private void parse(ConfigurationSection config) {
    for (Map.Entry<String, Object> entry : config.getValues(false).entrySet()) {

        MemorySection section = (MemorySection) entry.getValue();

        String message = ChatColor.translateAlternateColorCodes('`', entry.getKey());

        String exemptPermission = section.getString("exempt-permission");
        String receivePermission = section.getString("receive-permission");

        if (exemptPermission != null && receivePermission != null && exemptPermission.equals(receivePermission)) {
            throw new IllegalArgumentException("exempt permission and receive permission are at the same value");
        }

        String formatterName = section.getString("formatter");
        TipFormatter formatter = this.plugin.getTipsManager().getFormatter(formatterName);

        if (formatter == null) {
            throw new IllegalArgumentException("that formatter does not exist");
        }

        this.tips.add(new Tip(receivePermission, exemptPermission, message, formatter));
    }
}
 
开发者ID:ttaylorr,项目名称:tips,代码行数:25,代码来源:TipsFactory.java


示例13: LoadMailBoxes

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
public static void LoadMailBoxes() {
    MemorySection ms = (MemorySection) MailYML.get("mailboxes");
    if(ms == null) {
        return;
    }
    for(String s : ms.getKeys(false)) {
        OfflinePlayer p = Bukkit.getOfflinePlayer(MailYML.getString("mailboxes." + s + ".owner"));
        World w = Bukkit.getWorld(MailYML.getString("mailboxes." + s + ".world"));
        if(w == null) {
            continue;
        }
        
        Block b = w.getBlockAt(MailYML.getInt("mailboxes." + s + ".x"), MailYML.getInt("mailboxes." + s + ".y"), MailYML.getInt("mailboxes." + s + ".z"));
        if(!isChest(b)) {
            continue;
        }
        
        Chest c = getChest(b);
        
        MailItemBox mailBox = new MailItemBox(c, p);
    }
}
 
开发者ID:peruid,项目名称:MailItems,代码行数:23,代码来源:MailItemsMailManager.java


示例14: getString

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
@Nullable
@Override
public String getString(String keyPath, @Nullable String def) {

    Object value = getStringObject(keyPath);

    if (value instanceof MemorySection)
        return def;

    if (value != null)
        return String.valueOf(value);

    if (def != null && isDefaultsSaved())
        set(keyPath, def);

    return def;
}
 
开发者ID:JCThePants,项目名称:NucleusFramework,代码行数:18,代码来源:AbstractDataNode.java


示例15: addChildren

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
/**
 * Recursively visits every MemorySection and creates a {@link PermissionDefinition} when applicable.
 *
 * @param node the node to visit
 * @param collection the collection to add constructed permission definitions to
 */
private static void addChildren(MemorySection node, Map<String, PermissionDefinition> collection) {
    // A MemorySection may have a permission entry, as well as MemorySection children
    boolean hasPermissionEntry = false;
    for (String key : node.getKeys(false)) {
        if (node.get(key) instanceof MemorySection && !"children".equals(key)) {
            addChildren((MemorySection) node.get(key), collection);
        } else if (PERMISSION_FIELDS.contains(key)) {
            hasPermissionEntry = true;
        } else {
            throw new IllegalStateException("Unexpected key '" + key + "'");
        }
    }
    if (hasPermissionEntry) {
        PermissionDefinition permDef = new PermissionDefinition(node);
        collection.put(permDef.node, permDef);
    }
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:24,代码来源:PermissionConsistencyTest.java


示例16: collectChildren

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
/**
 * Recursively walks through the given memory section to gather all keys.
 * Assumes that the ending value is a boolean and throws an exception otherwise.
 *
 * @param parentSection the memory section to traverse
 * @param children list to add all results to
 */
private static void collectChildren(MemorySection parentSection, List<String> children) {
    for (Map.Entry<String, Object> entry : parentSection.getValues(false).entrySet()) {
        if (entry.getValue() instanceof MemorySection) {
            collectChildren((MemorySection) entry.getValue(), children);
        } else if (entry.getValue() instanceof Boolean) {
            if (!Boolean.TRUE.equals(entry.getValue())) {
                throw new IllegalStateException("Child entry '" + entry.getKey()
                    + "' has unexpected value '" + entry.getValue() + "'");
            }
            children.add(parentSection.getCurrentPath() + "." + entry.getKey());
        } else {
            throw new IllegalStateException("Found child entry at '" + entry.getKey() + "' with value "
                + "of unexpected type: '" + parentSection.getCurrentPath() + "." + entry.getValue() + "'");
        }
    }
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:24,代码来源:PermissionConsistencyTest.java


示例17: getLabelsFromPluginFile

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
/**
 * Reads plugin.yml and returns the defined commands by main label and aliases.
 *
 * @return collection of all labels and their aliases
 */
@SuppressWarnings("unchecked")
private static Map<String, List<String>> getLabelsFromPluginFile() {
    FileConfiguration pluginFile = YamlConfiguration.loadConfiguration(getJarFile("/plugin.yml"));
    MemorySection commandList = (MemorySection) pluginFile.get("commands");
    Map<String, Object> commandDefinitions = commandList.getValues(false);

    Map<String, List<String>> commandLabels = new HashMap<>();
    for (Map.Entry<String, Object> commandDefinition : commandDefinitions.entrySet()) {
        MemorySection definition = (MemorySection) commandDefinition.getValue();
        List<String> alternativeLabels = definition.get("aliases") == null
            ? Collections.EMPTY_LIST
            : (List<String>) definition.get("aliases");
        commandLabels.put(commandDefinition.getKey(), alternativeLabels);
    }
    return commandLabels;
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:22,代码来源:CommandConsistencyTest.java


示例18: reload

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
@Override
public void reload()
{
	this.items = new ArrayList<>();

	if (! plugin.getConfig().isSet("shopItems"))
	{
		plugin.getLogHandler().log(Level.WARNING, "Shop list is empty!");
		return;
	}

	Map<String, Object> values = plugin.getConfig().getConfigurationSection("shopItems").getValues(false);
	for (Entry<String, Object> entry : values.entrySet())
	{
		try
		{
			ShopItem item = readItem(entry.getKey(), (MemorySection) entry.getValue());
			if (item != null)
				items.add(item);
		}
		catch (Throwable ex)
		{
			plugin.getLogHandler().log(Level.WARNING, Util.getUsefulStack(ex, "loading shop item " + entry.getKey()));
		}
	}
}
 
开发者ID:dmulloy2,项目名称:TeamSparkle,代码行数:27,代码来源:ShopHandler.java


示例19: index

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
static void index(DataManager manager) {
	DataManager.setManager(manager);
	HashMap<String, Object> groups = DataManager.getGroups();
	if (groups != null)
		for (String key : groups.keySet()) {
			if (!(groups.get(key) instanceof MemorySection))
				continue;
			
			PermissionsGroup pg = registerGroup((MemorySection) groups.get(key), key);
			if (pg != null)
				KevsPermissions.groups.put(key, pg);
		}
	
	if (KevsPermissions.groups.size() == 0 || KevsPermissions.groups.get(DataManager.getDefaultGroup()) == null) {
		HashMap<String, Object> options = new HashMap<>();
		options.put("prefix", "");
		options.put("suffix", "");
		KevsPermissions.groups
				.put(DataManager.getDefaultGroup(),
						PermissionsFactory.createGroup(
								PermissionsFactory.createMeta(0, 0, DataManager.getDefaultGroup(),
										PermissionsOrigin.FILE, options, false),
								new PermissionsList(new ArrayList<>())));
	}
	
	for (Player p : Bukkit.getOnlinePlayers()) {
		registerPlayer(p);
	}
}
 
开发者ID:KevSlashNull,项目名称:KevsPermissions,代码行数:30,代码来源:KevsPermissions.java


示例20: EngineData

import org.bukkit.configuration.MemorySection; //导入依赖的package包/类
/**
 * Initializes a new engine data
 *
 * @param id   id
 * @param data data
 * @throws Exception exception
 */
public EngineData(long id, Map<String, Object> data) throws Exception {
    super();
    this.setId(id);
    this.itemContainer = new ItemContainer((int) id, ((MemorySection) data.get("gui")).getValues(false));
    this.entity = (String) data.get("behaviour.entity");
    this.rideType = RideType.valueOf((String) data.get("behaviour.riding"));
    this.ambientSound = new SoundBuilder((String) data.get("sound.ambient.name"), (double) data.get("sound.ambient.volume"), (double) data.get("sound.ambient.pitch"));
    this.walkingSound = new SoundBuilder((String) data.get("sound.walking.name"), (double) data.get("sound.walking.volume"), (double) data.get("sound.walking.pitch"));
}
 
开发者ID:Shynixn,项目名称:PetBlocks,代码行数:17,代码来源:EngineData.java



注:本文中的org.bukkit.configuration.MemorySection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AddressingFeature类代码示例发布时间:2022-05-21
下一篇:
Java LayerWidget类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap