Bukkit - How can I differentiate from the Console?
Posted: Thu Mar 29, 2012 8:54 am
I noticed on the plugin tutorial page (on bukkit) that to make sure that a command is or isn't sent by the console, you just check to see if it is/isn't an instance of a Player. Makes enough sense to me, but while I was working on my plugin, I didn't want the console to be able to use the command to view it's own IP, and I tried to use the "sender instanceof Player", but it still ignored it, as in, the console and players were still able to use the command as if the console was emulating a Player instance. So as a temporary fix, I just had it check if the getName() is "Console" (since as to date, I don't believe any player has registered with the name "Console", surprisingly enough. Of course this isn't intended to be a permanent fix, so how can I go about doing this in a better fashion? Thank in advance!