Why does this piece of code only work for OPs, even though its coded not to?

Discussion in 'Plugin Development' started by the_cows, Jul 19, 2014.

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

    the_cows

    For some reason a piece of my code only works with OPs. And this piece of code is probably one of the only ones that is meant to NOT work with OPs.
    My code is at: http://pastebin.com/sQeeXRNN
    Now, the bit that isn't working is the
    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
    if(!event.getWhoClicked().isOp()) {
    //rest of it
    Which as the if(!event.getWhoClicked().isOp()) { is clearly stating as only working for people who aren't Op. I have tried without the if statement and it still only works for OPs. Any ideas?
    Thanks, Jay
     
  2. Offline

    rippin

    Have you tried a debug message? Because this code looks correct.
     
  3. Offline

    Gerov

    That all looks fine o.o
     
  4. Offline

    the_cows

    I know, it's odd.

    As I said, with a permission - still only OPs. With no if statment - still just OPs. Idk why this would happen.

    Edit: by with a permission I mean event.getPlayer().hasPermission(). If I use hasPermission() do I need to add it to plugin.yml even though it's not a command?
     
  5. Offline

    MCForger

    the_cows
    Sorry, but the platform (BungeeCord) is not supported here. I recommend going to the BungeeCord forums and asking your question.
     
  6. Offline

    jimuskin

    the_cows Try debugging the code.
    Are you sure you're OP?
     
  7. Offline

    Yukari

    Perhaps a stupid suggestion, but have you actually recompiled AND replaced the old plugin.jar?

    Sometimes we miss stupid and obvious things like this.
     
  8. Offline

    the_cows

    Um... it just randomly started working? Apparently the person using my plugin just restarted and it worked? Maybe I should start restarting rather than replacing the file via FTP and reloading xD.

    Oh well, thanks guys :)
     
  9. Offline

    jimuskin

    the_cows Were you using /reload? Never a good idea....
     
Thread Status:
Not open for further replies.

Share This Page