Help, old Events? How to update?

Discussion in 'Plugin Development' started by gjossep, Mar 12, 2012.

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

    gjossep

    Hey guys
    How can i update this part of the code, I just started plugin making again.

    PHP:
     pm.registerEvent(Event.Type.PLAYER_JOINthis.playerListenerEvent.Priority.Normalthis);
    /* 126 */    pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESSthis.playerListenerEvent.Priority.Normalthis);
    /* 127 */    pm.registerEvent(Event.Type.PLAYER_QUITthis.playerListenerEvent.Priority.Normalthis);
    /* 128 */    pm.registerEvent(Event.Type.PLAYER_MOVEthis.playerListenerEvent.Priority.Normalthis);
    /* 129 */    pm.registerEvent(Event.Type.PLAYER_INTERACTthis.playerListenerEvent.Priority.Normalthis);
    /* 130 */    pm.registerEvent(Event.Type.PLAYER_DROP_ITEMthis.playerListenerEvent.Priority.Normalthis);
    /* 131 */    pm.registerEvent(Event.Type.PLAYER_PICKUP_ITEMthis.playerListenerEvent.Priority.Normalthis);
    /* 132 */    pm.registerEvent(Event.Type.PLAYER_CHATthis.playerListenerEvent.Priority.Normalthis);
    /* 133 */    pm.registerEvent(Event.Type.PLAYER_INTERACT_ENTITYthis.playerListenerEvent.Priority.Normalthis);
    /* 134 */    pm.registerEvent(Event.Type.ENTITY_DAMAGEthis.entityListenerEvent.Priority.Normalthis);
    Thanks
    Gjosse
     
  2. Offline

    Sorroko

  3. Offline

    gjossep

  4. Offline

    Sorroko

    gjossep *grunt*
    Code:
    PluginManager pm = getServer().getPluginManager();
    pm.registerEvents(new TestListener(this), this);
    and listener class..
    Code:
    public class TestListener implements Listener {
     
        MyPlugin plugin;
        public TestListener(MyPlugin instance){
            plugin = instance;
        }
    }
    EDIT: Forgot semi colon :p
     
    SgtStud likes this.
  5. Offline

    SirTyler

    Having code done for you isn't how you learn.
     
  6. Offline

    gus

    amen to that...
     
  7. Offline

    Jozeth

    Technically it is, but...
     
  8. Offline

    theguynextdoor

    No, having code done for you isnt how you learn. Having code EXPLAINED to you is how you learn. If i wrote you a whole RPG plugin (for example), would you be able to go off and make you own?, probably not. But, if i explained how sections of it worked, like if i explained how the leveling worked or how the skills worked, then you would be able to apply the knowledge of what i explained to you and put that into your plugin. And then there is the bit about how it's explained and how well it's explained. I could explain the whole plugin by just talking to you, or i could write it down, i could get you to write it down as i speak. But just me giving you the whole code and saying that's how you do it won't help you learn.

    It helps to have something explained, people don't learn from being spoon fed code. Dont think of this as an attack, think of this as a moral. If someone helps you, make sure you understand what they have done, why they have done it, and if you don't understand why, then ask. That is how you learn.
     
  9. Offline

    Insers

    Do i created it correctly?
    [​IMG]
     
Thread Status:
Not open for further replies.

Share This Page