PlotMe: How to check if a player is able to build in a location

Discussion in 'Plugin Development' started by Jupitertree, Mar 1, 2015.

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

    Jupitertree

    I am using an older version of PlotMe and I need a way to check if a certain player is able to build in a certain location.
    Current code:

    Code:
    Plot plot = PlotManager.getPlotById(b.getLocation());
                if(plot != null){
                    if(!plot.isAllowed(player.getName())){
                        return false;
                    }
                }else{
                    return false;
                }
                return true;
    
    This will work, except it will only return true if the player is the owner of the plot. As far as I can see there's not any other methods to check if a player can build in a plot.
     
  2. Offline

    Huffmanbran

    I'm not familiar with PlotManager. However, it is unwise to check for the players name rather than their UUID. I recommend you fix that. :p
     
  3. Offline

    pie_flavor

    @Huffmanbran He said he's working with an older version of PlotManager. It doesn't contain methods for UUIDs, and UUIDs weren't universal back then. That's actually the wrong thing to say here.
     
  4. Offline

    Huffmanbran

    Oh, I stand corrected then.
     
  5. Offline

    Jupitertree

    There is actually a UUID compatible method and I should be using that, but it's not the problem here. Also this code is inside an event so their name isn't going to be changed between the time the event is called and when this code is ran.
     
Thread Status:
Not open for further replies.

Share This Page