本文整理汇总了Java中org.bukkit.configuration.ConfigurationSection.get方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationSection.get方法的具体用法?Java ConfigurationSection.get怎么用?Java ConfigurationSection.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.configuration.ConfigurationSection
的用法示例。
在下文中一共展示了ConfigurationSection.get方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initPost
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public void initPost(ConfigurationSection section, MComponentManager manager) {
Object requirement = section.get(Node.REQUIREMENT.get());
ErrorLogger.addPrefix(Node.REQUIREMENT.get());
if(requirement!=null){
this.requirement = new Requirement(requirement, manager);
}else if (warn){
ErrorLogger.addError("Free Achievement should be avoided !");
warn = false;
}
ErrorLogger.removePrefix();
ErrorLogger.addPrefix(Node.REWARD.get());
ConfigurationSection reward = section.getConfigurationSection(Node.REWARD.get());
if(reward!=null)
this.reward = new Reward(reward, manager);
ErrorLogger.removePrefix();
}
示例2: addMeta
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public static ItemStack addMeta(ConfigurationSection section, ItemStack item){
NBTItem nbtItem = new NBTItem(item);
for(String key : section.getKeys(false)){
Object value = section.get(key);
if(value instanceof Integer){
nbtItem.setInteger(key, (int)value);
}else if(value instanceof Double){
nbtItem.setDouble(key, (double)value);
}else if(value instanceof Boolean){
nbtItem.setBoolean(key, (boolean)value);
}else if(value instanceof String){
nbtItem.setString(key, (String)value);
}else if(value instanceof ConfigurationSection) {
NBTCompound compound = nbtItem.getCompound(key);
if(compound == null)
compound = nbtItem.addCompound(key);
applyCompound((ConfigurationSection) value, compound);
}
}
return nbtItem.getItem();
}
示例3: applyCompound
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public static void applyCompound(ConfigurationSection section, NBTCompound nbtCompound){
for(String key : section.getKeys(false)){
Object value = section.get(key);
if(value instanceof Integer){
nbtCompound.setInteger(key, (int)value);
}else if(value instanceof Double){
nbtCompound.setDouble(key, (double)value);
}else if(value instanceof Boolean){
nbtCompound.setBoolean(key, (boolean)value);
}else if(value instanceof String){
nbtCompound.setString(key, (String)value);
}else if(value instanceof ConfigurationSection) {
NBTCompound compound = nbtCompound.getCompound(key);
if(compound == null)
compound = nbtCompound.addCompound(key);
applyCompound((ConfigurationSection) value, compound);
}
}
}
示例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: CPGamemode
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public CPGamemode(ConfigurationSection section, MessageManager manager, String name){
super(section, manager, name);
ErrorLogger.addPrefix("GAMEMODE");
Object o = section.get("GAMEMODE");
if(o instanceof Integer){
gm = GameMode.getByValue((int) o);
if(gm == null){
Error.INVALID.add();
}
}else if(o instanceof String){
gm = GameMode.valueOf((String) o);
if(gm == null){
Error.INVALID.add();
}
}else {
gm = GameMode.SURVIVAL;
Error.INVALID.add();
}
ErrorLogger.removePrefix();
}
示例6: 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()));
}
示例7: CPOp
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public CPOp(ConfigurationSection section, MessageManager manager, String name){
super(section, manager, name);
Object opCmd = section.get("OP");
if(opCmd instanceof String){
cmd = (String) opCmd;
}else if(opCmd instanceof ConfigurationSection){
command = VanillaPlusCore.getCommandManager().create(((ConfigurationSection) opCmd).getString(Node.TYPE.get(), Node.NODE.get()), opCmd);
}else
Error.INVALID.add();
}
示例8: CPMessageSend
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public CPMessageSend(ConfigurationSection section, MessageManager manager, String name){
super(section, manager, name);
message = manager.get(section.getString(Node.MESSAGE.get()));
all = section.getBoolean("ALL", false);
priv = section.getBoolean("PRIVATE", false);
other = new Requirement(section.get(Node.OTHER_REQUIREMENT.get()), manager.getComponentManager());
successOther = manager.get(section.getString(Node.SUCCESS.getOther()));
}
示例9: CPOther
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public CPOther(ConfigurationSection section, MessageManager manager, String name){
super(section, manager, name);
this.otherRequirement = new Requirement(section.get(Node.REQUIREMENT.getOther()), manager.getComponentManager());
this.alreadyOther = manager.get(section.getString(Node.ALREADY.getOther()));
this.alreadyTo = manager.get(section.getString(Node.ALREADY.get()+"_TO"));
this.successOther = manager.get(section.getString(Node.SUCCESS.getOther()));
this.successTo = manager.get(section.getString(Node.SUCCESS.get()+"_TO"));
}
示例10: CPNick
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public CPNick(ConfigurationSection section, MessageManager manager, String name){
super(section, manager, name);
reset = manager.get(section.getString("RESET"));
resetOther = manager.get(section.getString("RESET_OTHER"));
resetTo = manager.get(section.getString("RESET_TO"));
allowColor = new Requirement(section.get("COLOR"), manager.getComponentManager());
allowCustomChar = new Requirement(section.get("CUSTOM_CHAR"), manager.getComponentManager());
prefix = section.getString("PREFIX", "");
argumentRequired = 1;
}
示例11: 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()));
}
示例12: init
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public void init(VanillaPlusCore core) {
if(core == null)return;
YamlConfiguration section = ConfigUtils.getYaml(core.getInstance(), "Title", false);
if(section == null)return;
ErrorLogger.addPrefix("Title.yml");
ErrorLogger.addPrefix(Node.SETTINGS.get());
ConfigurationSection settings = section.getConfigurationSection(Node.SETTINGS.get());
if(settings==null){
Error.MISSING_NODE.add(Node.SETTINGS.get());
adminUse = new Requirement("", core.getMessageCManager());
use = new Requirement("", core.getMessageCManager());
adminSwitch = new Requirement("", core.getMessageCManager());
startDataBase(VanillaPlusCore.getIConnectionManager().get(null));
}else{
this.adminUse = new Requirement(settings.get("ADMIN_USE"), core.getMessageCManager());
this.use = new Requirement(settings.get("USE"), core.getMessageCManager());
this.adminSwitch = new Requirement(settings.get("SWITCH"), core.getMessageCManager());
ConfigurationSection current = settings.getConfigurationSection("CURRENT");
ErrorLogger.addPrefix("CURRENT");
if(current != null){
this.current = VanillaPlusCore.getIconManager().create(core.getMessageManager(), current);
}else{
Error.INVALID.add();
}
ErrorLogger.removePrefix();
ConfigurationSection owned = settings.getConfigurationSection(Node.OWNED.get());
ErrorLogger.addPrefix(Node.OWNED.get());
if(owned != null){
this.owned = VanillaPlusCore.getIconManager().create(core.getMessageManager(), owned);
}else{
Error.INVALID.add();
}
ErrorLogger.removePrefix();
ConfigurationSection unOwned = settings.getConfigurationSection(Node.UNOWNED.get());
ErrorLogger.addPrefix(Node.UNOWNED.get());
if(unOwned != null){
this.unOwned = VanillaPlusCore.getIconManager().create(core.getMessageManager(), unOwned);
}else{
Error.INVALID.add();
}
ErrorLogger.removePrefix();
this.unlock = core.getMessageManager().get(settings.getString("UNLOCK"));
this.prefix = settings.getString(Node.PREFIX.get(), "VPPlayer_");
startDataBase(VanillaPlusCore.getIConnectionManager().get(settings.getString("STORAGE")));
}
ErrorLogger.removePrefix();
ErrorLogger.removePrefix();
}
示例13: CPReward
import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public CPReward(ConfigurationSection section, MessageManager manager, String name){
super(section, manager, name);
reward = new Reward(section.get(Node.REWARD.get()), manager.getComponentManager());
amount = new Requirement(Node.AMOUNT.get(), manager.getComponentManager());
}