Solved Create different instances of same minigame

Discussion in 'Plugin Development' started by marknzl, May 24, 2015.

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

    marknzl

    Hi,

    I have a question that needs answering. I have searched for this over the web but I don't really get it.
    Let's say I have made a PvP minigame which basically teleports players to an arena which they fight in. But how would I create multiple instances of the minigame via the code? Like run 2 arena's at the same time?
     
  2. Offline

    teej107

    Create a "Minigame" Object that manages a single minigame. Then create multiple "Minigame" Objects to manage multiple minigames!
     
  3. Offline

    marknzl

    Could you please give me an example?
     
  4. Offline

    nverdier

    Spoonfeeding shouldn't, and generally doesn't, occur on these forums.
     
  5. Offline

    Shortninja66

    I don't entirely understand what you're asking. Are you asking how to have multiple arena locations? Also, like the above said, people don't get spoonfed code around here.
     
  6. Offline

    teej107

    I'm not going to spoonfeed and I'm not sure what kind of example you are looking for.
     
  7. Offline

    marknzl

    Like for example, I have a PvP minigame running in one arena. I want to create multiple instances so there will be multiple instances of the minigame running at the same time.
     
  8. Code:
    public class CustomObject {
    
    private final Object object; //If you wanna modify this after, you must remove "final" 
    
    public CustomObject(Object object) { //The constructor
       this.object = object;
    }
    
    public Object getObject() { //Acces to values, you shouldn't let them freely acces values
    return object;
    }
    }
    
    //Now you can do
    CustomObject one = new CustomObject("One");
    CustomObject two = new CustomObject("Two");
    
    //So you have to modify CustomObject to make it as you need
    //you should start renaming it to something like Arena
    //on the constructor you should add what you need, like positons, etc...
    //also have a class like ArenaManager will be great, there you could manage
    //all arenas etc... or a class like ArenaEngine there you can put all fetures
    
     
    Last edited: May 25, 2015
    Shortninja66 likes this.
  9. Offline

    Shortninja66

  10. Offline

    Zombie_Striker

    @MaTaMoR_ and @teej107 gave you the answer to your questions. If your problem is solved, mark as solved.
     
  11. Offline

    marknzl

    Yup, will mark as solved. 1 quick off topic question; I see lot's of people with their signature saying Infernal Developers, what is that?
     
Thread Status:
Not open for further replies.

Share This Page