Solved Some Java OOP stuff problems

Discussion in 'Plugin Development' started by Shadow_tingBRO, Mar 12, 2019.

Thread Status:
Not open for further replies.
  1. This is kind of a java question but the problem is to do with bukkit (wanted to just say that).

    So, I have been coding java for idk like a year now and I know pretty much 5 - 6/7 stuff of java, and I only really do making small apps and bukkit / forge mods and plugins. I never do any Java OOP stuff, and I just want to ask about a problem Im having. EDIT: I have done a bit of java oop outside of bukkit API and it worked which was some time ago.

    the following code below is coming out with a error, which is that the console outputs: "Successfully Loaded House Type : null.

    Code:
    public class HouseType {
     
        private String typeName = null;
     
        private List<Building> contents = new ArrayList<Building>();
     
        public HouseType(List<Building> contents, String typeName) {
            contents = this.contents;
            typeName = this.typeName;
         
            PixelCraftAPI.sendConsoleMessage(ChatColor.GREEN + "Successfully Loaded House Type : " + this.typeName);
         
        }
     
        public int getAmountOfBuildings() {
            return contents.size();
        }
     
        public List<Building> getContents(){
            return contents;
        }
     
        public String getTypeName() {
            return typeName;
        }
    
    }
    
    I have no idea why this is, and I have tried using typeName aswell as this.typeName. Any ideas?
     
  2. Online

    timtower Administrator Administrator Moderator

  3. @timtower OHHHHH THANKS. You are definitely my favorite moderator.
     
    Last edited: Mar 12, 2019
  4. Online

    timtower Administrator Administrator Moderator

    I am the only one, so you aren't giving any complements here :p
    Marked thread as solved.
     
  5. @timtower well your still my favorite staff member*
     
    timtower likes this.
Thread Status:
Not open for further replies.

Share This Page