How do I...

Discussion in 'Plugin Development' started by Lilyflame2121, Aug 28, 2015.

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

    Lilyflame2121

    Hey guys it's Lily here!
    I have one simple (or some-what) question for you guys! How do I make my code or what's the code, for me to change a command. Let's say this... The command is /cast, how to I make it so /cast (SPELL) is a different command such as /poop (SPELL) instead of /cast (SPELL), but it does /cast (SPELL).

    So /poop does a /cast command but if you do /cast it won't work. Thanks for the help if you would ;P
     
  2. Offline

    au2001

    @Lilyflame2121 If you can't edit the plugin.yml, or if you want the command to be configurable in the config (like Buycraft for exemple), you'll have to use a PlayerCommandPreprocessEvent.

    Btw, not very good example...
     
    Last edited: Aug 28, 2015
  3. Offline

    Lilyflame2121

    Well basically block the command /cast
    Make it a different command like /poop
    When you do /poop it does what cast would do
     
  4. Offline

    au2001

    @Lilyflame2121 I did understand what you're trying to do, I was just saying you could have chosen another name than "/poop".
     
  5. Offline

    SuperSniper

    PlayerPreprocessCommandEvent
    Check the command for "poop"
    player.preformCommand("cast");
     
  6. Offline

    Lilyflame2121

    But how would I make it so when they do /poop, it does a spell cast, but the command /cast would be blocked.

    Also poop is just a random example
     
  7. Offline

    au2001

    @SuperSniper He wants it the other way: /poop -> /cast

    And that wouldn't work because the /cast command would still work in your code.

    @Lilyflame2121 You have to put your onCommand code in the PlayerPreprocessCommandEvent, after checking the command label.
     
  8. Offline

    SuperSniper

    @au2001 That's what I did, if the command is "poop", the player is forced to run "cast"
     
  9. Offline

    Lilyflame2121

    Alright, I'll some-what figure it out :p
     
  10. Offline

    au2001

    @SuperSniper You just edited your post :mad:

    And if the player types /cast in the chat, it'll work. The OP want's it not to work.
     
  11. Do what the above posts said and remove the cast permission from each player
     
Thread Status:
Not open for further replies.

Share This Page