当前位置: 首页>>代码示例>>Java>>正文


Java MemorySection类代码示例

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


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


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