@@ -0,0 +1,2290 @@
+package org.bukkit;%0A%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0A/**%0A * Replacement class for org.bukkit.Material enum from Bukkit%0A */%0Apublic class Material %7B // 'classes cannot directly extend java.lang.Enum'%0A%0A    // names expected by Bukkit plugins, enum and ordinal (has to match for compiled switch() statements)%0A    private final String bukkitName;%0A    private final int bukkitIndex;%0A%0A    private Material(String bukkitName, int bukkitIndex) %7B%0A        this.bukkitName = bukkitName;%0A        this.bukkitIndex = bukkitIndex;%0A%0A        if (Material.name2id.containsKey(bukkitName)) %7B%0A            throw new RuntimeException(%22duplicate material registration, name=%22+bukkitName+%22, index=%22+bukkitIndex+%22 already exists at index=%22+name2id.get(bukkitName));%0A        %7D%0A%0A        // extend array to fit new materials%0A        // requires copying, see http://www.javadb.com/extend-the-size-of-an-array/%0A        int maxIndex = Math.max(ENUM$VALUES.length - 1, bukkitIndex);%0A        Material newValues%5B%5D = new Material%5BmaxIndex + 1%5D;%0A        System.arraycopy(ENUM$VALUES, 0, newValues, 0, ENUM$VALUES.length);%0A        Material.ENUM$VALUES = newValues;%0A%0A        // save for easy lookup%0A        Material.ENUM$VALUES%5BbukkitIndex%5D = this;%0A        Material.name2id.put(bukkitName, bukkitIndex);%0A    %7D%0A%0A    public int ordinal() %7B%0A        return this.bukkitIndex;%0A    %7D%0A%0A    public String name() %7B%0A        return this.bukkitName;%0A    %7D%0A%0A    public String toString() %7B%0A        return this.bukkitName;%0A    %7D%0A%0A    // array ordinal -%3E Material%0A    public static Material ENUM$VALUES%5B%5D = new Material%5B%5D %7B %7D;%0A%0A    private static Map%3CString, Integer%3E name2id = new HashMap%3CString, Integer%3E();%0A%0A    // well-known materials part of the API - TODO: can we add dynamically in the constructor?%0A    public static Material STONE = new Material(%22STONE%22, 1);%0A    public static Material DIRT = new Material(%22DIRT%22, 3);%0A    public static Material SAND = new Material(%22SAND%22, 12);%0A%0A    public static Material getMaterial(String name) %7B%0A        if (!Material.name2id.containsKey(name)) %7B%0A            return null;%0A        %7D%0A%0A        int id = Material.name2id.get(name);%0A        return Material.ENUM$VALUES%5Bid%5D;%0A    %7D%0A%0A    public static Material%5B%5D values() %7B%0A        return Material.ENUM$VALUES;%0A    %7D%0A%7D%0A

Add the beginning of a non-enum org.bukkit.Material replacement