cmd.getName() or label?

Discussion in 'Plugin Development' started by DaveLillo, Jan 31, 2015.

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


    What's the difference between those 2? When should i use cmd.getName().equalsIgnoreCase and when label.equalsIgnoreCase() ?
  2. Offline


    You should pretty much always use cmd.getName() because thats the actual name of the command that the user executed. The command could have a bunch of different aliases and label will be the alias they used. So if you want to check what alias they used you could use label.equalsIgnoreCase().
    For example a command could have the name teleport and a whole bunch of aliases: tp, tpplease, tpto, teleportto. cmd.getName() would always return "teleport" and the label would return one of those.
    Last edited: Jan 31, 2015
    DaveLillo likes this.
Thread Status:
Not open for further replies.

Share This Page