Solved Proper use for setAliases?

Discussion in 'Plugin Development' started by pookeythekid, Aug 9, 2014.

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

    pookeythekid

    Hey there. I'm a little confused with the setAliases method. When I at first used "getCommand(string).setAliases(List);" (I actually had real values in the method arguments), absolutely nothing happened. I took a look at Bukkit JavaDocs, and they say something about that method not being effective outside of the plugin.yml's aliases. This makes no sense to me, since it's pointless to set the command aliases with code as that happens anyway when you put it in the plugin.yml.

    Is there another way I should be doing this?

    Reply if you would like to see my code.

    Edit: Before you suggest using a PlayerCommandPreprocessEvent to force it to be an alias, I just tried that and it runs smoothly, however I can't press-tab in players for arguments, and I get an unknown-command message.
     
  2. Offline

    xTigerRebornx

    pookeythekid setAliases() will make a call to check if it isn't registered before actually setting the aliases, thus preventing you from using it. You could try using reflection to change it, but I'd like to think that they made it this way because it shouldn't be changed, so test it before throwing it on public servers.
     
  3. Offline

    pookeythekid

    xTigerRebornx Lol I shudder at the thought of releasing an untested plugin. So... this pretty much makes setAliases() absolutely worthless, doesn't it?
     
  4. Offline

    xTigerRebornx

    pookeythekid Its used before the command is actually registered, anywhere else its useless.
     
  5. Offline

    fireblast709

    Time for a PR?
     
  6. Offline

    pookeythekid

    xTigerRebornx Would that mean I should set the aliases before the command's executor is set? If not, when exactly is the command registered? I already have the method set in my onEnable method, but I'll check if it's before I set the executor.
    fireblast709 I'm sorry, PR?
     
  7. Offline

    xTigerRebornx

    pookeythekid It is registered before onEnable() is called. If you want to change aliases, then you should do so in your plugin.yml.
     
  8. Offline

    pookeythekid

    xTigerRebornx Aw, that sucks. The point of my using setAliases is not to have aliases for myself, but rather to have 100% configurable commands. I suppose I'll just put a description on how to edit the plugin.yml of the jar file to create command aliases. That is, if I upload it. It's an economy plugin, and there are already millions of those.

    Btw I'm still under the impression that setAliases is worthless as far as using it in your plugin.
     
  9. Offline

    fireblast709

    pookeythekid pull request. I'm pretty sure a working setAliases shouldn't be too hard to realize :3.
     
Thread Status:
Not open for further replies.

Share This Page