Add ItemMeta factory and interfaces. This adds BUKKIT-15

Included with ItemMeta is a new serializable class Color.

PotionEffects are now serializable.
This commit is contained in:
Wesley Wolfe
2012-12-17 01:16:28 -06:00
parent a7bd98960a
commit a06f7b1b86
25 changed files with 1656 additions and 189 deletions

View File

@@ -1,16 +1,19 @@
package org.bukkit.configuration;
import static org.bukkit.util.NumberConversions.*;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.Validate;
import org.bukkit.Color;
import org.bukkit.OfflinePlayer;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import static org.bukkit.util.NumberConversions.*;
/**
* A type of {@link ConfigurationSection} that is stored in memory.
@@ -653,6 +656,21 @@ public class MemorySection implements ConfigurationSection {
return val instanceof ItemStack;
}
public Color getColor(String path) {
Object def = getDefault(path);
return getColor(path, (def instanceof Color) ? (Color) def : null);
}
public Color getColor(String path, Color def) {
Object val = get(path, def);
return (val instanceof Color) ? (Color) val : def;
}
public boolean isColor(String path) {
Object val = get(path);
return val instanceof Color;
}
public ConfigurationSection getConfigurationSection(String path) {
Object val = get(path, null);
if (val != null) {