本文整理汇总了Java中com.dsh105.echopet.compat.api.config.ConfigOptions类的典型用法代码示例。如果您正苦于以下问题:Java ConfigOptions类的具体用法?Java ConfigOptions怎么用?Java ConfigOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigOptions类属于com.dsh105.echopet.compat.api.config包,在下文中一共展示了ConfigOptions类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSelectorItem
import com.dsh105.echopet.compat.api.config.ConfigOptions; //导入依赖的package包/类
public static ItemStack getSelectorItem() {
if(selectorItem != null) return selectorItem;
YAMLConfig config = ConfigOptions.instance.getConfig();
String name = config.getString("petSelector.item.name", "&aPets");
String material = config.getString("petSelector.item.material", Material.BONE.name());
int materialData = config.getInt("petSelector.item.materialData", 0);
List<String> lore = config.config().getStringList("petSelector.item.lore");
if (lore == null) {
lore = new ArrayList<String>();
}
ItemStack i = new ItemStack(Material.valueOf(material), 1, (short) materialData);
ItemMeta meta = i.getItemMeta();
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
ArrayList<String> loreList = new ArrayList<String>();
if (lore.size() > 0) {
for (String s : lore) {
loreList.add(ChatColor.translateAlternateColorCodes('&', s));
}
}
if (!loreList.isEmpty()) {
meta.setLore(loreList);
}
i.setItemMeta(meta);
selectorItem = i;
return i;
}
示例2: getSelectorItem
import com.dsh105.echopet.compat.api.config.ConfigOptions; //导入依赖的package包/类
public static ItemStack getSelectorItem() {
YAMLConfig config = ConfigOptions.instance.getConfig();
String name = config.getString("petSelector.item.name", "&aPets");
int materialId = config.getInt("petSelector.item.materialId", Material.BONE.getId());
int materialData = config.getInt("petSelector.item.materialData", 0);
List<String> lore = config.config().getStringList("petSelector.item.lore");
if (lore == null) {
lore = new ArrayList<String>();
}
ItemStack i = new ItemStack(materialId, 1, (short) materialData);
ItemMeta meta = i.getItemMeta();
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
ArrayList<String> loreList = new ArrayList<String>();
if (lore.size() > 0) {
for (String s : lore) {
loreList.add(ChatColor.translateAlternateColorCodes('&', s));
}
}
if (!loreList.isEmpty()) {
meta.setLore(loreList);
}
i.setItemMeta(meta);
return i;
}
示例3: onDropItem
import com.dsh105.echopet.compat.api.config.ConfigOptions; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onDropItem(PlayerDropItemEvent event) {
if (event.getItemDrop().getItemStack().isSimilar(SelectorLayout.getSelectorItem()) && !(ConfigOptions.instance.getConfig().getBoolean("petSelector.allowDrop", true))) {
event.setCancelled(true);
event.getPlayer().updateInventory();
}
}
示例4: allow
import com.dsh105.echopet.compat.api.config.ConfigOptions; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static boolean allow(String input, IPet pet){
YAMLConfig config = ConfigOptions.instance.getConfig();
String nameToCheck = ChatColor.stripColor(input);
ConfigurationSection cs = config.getConfigurationSection("petNames");
if (cs != null) {
for (String key : cs.getKeys(false)) {
if (key.equalsIgnoreCase(nameToCheck)) {
String value = config.getString("petNames." + key);
return pet.getOwner().hasPermission("echopet.pet.name.override") || !(value.equalsIgnoreCase("deny") || value.equalsIgnoreCase("false"));
}
}
}
if (config.getBoolean("petNamesRegexMatching")) {
List<Map<String, String>> csRegex = (List<Map<String, String>>) config.get("petNamesRegex");
if (!csRegex.isEmpty()) {
for (Map<String, String> regexMap : csRegex) {
for (Map.Entry<String, String> entry : regexMap.entrySet()) {
if (nameToCheck.matches(entry.getKey())) {
return pet.getOwner().hasPermission("echopet.pet.name.override")
|| !(entry.getValue().equalsIgnoreCase("deny")
|| entry.getValue().equalsIgnoreCase("false"));
}
}
}
}
}
return true;
}
示例5: getLoadedLayout
import com.dsh105.echopet.compat.api.config.ConfigOptions; //导入依赖的package包/类
public static Map<Integer, Map<Integer, SelectorIcon>> getLoadedLayout(){
Map<Integer, Map<Integer, SelectorIcon>> layout = new HashMap<>();
for (SelectorIcon icon : selectorLayout) {
if (!ConfigOptions.instance.getConfig().getBoolean("petSelector.showDisabledPets", true) && icon.getPetType() != null) {
if (!ConfigOptions.instance.allowPetType(icon.getPetType())) {
continue;
}
}
Map<Integer, SelectorIcon> page = layout.get(icon.getPage());
if(page == null) page = new HashMap<>();
page.put(icon.getSlot(), icon);
layout.put(icon.getPage(), page);
}
return layout;
}
示例6: allow
import com.dsh105.echopet.compat.api.config.ConfigOptions; //导入依赖的package包/类
public static boolean allow(String input, IPet pet) {
YAMLConfig config = ConfigOptions.instance.getConfig();
String nameToCheck = ChatColor.stripColor(input);
ConfigurationSection cs = config.getConfigurationSection("petNames");
if (cs != null) {
for (String key : cs.getKeys(false)) {
if (key.equalsIgnoreCase(nameToCheck)) {
String value = config.getString("petNames." + key);
return pet.getOwner().hasPermission("echopet.pet.name.override") || !(value.equalsIgnoreCase("deny") || value.equalsIgnoreCase("false"));
}
}
}
if (config.getBoolean("petNamesRegexMatching")) {
List<Map<String, String>> csRegex = (List<Map<String, String>>) config.get("petNamesRegex");
if (!csRegex.isEmpty()) {
for (Map<String, String> regexMap : csRegex) {
for (Map.Entry<String, String> entry : regexMap.entrySet()) {
if (nameToCheck.matches(entry.getKey())) {
return pet.getOwner().hasPermission("echopet.pet.name.override")
|| !(entry.getValue().equalsIgnoreCase("deny")
|| entry.getValue().equalsIgnoreCase("false"));
}
}
}
}
}
return true;
}
示例7: loadLayout
import com.dsh105.echopet.compat.api.config.ConfigOptions; //导入依赖的package包/类
public static void loadLayout() {
if (selectorMenu != null) {
HandlerList.unregisterAll(selectorMenu);
}
selectorLayout.clear();
YAMLConfig config = ConfigOptions.instance.getConfig();
String s = "petSelector.menu";
int size = config.getInt(s + ".slots");
for (int i = 1; i <= size; i++) {
String cmd = config.getString(s + ".slot-" + i + ".command");
String petType = config.getString(s + ".slot-" + i + ".petType");
PetType pt = null;
if (petType != null && GeneralUtil.isEnumType(PetType.class, petType.toUpperCase())) {
pt = PetType.valueOf(petType.toUpperCase());
}
int id = config.getInt(s + ".slot-" + i + ".materialId");
int data = config.getInt(s + ".slot-" + i + ".materialData");
String name = config.getString(s + ".slot-" + i + ".name");
if (name == null) {
continue;
}
List<String> lore = config.config().getStringList(s + ".slot-" + i + ".lore");
if (lore == null) {
lore = new ArrayList<String>();
}
ArrayList<String> loreList = new ArrayList<String>();
if (lore.size() > 0) {
for (String part : lore) {
loreList.add(ChatColor.translateAlternateColorCodes('&', part));
}
}
Material type = Material.getMaterial(id);
selectorLayout.add(new SelectorIcon(i - 1, cmd, pt, ItemData.create(type, data).withDisplayName(name.trim().isEmpty() ? Optional.empty() : Optional.of(name)).withLore(loreList)));
}
selectorMenu = new SelectorMenu();
}
示例8: getLoadedLayout
import com.dsh105.echopet.compat.api.config.ConfigOptions; //导入依赖的package包/类
public static HashMap<Integer, SelectorIcon> getLoadedLayout() {
HashMap<Integer, SelectorIcon> layout = new HashMap<Integer, SelectorIcon>();
for (SelectorIcon icon : selectorLayout) {
if (!ConfigOptions.instance.getConfig().getBoolean("petSelector.showDisabledPets", true) && icon.getPetType() != null) {
if (!ConfigOptions.instance.allowPetType(icon.getPetType())) {
continue;
}
}
layout.put(icon.getSlot(), icon);
}
return layout;
}
示例9: getOptions
import com.dsh105.echopet.compat.api.config.ConfigOptions; //导入依赖的package包/类
@Override
public ConfigOptions getOptions() {
return OPTIONS;
}
示例10: getOptions
import com.dsh105.echopet.compat.api.config.ConfigOptions; //导入依赖的package包/类
public static ConfigOptions getOptions() {
return PLUGIN.getOptions();
}
示例11: SelectorMenu
import com.dsh105.echopet.compat.api.config.ConfigOptions; //导入依赖的package包/类
SelectorMenu() {
super(ConfigOptions.instance.getConfig().getString("petSelector.menu.title", "Pets"), ConfigOptions.instance.getConfig().getInt("petSelector.menu.slots", 45));
for (Map.Entry<Integer, SelectorIcon> entry : SelectorLayout.getLoadedLayout().entrySet()) {
this.setSlot(entry.getKey(), entry.getValue());
}
}
示例12: getOptions
import com.dsh105.echopet.compat.api.config.ConfigOptions; //导入依赖的package包/类
public ConfigOptions getOptions();