diff --git a/itemstackformat.txt b/itemstackformat.txt index 5f2a912c..0ce65c47 100644 --- a/itemstackformat.txt +++ b/itemstackformat.txt @@ -26,6 +26,18 @@ } ... ] + StoredEnchantments: + [ + { + id: int + lvl: int + } + { + id: int + lvl: int + } + ... + ] title: str author: str pages: [str] @@ -41,6 +53,23 @@ } ... ] + Explosion: + { + Flicker: bool + Trail: bool + Colors: [int] + FadeColors: [int] + Type: byte + } + Fireworks: + { + Flight: byte + Explosions: + [ + *Explosion* + ... + ] + } } } @@ -62,6 +91,11 @@ id: lvl ... } + stored-enchants: + { + id: lvl + ... + } repair-cost: int title: str author: str @@ -84,6 +118,28 @@ } ... ] + firework-effect: + { + flicker: bool + trail: bool + colors: + [ + *color* + ... + ] + fade-colors: + [ + *color* + ... + ] + type: "BALL", "BALL_LARGE", "STAR", "BURST" or "CREEPER" + } + firework-effects: + [ + *firework-effect* + ... + ] + power: int } } @@ -103,6 +159,12 @@ id: lvl ... } + stored-enchants: + { + id: lvl + id: lvl + ... + } repaircost: int title: str author: str @@ -120,4 +182,18 @@ } ... ] + firework-effect: + { + flicker: bool + trail: bool + colors: [int ...] + fade-colors: [int ...] + type: str/enum + } + firework-effects: + [ + *firework-effect* + ... + ] + firework-flight: int } \ No newline at end of file diff --git a/src/com/massivecraft/mcore5/adapter/ItemStackAdapterV2.java b/src/com/massivecraft/mcore5/adapter/ItemStackAdapterV2.java index 63d9aa19..3b516a74 100644 --- a/src/com/massivecraft/mcore5/adapter/ItemStackAdapterV2.java +++ b/src/com/massivecraft/mcore5/adapter/ItemStackAdapterV2.java @@ -70,11 +70,13 @@ public class ItemStackAdapterV2 implements JsonDeserializer, JsonSeri public static final String SKULL_OWNER = "skull"; - // TODO rename to potion-effects? - public static final String POTION_EFFECTS = "effects"; + // We renamed "effects" to "potion-effects". + public static final String POTION_EFFECTS_OLD = "effects"; + public static final String POTION_EFFECTS = "potion-effects"; public static final String FIREWORK_EFFECT = "firework-effect"; public static final String FIREWORK_EFFECTS = "firework-effects"; + public static final String FIREWORK_FLIGHT = "firework-flight"; public static final String STORED_ENCHANTS = "stored-enchants"; @@ -85,6 +87,7 @@ public class ItemStackAdapterV2 implements JsonDeserializer, JsonSeri public static final int DEFAULT_ID; public static final int DEFAULT_COUNT; public static final int DEFAULT_DAMAGE; + public static final int DEFAULT_FIREWORK_POWER = 1; static { @@ -504,6 +507,7 @@ public class ItemStackAdapterV2 implements JsonDeserializer, JsonSeri else { JsonElement element = json.get(POTION_EFFECTS); + if (element == null) element = json.get(POTION_EFFECTS_OLD); if (element == null) return; meta.clearCustomEffects(); @@ -557,6 +561,12 @@ public class ItemStackAdapterV2 implements JsonDeserializer, JsonSeri // -------------------------------------------- // public static void transferFireworkMeta(FireworkMeta meta, JsonObject json, boolean meta2json) + { + transferFireworkMetaEffects(meta, json, meta2json); + transferFireworkMetaPower(meta, json, meta2json); + } + + public static void transferFireworkMetaEffects(FireworkMeta meta, JsonObject json, boolean meta2json) { if (meta2json) { @@ -571,6 +581,20 @@ public class ItemStackAdapterV2 implements JsonDeserializer, JsonSeri meta.addEffects(convertFireworkEffectList(element)); } } + + public static void transferFireworkMetaPower(FireworkMeta meta, JsonObject json, boolean meta2json) + { + if (meta2json) + { + json.addProperty(FIREWORK_FLIGHT, meta.getPower()); + } + else + { + JsonElement element = json.get(FIREWORK_FLIGHT); + if (element == null) return; + meta.setPower(element.getAsInt()); + } + } // -------------------------------------------- // // SPECIFIC META: ENCHANTMENT STORAGE diff --git a/src/com/massivecraft/mcore5/cmd/HelpCommand.java b/src/com/massivecraft/mcore5/cmd/HelpCommand.java index 1b349cbd..0b3c1927 100644 --- a/src/com/massivecraft/mcore5/cmd/HelpCommand.java +++ b/src/com/massivecraft/mcore5/cmd/HelpCommand.java @@ -50,9 +50,12 @@ public class HelpCommand extends MCommand return this.commandChain.get(this.commandChain.size()-1).p(); } - private static HelpCommand instance = new HelpCommand(); - public static HelpCommand getInstance() - { - return instance; - } + // -------------------------------------------- // + // INSTANCE + // -------------------------------------------- // + + private static HelpCommand i = new HelpCommand(); + public static HelpCommand getInstance() { return i; } + public static HelpCommand get() { return i; } + } diff --git a/src/com/massivecraft/mcore5/usys/cmd/CmdUsysMultiverseList.java b/src/com/massivecraft/mcore5/usys/cmd/CmdUsysMultiverseList.java index 1257088b..4f2b5242 100644 --- a/src/com/massivecraft/mcore5/usys/cmd/CmdUsysMultiverseList.java +++ b/src/com/massivecraft/mcore5/usys/cmd/CmdUsysMultiverseList.java @@ -36,6 +36,6 @@ public class CmdUsysMultiverseList extends UsysCommand // Send them lines = Txt.parseWrap(lines); - this.sendMessage(Txt.getPage(lines, pageHumanBased, "Multiverse List", sender)); + this.sendMessage(Txt.getPage(lines, pageHumanBased, "Multiverse List", sender)); } }