Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chests.yaml should allow symbolic names #24

Open
sshipway opened this issue Oct 2, 2016 · 1 comment
Open

chests.yaml should allow symbolic names #24

sshipway opened this issue Oct 2, 2016 · 1 comment

Comments

@sshipway
Copy link
Contributor

sshipway commented Oct 2, 2016

Currently, chest items need to be specified by their object ID. It would be better if it were to allow symbolic names.

Probably the place to do this is in ItemReader.read; if the first item is non-numeric then call matchMaterial()

        try {
            itemid = Integer.parseInt(split[0]);
        } 
        catch( Exception e ) {
            Material m = Material.matchMaterial(split[0].toLowerCase().trim());
            if( m == null ) {
                SurvivalGames.error("ItemReader: invalid id "+split[0]);
                return null;
            }
            itemid = m.getId();
        }
        try {
            if(split.length == 1){
                return new ItemStack(itemid);
            }else if(split.length == 2){
                return new ItemStack(itemid, Integer.parseInt(split[1]));
            }else if(split.length == 3){
                return new ItemStack(itemid, Integer.parseInt(split[1]), Short.parseShort(split[2]));
            }else{
@ThunderGemios10
Copy link
Owner

@sshipway Hmm, Yes it would be better if it allowed symbolic names, I might start working on it if i find enough Free Time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants