[HELP!] Creating my first plugin.

Discussion in 'Plugin Development' started by Hades1152, Apr 30, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Hades1152

    Okay, I'm very new to java and wish to start out by making a simple plugin, I've read a few tutorials and I understand some of the basics, if you feel that jumping into making a simple plugin is too advanced for a beginner, please tell me.

    Anyway, my idea for a simple plugin is called 'Instant Wheat' so basically when seeds are planted, they skip all stages apart from the first and last; so when planted, the seeds will grow then straight after they are supposed to reach stage 2, they are ready to be reaped.

    Code:
     package org.bukkit;
    
    
    import java.util.HashMap;
    import java.util.Map;
    
    
    public enum CropState {
        SEEDED((byte) 0x0),
        GERMINATED((byte) 0x1),
        VERY_SMALL((byte) 0x2),
        SMALL((byte) 0x3),
        MEDIUM((byte) 0x4),
        TALL((byte) 0x5),
        VERY_TALL((byte) 0x6),
        RIPE((byte) 0x7);
        private final byte data;
        private final static Map<Byte, CropState> states = new HashMap<Byte, CropState>();
        private CropState(final byte data) {
            this.data = data;
        }
        public byte getData() {
            return data;
        }
        public static CropState getByData(final byte data) {
            return states.get(data);
        }
        static {
            for (CropState s : CropState.values()) {
                states.put(s.getData(), s);
            }
        }
    }
    Is this the code I need? Could someone give me some sort of push in the right direction?

    Any help would be much appreciated.
     
Thread Status:
Not open for further replies.

Share This Page