Making a /back cooldown plugin

Discussion in 'Plugin Development' started by Godbrandont, Jun 7, 2014.

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

    Godbrandont

    Hello, I am using the plugin essentials on my server and I am trying to make a plugin in which creates a cooldown for the command /back. However I'm not too sure if I could just use "if(cmd.getName().equalsIgnoreCase("back"))" without it interefering with the essentials and potentially throwing errors. I just want to confirm if I could use this and if it would work fine or not. Thanks.
     
  2. Offline

    klosjaarrr

    This will probably not work since you're overriding the existing command in Essentials. Others may correct me.
     
  3. Offline

    Godbrandont

    Yeah that's what I'm not sure about, if that is the case, is there any alternative methods?
     
  4. Offline

    _feedDz

    klosjaarrr The only way i can think of making this work is either tying into essentials with vault or creating your own /back command and disable the /back command in essentials. but even so i'm not sure if vault will allow you to tie into the /back command
     
  5. Offline

    Godbrandont

    I'm sure there is a method as I know a previous server I was associated with had developed one.
     
  6. Offline

    klosjaarrr


    Well, there is an option in Essentials to have a cooldown on teleportation (including /back), so that might solve your problem. If you only want it for the back command, you should hook into Essentials by either using Vault or looking for an API for Essentials, if there even is one.

    Code:
    # The delay, in seconds, required between /home, /tp, etc.
    teleport-cooldown: 5
     
    # The delay, in seconds, before a user actually teleports.  If the user moves or gets attacked in this timeframe, the teleport never occurs.
    teleport-delay: 5
     
  7. Offline

    Godbrandont

    That doesn't apply for /back.
     
  8. Offline

    klosjaarrr


    Really? I'm pretty sure I have it setup on my server to work this way, need to take a look at it then :p
     
  9. Offline

    Gater12

    Godbrandont
    You can try to intercept it by PlayerCommandPreProcessEvent and add your cooldown logic there.
     
Thread Status:
Not open for further replies.

Share This Page