Solved How to do Test test = new Test();

Discussion in 'Plugin Development' started by gamingod, May 2, 2014.

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

    gamingod

    Hello,
    so I know this is going to sound really noobish but I wanted to know, how do you do something like this:



    Please help, thank you!

    P.S. just curious, if you know what these are called then let me know :)
     
    FisheyLP likes this.
  2. Offline

    TGRHavoc

    gamingod
    You mean setters?
    The Test class would look like this:
    Code:java
    1. public class Test{
    2.  
    3. private String name ="";
    4. private int players = 0;
    5. private boolean booleanVal = false;
    6. private List<?> list;
    7.  
    8. public void setName(String name){
    9. this.name = name;
    10. }
    11.  
    12. public void setPlayers(int amount){
    13. this.players = amount;
    14. }
    15.  
    16. public void setBoolean(boolean b){
    17. this.booleanVal = b;
    18. }
    19.  
    20. public void setList(List<?> list){
    21. this.list = list
    22. }
    23.  
    24. }
     
    FisheyLP likes this.
  3. Offline

    gamingod

    thank you!
     
    FisheyLP likes this.
  4. Offline

    TGRHavoc

    gamingod
    No problem, glad I could help :D
     
    FisheyLP likes this.
  5. Offline

    gamingod

    Is there a way to get like a UUID for each "test"? I tried test.toString() but that changes every time I reload :(
     
  6. Offline

    TGRHavoc

    gamingod
    You would have to set the UUID for the "test" then run a "getter" that returns the value:
    Code:java
    1. UUID testUUID;
    2.  
    3. public void setUUID(UUID newUUID){
    4. testUUID = newUUID;
    5. }
    6.  
    7. public UUID getUUID(){
    8. return testUUID;
    9. }
     
  7. Offline

    gamingod

    will this work with multiple "tests"?
     
  8. Offline

    ZodiacTheories

  9. Offline

    gamingod

  10. Offline

    ZodiacTheories

    gamingod

    So you know java but not getters or setters?
     
  11. Offline

    gamingod

    I do not know alot about the words, :p. For a while I did not know what I string was. I did http://www.codeacademy.org before learning about bukkit. I just recently started using API a lot because I discovered it was VERY useful XD. Before I was using methods but It is easier to just have an API class with all the methods. :) I will admit, I am a bit noobish at some stuff like this :p
     
  12. Offline

    ZodiacTheories

    gamingod

    Codeacademy does not teach you java. You are mistaking JavaScript for Java which are totally different things. Codeacademy doesn't explain JavaScript that well either.
     
  13. Offline

    gamingod

    I learn't if and else though and I have been doing bukkit for a long time now. I am sorry if I do not seem that good but I want to be

    Also I have already read that thread :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  14. Offline

    ZodiacTheories

    gamingod

    Learn Java before Bukkit. I made that mistake. You can see my elder threads, which are totally ridiculous. Just because you know if and else doesn't give you a learning of java. Anyway, I would say switch statements are better :p

    JavaScript is completely different.
     
  15. Offline

    gamingod

    Its hard to learn when whatever I do I get told it is wrong :( I tried YT and bukkit but it seems I cannot get it right :( I do not want to pay for lessens and I have tried reading online things. What do you reccomend I do?
     
  16. Offline

    ZodiacTheories

    gamingod

    Just buy a book or something, I recommend Java For Dummies 9 Books In One
     
  17. Offline

    gamingod

    alright, thank you
     
Thread Status:
Not open for further replies.

Share This Page