Solved Draw objects from another class?

Discussion in 'Plugin Development' started by Rufus5, Jan 19, 2015.

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


    Ok, so I'm trying to make a towns plugin. I'm creating a class called Town so I can easily create new ones. My code so far is as follows.
    public Town(String name, Location l1, Location l2, Player owner){
    Let's say I create a new Town in my main class named "t". How do I get
  2. Offline


    Create a variable in your town class with the type String. In your constructor, have a name parameter and set the variable in your town class to the parameter you input into the constructor.

    After that, just create a simple getter for the String in your town class.
  3. Offline


    Have something like this in your main class:

    public class TownMain extends JavaPlugin{
        public static Town t;
        public void onEnable(){
            t = new Town(Name, L1, L1, Owner);
    In the class you want to reach the town named t, use TownMain(What ever your main class is called).t.
    Rufus5 likes this.
Thread Status:
Not open for further replies.

Share This Page