Java Code Examples for org.bukkit.configuration.file.YamlConfiguration#saveToString()
The following examples show how to use
org.bukkit.configuration.file.YamlConfiguration#saveToString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandTemplate.java From TrMenu with MIT License | 6 votes |
public String toYaml() { YamlConfiguration yaml = new YamlConfiguration(); List<String> shape = Lists.newArrayList(); ListIterator<Character> key = TrUtils.getKeys().listIterator(); for (int i = 0; i < rows; i++) { shape.add(" "); } yaml.set("Title", name); yaml.set("Shape", shape); items.forEach((item, slots) -> { char k = key.next(); slots.forEach(s -> put(shape, s, k)); yaml.set("Buttons." + k + ".display", display(item)); }); return yaml.saveToString(); }
Example 2
Source File: Util.java From QuickShop-Reremake with GNU General Public License v3.0 | 5 votes |
/** * Covert ItemStack to YAML string. * * @param iStack target ItemStack * @return String serialized itemStack */ @NotNull public static String serialize(@NotNull ItemStack iStack) { YamlConfiguration cfg = new YamlConfiguration(); cfg.set("item", iStack); return cfg.saveToString(); }
Example 3
Source File: ItemUtils.java From ProRecipes with GNU General Public License v2.0 | 5 votes |
protected static String nbtString(ItemStack itemStack) { YamlConfiguration config = new YamlConfiguration(); //itemStack.setDurability((short)0); if(itemStack.getType() == Material.AIR){ itemStack.setDurability((short)-1); } config.set("i", itemStack); String ssa = config.saveToString(); Map<String, Object> map = itemStack.serialize(); if(map.containsKey("meta")){ String s = map.get("meta").toString(); if(s.contains("internal")){ String internal = ""; List<String> arr = Arrays.asList(s.split(", ")); for(String t : arr){ if(t.contains("internal")){ internal = t.replace("internal=", "").replace("}", ""); return internal; } } } } return ""; }
Example 4
Source File: BedwarsRel.java From BedwarsRel with GNU General Public License v3.0 | 5 votes |
public String getYamlDump(YamlConfiguration config) { try { String fullstring = config.saveToString(); String endstring = fullstring; endstring = Utils.unescape_perl_string(fullstring); return endstring; } catch (Exception ex) { BedwarsRel.getInstance().getBugsnag().notify(ex); ex.printStackTrace(); } return null; }
Example 5
Source File: TSerializer.java From TabooLib with MIT License | 4 votes |
public static String serializeCS(ConfigurationSerializable o) { YamlConfiguration y = new YamlConfiguration(); y.set("value", o); return y.saveToString(); }
Example 6
Source File: ConfigurationSerializer.java From Skript with GNU General Public License v3.0 | 4 votes |
public static String serializeCS(final ConfigurationSerializable o) { final YamlConfiguration y = new YamlConfiguration(); y.set("value", o); return "" + y.saveToString(); }