Q:

monopoly property multiple owner

I'm creating a Monopoly program in Java and I run into a problem: When a player lands on a Property always get's to buy it, even if it's already owned.
Here are the two pieces of code that come in question:
Property class:  
class Property{
    public int ownerID = -1;
    public Player owner;
    public boolean isOwned;
    public int price, rent; // defined in Constructor

    public void onLanded(Player p){
        if(OwnerID < 0){
            p.offerProperty(this);
        } else if(ownerID != p.getID(){
            p.transfer(-rent);
            owner.transfer(rent);
            System.ou.println("bla bla");
        } else {
            System.out.println("bla bla");
        }
    }

    public void buy(Player p){
        p.transfer(-price);
        setOwner(p);
        p.assets.add(this);
    }

    public void setOwner(Player p){
        owner = p;
        ownerID = p.getID();
        isOwner = true;
    }
}

class Player:
class Player{
    int id, money; // defined in Constructor
    ArrayList<Property> assets = new ArrayList<Property>();

    public void offerProperty(Property p){
        if(money >= p.getPrice()){
            System.out.println("wanna bu?");
            String inputAnswer = scanner.next();
            if(agreed(inpuAnswer))
                p.buy(this);
            }
    }

    public boolean agreed(String s){
        if(s.equals("yes") return true;
            return false;
    }

    public int getID(){
        return id;
    }

    public void transfer(int amount){
        money += amount;
    }
}

Now, as I said, every time I run the game I get that if a player lands on a already owned property, he get the possibility to buy it instead of having to pay the rent to the owner. I have been looking for solutions for days and I also tried some other approach to the problem but always unsuccessful. Does anybody have an idea how to solve this issue?

A:

I found my bug, and it wasn't actually in the piece of code I wrote in the question. :)
The bug was that every time a player moves, he creates a new board and moves on it, so the property is always not owned.

