本文整理汇总了Java中org.bukkit.configuration.ConfigurationSection.contains方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationSection.contains方法的具体用法?Java ConfigurationSection.contains怎么用?Java ConfigurationSection.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.configuration.ConfigurationSection
的用法示例。
在下文中一共展示了ConfigurationSection.contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CraftExtension
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
CraftExtension(String name, ConfigurationSection config) {
this.name = name;
this.capItem = CraftManager.getCapItem().clone();
ItemMeta meta = capItem.getItemMeta();
meta.setDisplayName(StringUtils.coloredLine(config.getString("name")));
if (config.contains("lore")) {
meta.setLore(StringUtils.coloredLines(config.getStringList("lore")));
}
this.capItem.setItemMeta(meta);
this.slots = config.getIntegerList("slots");
if (config.contains("includes")) {
this.includes = new ArrayList<>();
for (String childName : config.getStringList("includes")) {
CraftExtension child = CraftManager.getByName(childName);
if (child != null) {
includes.add(child);
}
}
} else {
this.includes = null;
}
}
示例2: init
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public static void init() {
if (entityDistances != null) return;
entityDistances = Maps.newHashMap();
ConfigurationSection section = Bukkit.spigot().getConfig().getConfigurationSection("world-settings");
ConfigurationSection defaultSec = section.getConfigurationSection("default.entity-tracking-range");
for (String s : section.getKeys(false)) {
ConfigurationSection world = section.getConfigurationSection(s + ".entity-tracking-range");
int[] ranges = new int[]{
world.contains("players") ? world.getInt("players") : defaultSec.getInt("players"),
world.contains("animals") ? world.getInt("animals") : defaultSec.getInt("animals"),
world.contains("monsters") ? world.getInt("monsters") : defaultSec.getInt("monsters"),
world.contains("misc") ? world.getInt("misc") : defaultSec.getInt("misc"),
world.contains("other") ? world.getInt("other") : defaultSec.getInt("other")
};
int max = 0;
for (int range : ranges) {
if (range > max) max = range;
}
entityDistances.putIfAbsent(s, max);
}
}
示例3: isLinked
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public static boolean isLinked(Player p){
String uuid = p.getUniqueId().toString();
UtilsStorage storageType = Utils.getStorageType();
if(storageType == UtilsStorage.FILE){
if(UltimateTs.linkedPlayers.getConfigurationSection("linked") == null) UltimateTs.linkedPlayers.createSection("linked");
ConfigurationSection cs = UltimateTs.linkedPlayers.getConfigurationSection("linked");
if((cs.contains(uuid)) && (cs.getInt(uuid) > 0)) return true;
}else if(storageType == UtilsStorage.SQL){
if(UltimateTs.main().sql.isUUIDLinked(uuid)){
int linkedId = UltimateTs.main().sql.getLinkedId(uuid);
if(linkedId > 0){
return true;
}
}
}
return false;
}
示例4: CommandPlus
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public CommandPlus(ConfigurationSection section, MessageManager manager, String name){
this.name = name;
this.description = manager.getComponentManager().get(section.getString(Node.DESCRIPTION.get()));
this.usage = manager.getComponentManager().get(section.getString(Node.USAGE.get()));
this.requirement = new Requirement(section.get(Node.REQUIREMENT.get()), manager.getComponentManager());
this.takeRequirement = section.getBoolean("TAKE_REQUIREMENT", true);
if(section.contains(Node.NO_REQUIREMENT.get()))
this.noRequirement = manager.get(section.getString(Node.NO_REQUIREMENT.get()));
else
this.noRequirement = null;
List<String> aliases = section.getStringList(Node.ALIASES.get());
this.aliases = new ArrayList<String>();
if(aliases!=null){
List<String>patchBukkit = new ArrayList<String>();
patchBukkit.addAll(aliases);
for(String s : patchBukkit)
this.aliases.add(s.toLowerCase());
}
}
示例5: CPTeleportLocation
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public CPTeleportLocation(ConfigurationSection section, MessageManager manager, String name){
super(section, manager, name);
online = section.getBoolean("ONLINE", false);
if(section.contains(Node.LOCATION.get())) {
ConfigurationSection temp = section.getConfigurationSection(Node.LOCATION.get());
ErrorLogger.addPrefix(Node.LOCATION.get());
loc = ConfigUtils.loadLocation(temp);
ErrorLogger.removePrefix();
}else if(section.contains(Node.WORLD.get())){
ErrorLogger.addPrefix(Node.WORLD.get());
String world = section.getString(Node.WORLD.get());
ErrorLogger.removePrefix();
if(world != null) {
World w = Bukkit.getWorld(world);
if(w != null) {
loc = w.getSpawnLocation();
}else
ErrorLogger.addError("World `" + world + "` wasn't found.");
}else
Error.INVALID.add();
}
}
示例6: CPNode
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public CPNode(ConfigurationSection section, MessageManager manager, String name){
super(section, manager, name);
commands = new ArrayList<CommandPlus>();
ConfigurationSection node = section.getConfigurationSection(Node.NODE.getList());
ErrorLogger.addPrefix(Node.NODE.getList());
if(node == null){
Error.INVALID.add();
}else{
for(String key : node.getKeys(false)){
ErrorLogger.addPrefix(key);
ConfigurationSection sub = node.getConfigurationSection(key);
CommandPlus command = VanillaPlusCore.getCommandManager().create(sub.getString(Node.TYPE.get(), Node.NODE.get()), sub, manager, key);
if(command != null)
commands.add(command);
ErrorLogger.removePrefix();
}
}
ErrorLogger.removePrefix();
if(section.contains(Node.DEFAULT.get())){
ErrorLogger.addPrefix(Node.DEFAULT.get());
defaultCommand = VanillaPlusCore.getCommandManager().create(section.getConfigurationSection(Node.DEFAULT.get())
.getString(Node.TYPE.get(), Node.NODE.get()), section.getConfigurationSection(Node.DEFAULT.get()), manager, getName());
ErrorLogger.removePrefix();
}
}
示例7: initTool
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public static void initTool(ConfigurationSection tool) {
if (tools == null) clear();
if (!tool.contains("template")) {
if (!tool.contains("ignore.all")) {
return;
} else {
CropControl.getPlugin().info("Catchall tool found: {0}", tool.getName());
}
}
if (tools.containsKey(tool.getName())){
CropControl.getPlugin().info("Duplicate definition for tool {0}, old will be replaced", tool.getName());
}
ItemStack temp = (tool.contains("ignore.all") ? null : (ItemStack) tool.get("template"));
tools.put(tool.getName(),
new ToolConfig(temp,
tool.getBoolean("ignore.amount", true),
tool.getBoolean("ignore.durability", true),
tool.getBoolean("ignore.enchants", true),
tool.getBoolean("ignore.otherEnchants", true),
tool.getBoolean("ignore.enchantsLvl", true),
tool.getBoolean("ignore.lore", true),
tool.getBoolean("ignore.name", true)
)
);
CropControl.getPlugin().debug("Tool {0} defined as: {1}", tool.getName(), tools.get(tool.getName()));
}
示例8: CustomItem
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
CustomItem(String id, ConfigurationSection config) {
super(config, config.getString("texture"));
Rarity rarity = Rarity.valueOf(config.getString("rarity"));
this.name = StringUtils.coloredLine(rarity.getColor() + config.getString("name"));
if (config.contains("stats")) {
for (String stat : config.getStringList("stats")) {
this.stats.add(new ItemStat(ItemStat.StatType.valueOf(stat.split(" ")[0]), stat.split(" ")[1]));
}
}
this.lore = config.contains("lore") ? StringUtils.coloredLines(config.getStringList("lore")) : null;
this.leftClickAction = config.contains("abilities.left-click.command")
? new ItemAction(config.getConfigurationSection("abilities.left-click"))
: null;
this.rightClickAction = config.contains("abilities.right-click.command")
? new ItemAction(config.getConfigurationSection("abilities.right-click"))
: null;
this.permissions = config.contains("abilities.permissions") ? config.getStringList("abilities.permissions") : null;
this.drop = config.getBoolean("drop", true);
this.unbreakable = config.getBoolean("unbreakable", false);
this.statsHidden = config.getBoolean("hide-stats", false);
this.createItem(id);
}
示例9: Icon
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public Icon(ConfigurationSection section, MessageManager manager) {
if(section.getConfigurationSection(Node.ITEM.get())!=null){
ErrorLogger.addPrefix(Node.ITEM.get());
item = MinecraftUtils.loadItem(section.getConfigurationSection(Node.ITEM.get()));
ErrorLogger.removePrefix();
}
skullSelf = section.getBoolean("SKULL_SELF", false);
closeOnClick = section.getBoolean(Node.CLOSE.get(), false);
canMove = section.getBoolean(Node.MOVE.get(), false);
if(!canMove && item != null && item.getType() != Material.AIR)
item = MinecraftUtils.setExtra(item, FREEZE, "1");
if(item == null)
item = air;
if(skullSelf && item.getType() != Material.SKULL_ITEM)
skullSelf = false;
if(skullSelf)
item.setDurability((short) 3);
if(section.contains(Node.NAME_PATH.get())){
name = manager.getComponentManager().get(section.getString(Node.NAME_PATH.get()));
if(isStatic && name != null)
isStatic = false;
}
if(section.contains(Node.LORE_PATH.get())){
lore = new ArrayList<MComponent>();
if(!section.getStringList(Node.LORE_PATH.get()).isEmpty()) {
for(String key : section.getStringList(Node.LORE_PATH.get())){
MComponent temp = manager.getComponentManager().get(key);
if(temp == null)
continue;
lore.add(temp);
if(isStatic)
isStatic = false;
}
}else if(section.getString(Node.LORE_PATH.get()) != null) {
lore.add(manager.getComponentManager().get(section.getString(Node.LORE_PATH.get())));
}
}
}
示例10: IconAchievement
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public IconAchievement(ConfigurationSection section, MessageManager manager) {
this.achievement = VanillaPlusCore.getAchievementManager().get((short) section.getInt(Node.ID.get(), 0));
if(achievement == null){
ErrorLogger.addError(Node.ID.get() + Error.INVALID.getMessage());
return;
}
this.display = VanillaPlusCore.getAchievementManager().getDisplay((byte) section.getInt(Node.DISPLAY.get(), 0));
if(display == null)
ErrorLogger.addError(Node.DISPLAY.get() + Error.INVALID.getMessage());
showLockedRequirement = section.getBoolean("SHOW_LOCKED_REQUIREMENT", true);
showLockedReward = section.getBoolean("SHOW_LOCKED_REWARD", true);
showUnlockedRequirement = section.getBoolean("SHOW_UNLOCKED_REQUIREMENT", false);
showUnlockedReward = section.getBoolean("SHOW_UNLOCKED_REWARD", false);
if((showLockedRequirement || showUnlockedRequirement) && achievement.getRequirement() == null){
ErrorLogger.addError("Can't show unset requirement !");
showLockedRequirement = false;
showUnlockedRequirement = false;
}else if(showLockedRequirement || showUnlockedRequirement){
if(section.contains("REQUIREMENT_MESSAGE"))
this.requirementMessage = manager.getComponentManager().get(section.getString("REQUIREMENT_MESSAGE"));
}
if((showLockedReward || showUnlockedReward) && achievement.getReward() == null){
ErrorLogger.addError("Can't show unset reward !");
showLockedReward = false;
showUnlockedReward = false;
}else if (showLockedReward || showUnlockedReward) {
if(section.contains("REWARD_MESSAGE"))
this.rewardMessage = manager.getComponentManager().get(section.getString("REWARD_MESSAGE"));
}
}
示例11: CPMessagePrivate
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public CPMessagePrivate(ConfigurationSection section, MessageManager manager, String name){
super(section, manager, name);
if(instance == null){
instance = this;
new BukkitRunnable() {
@Override
public void run() {
for(Entry<VPPlayer, HashMap<VPPlayer, LiteEntry<Integer, Integer>>>entry : history.entrySet()){
if(entry.getValue() == null || entry.getValue().isEmpty()){
history.remove(entry.getKey());
}
for(Entry<VPPlayer, LiteEntry<Integer, Integer>>pEntry : entry.getValue().entrySet()){
if(pEntry.getValue() == null || pEntry.getValue().getValue() >=29){
entry.getValue().remove(pEntry.getKey());
}else{
pEntry.getValue().setValue(pEntry.getValue().getValue()+1);
}
}
if(entry.getValue().isEmpty()){
history.remove(entry.getKey());
}
}
}
}.runTaskLater(VanillaPlus.getInstance(), 20);
}
if(section.contains("CHANNEL_SPY")){
spy = VanillaPlusCore.getChannelManager().get(section.getString("CHANNEL_SPY"), true);
messageSpy = manager.get(section.getString("MESSAGE_SPY"));
if(spy == null || messageSpy == null){
ErrorLogger.addError("SPY error");
}
}
bypassChannelMute = section.getBoolean("BYPASS_CHANNEL_MUTE", false);
messageFrom = manager.get(section.getString(Node.MESSAGE_FROM.get()));
messageTo = manager.get(section.getString(Node.MESSAGE_TO.get()));
messageToLockMP = manager.get(section.getString("MESSAGE_TO_LOCKED"));
min = section.getInt("MIN", 0);
if(min < 0)
min = 0;
}
示例12: Magazine
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public Magazine(ConfigurationSection config) {
this.name = config.getName();
this.tag = ChatColor.BLACK + "Magazine: "
+ Integer.toHexString(this.getName().hashCode() + this.getName().length());
this.example = config.getItemStack("example");
if (this.example == null) {
throw new IllegalArgumentException("No inventory representation (section example) provided for this bullet, it cannot be instanced");
} else {
if (this.example.hasItemMeta()) {
if (this.example.getItemMeta().hasLore()) {
this.exampleLore = this.example.getItemMeta().getLore();
}
ItemMeta meta = this.example.getItemMeta();
meta.setUnbreakable(true);
this.example.setItemMeta(meta);
}
}
if (config.contains("bullets")) {
ConfigurationSection bullets = config.getConfigurationSection("bullets");
for (String bulletName : bullets.getKeys(false)) {
if (AddGun.getPlugin().getAmmo().getBullet(bulletName) == null) {
AddGun.getPlugin().warning("Could not find bullet " + bulletName + " for magazine " + this.name);
} else {
this.allowedBullets.add(bulletName);
this.allowsRounds.put(bulletName, bullets.getInt(bulletName, 1));
}
}
}
if (allowedBullets.isEmpty()) {
throw new IllegalArgumentException("No bullets defined for this magazine? We cannot proceed");
}
Map<String, Object> magazineData = new HashMap<String, Object>();
magazineData.put("rounds", Integer.valueOf(0));
this.example = updateMagazineData(this.example, magazineData);
}
示例13: ClassedItem
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
protected ClassedItem(ConfigurationSection config, String texture) {
super(texture);
this.level = config.getInt("level", -1);
this.classes = config.contains("classes") ? config.getStringList("classes") : null;
}
示例14: start
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public void start(ConfigurationSection section) {
HashMap<String, LiteEntry<MessageManager,YamlConfiguration>> menusList = new HashMap<String, LiteEntry<MessageManager,YamlConfiguration>>();
for(VanillaPlusExtension extension : toLoad){
for(Entry<String, YamlConfiguration>c : loadMenus(new File(extension.getInstance().getDataFolder(),"Menu")).entrySet()){
if(menusList.containsKey(c.getKey())){
ErrorLogger.addError("Menu " + c.getKey() + " already exist !");
}else{
menusList.put(c.getKey(), new LiteEntry<MessageManager, YamlConfiguration>(extension.getMessageManager(), c.getValue()));
}
}
}
toInit = new HashMap<String, MediumEntry<MessageManager, Menu, ConfigurationSection>>();
for (Entry<String, LiteEntry<MessageManager, YamlConfiguration>> entry : menusList.entrySet()) {
if(entry.getKey() == null || entry.getKey() == null || entry.getKey().isEmpty())
continue;
ErrorLogger.addPrefix(entry.getKey() + ".yml");
Menu menu = create(entry.getValue().getValue().getString(Node.TYPE.get(), Node.BASE.get()), entry.getValue().getKey(),
entry.getValue().getValue());
ErrorLogger.removePrefix();
if(menu == null)
continue;
register(entry.getKey(), menu, true);
toInit.put(entry.getKey()+".yml", new MediumEntry<MessageManager, Menu, ConfigurationSection>(entry.getValue().getKey(),
menu, entry.getValue().getValue()));
}
Bukkit.getServer().getPluginManager().registerEvents(this, VanillaPlus.getInstance());
Bukkit.getScheduler().scheduleSyncRepeatingTask(VanillaPlus.getInstance(), new Runnable() {
private byte elapsedTenths;
@Override
public void run() {
for (VPPlayer player : VanillaPlusCore.getPlayerManager().getOnlinePlayers()) {
if(defaultMenu != null){
if (defaultMenu.getRefresh() > 0)
if (elapsedTenths % defaultMenu.getRefresh() == 0)
defaultMenu.refresh(player, player.getPlayer().getInventory());
}
InventoryView view = player.getPlayer().getOpenInventory();
if (view == null) {
return;
}
Inventory topInventory = view.getTopInventory();
if (topInventory.getHolder() instanceof MenuLink) {
MenuLink menuHolder = (MenuLink) topInventory.getHolder();
if (menuHolder.getIconMenu() instanceof Menu) {
Menu extMenu = (Menu) menuHolder.getIconMenu();
if (extMenu.getRefresh() > 0) {
if (elapsedTenths % extMenu.getRefresh() == 0) {
extMenu.refresh(player, topInventory);
}
}
}
}
}
elapsedTenths++;
if(elapsedTenths > 30)
elapsedTenths = 1;
}
}, 1, 20);
anti_click_spam_delay = section.getInt(Node.DELAY.get(), 1000);
if(section.contains("PLAYER_MENU")){
ErrorLogger.addPrefix("PLAYER_MENU");
defaultMenu = get(section.getString("PLAYER_MENU"), true);
if(defaultMenu != null){
if(defaultMenu.getSize()!=36)
ErrorLogger.addError("Invalid size must be 36");
}
ErrorLogger.removePrefix();
}
}
示例15: IconExtended
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public IconExtended(ConfigurationSection section, MessageManager messageManager) {
super(section, messageManager);
if(section.contains(Node.NO_VIEW_ICON.get())){
ErrorLogger.addPrefix(Node.NO_VIEW_ICON.get());
noViewIcon = VanillaPlusCore.getIconManager().create(messageManager, section.getConfigurationSection(Node.NO_VIEW_ICON.get()));
ErrorLogger.removePrefix();
}
actions = new HashMap<ClickType, CommandPlus>();
if(section.contains(Node.COMMAND.get())){
ErrorLogger.addPrefix(Node.COMMAND.get());
ConfigurationSection commands = section.getConfigurationSection(Node.COMMAND.get());
for(String key : commands.getKeys(false)){
ErrorLogger.addPrefix(key);
ConfigurationSection command = commands.getConfigurationSection(key);
ClickType type = ClickType.valueOf(key);
if(type == null || command == null){
Error.INVALID.add();
}else{
String commandType = command.getString(Node.TYPE.get());
if(commandType == null || commandType.isEmpty()){
Error.MISSING_NODE.add(Node.TYPE.get());
}else{
CommandPlus sub = VanillaPlusCore.getCommandManager().create(commandType, command, messageManager);
if(sub != null)
actions.put(type, sub);
}
}
ErrorLogger.removePrefix();
}
ErrorLogger.removePrefix();
}
Object requirement = section.get(Node.VIEW_REQUIREMENT.get());
if(requirement!=null){
ErrorLogger.addPrefix(Node.VIEW_REQUIREMENT.get());
this.viewRequirement = new Requirement(requirement, messageManager.getComponentManager());
ErrorLogger.removePrefix();
}
requirement = section.get(Node.REQUIREMENT.get());
if(requirement!=null){
ErrorLogger.addPrefix(Node.REQUIREMENT.get());
this.requirement = new Requirement(requirement, messageManager.getComponentManager());
ErrorLogger.removePrefix();
}
this.showRequirement = requirement == null ? false : section.getBoolean("SHOW_REQUIREMENT", false);
ConfigurationSection reward = section.getConfigurationSection(Node.REWARD.get());
if(reward!=null){
ErrorLogger.addPrefix(Node.REWARD.get());
this.reward = new Reward(reward, messageManager.getComponentManager());
ErrorLogger.removePrefix();
}
this.rewardMessage = reward == null ? null : messageManager.getComponentManager().get(section.getString("REWARD_MESSAGE"));
this.showReward = reward == null ? false : section.getBoolean("SHOW_REWARD", false);
random = section.getInt("RANDOM", 0);
if(random < 0 ){
ErrorLogger.addError("RANDOM " + random + Error.INVALID.getMessage());
random = 0;
}
if(showRequirement || showReward)
isStatic = false;
noRequirement = messageManager.get(section.getString(Node.NO_REQUIREMENT.get()));
}