Tutorial Make a minigame plugin!

Discussion in 'Resources' started by xTrollxDudex, Aug 15, 2013.

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

    xXMaTTHDXx

    Thanks xTrollxDudex
     
  2. Offline

    Giraffeknee

    xTrollxDudex
    The reason I did arenaSize-- on the remove method was so that if, for example, I removed arena 1 and created another arena it would not be arena 2, but arena 1 instead. Does that make sense?
     
  3. Offline

    xTrollxDudex

    Giraffeknee
    You are not always guarunteed to remove the last arena.
     
  4. Offline

    Giraffeknee

    Good point.
     
  5. Offline

    ksbdude

    xTrollxDudex
    I love this arena manager setup. Its extremely useful. Im trying to set it up to store multiple spawn points. I know this is posted a few times already in this thread but I am still a little confused. I get that you would store them all in the arena class but how would i be able to run a command that adds a spawn point to the arena and when a player join it knows how many spawns there are and it can send them to one at random.
     
  6. Offline

    xTrollxDudex

    ksbdude
    Use the getArena method and use a getter to grab your list of spawns. Add location to it.

    When you get the arena after calling addPlayer, you can use the getter and grab the spawns again
     
  7. Offline

    jusjus112

    xTrollxDudex
    How do i get the player that is an that arena!
    I have tried this:
    Code:java
    1. for (String s : players) {

    But thats only giving the players from that arraylist!
    Then i have tried this:
    Code:java
    1. a.getPlayers().sendMessage

    But thats not an player, thats only all of the players, so an string!
    But how do i get an player in that arena?
     
  8. Offline

    xTrollxDudex

    jusjus112
    To be totally honest, you don't have enough knowledge to even get close to minigames yet. Look it up. This is basic things you should have learned before creating plugins, learn the Bukkit API using the javadocs instead of trying to learn along the way.
     
  9. In my walls plugin I use a method to save locations in a file and used serializable to make a hash for saving the arenas blocks

    Took 2 hours 41Mins to make from scratch

    Including listeners
     
  10. Offline

    xTrollxDudex

  11. Offline

    KmanCrazy

  12. Offline

    xTrollxDudex

    KmanCrazy
    If you are new to programming, this shouldn't be your starter project.
     
  13. Offline

    Mysticate

  14. Mysticate
    It's not too late. All you do is stop working on it and go learn Java. Pretty simple ;)
     
  15. Offline

    KmanCrazy

    Oh sorry you guys took it the wrong way. lol i know java I'm just new to the bukkit api.
     
  16. Offline

    xTrollxDudex

  17. Offline

    KmanCrazy

    Well i did it so :p I guess i can do things that are above my level :p
     
  18. Offline

    octoshrimpy

    New to plugin development here, with a quick question.
    couldn't:
    Code:java
    1.  
    2. List<Arena> arenas = new ArrayList<Arena>();
    3. int arenaSize = 0;
    4. public Arena getArena(int i){
    5. for(Arena a : arenas){
    6. if(a.getId() == i){
    7. return a;
    8. }
    9. }
    10. return null;
    11. }
    12.  
    13. //add players to the arena, save their inventory
    14. public void addPlayer(Player p, int i){
    15. Arena a = getArena(i);//get the arena you want to join
    16. if(a == null){//make sure it is not null
    17. p.sendMessage("Invalid arena!");
    18. return;
    19. }
    20. }

    be simply substituted by:
    Code:java
    1.  
    2. if(this.getConfig().getString("arenas."+i) == null)
    3. {
    4. p.sendMessage("Invalid arena!");
    5. return;
    6. }
    7. else
    8. {
    9. //something along the lines of
    10. p.teleport(this.getConfig().getString("arenas."+i+".coords");
    11. }

    wouldn't that be simpler?
    Assist
     
  19. Offline

    xTrollxDudex

    octoshrimpy
    No. That's really bad for performance, really bad data flow, and really bad coding (try it in an IDE).
     
  20. Offline

    JeremyPark

    xTrollxDudex
    Hey, first off, I just wanted to say, that this is an awesome tutorial, and is very clean in it's programming. You have done an awesome job making it, and keeping everything up to date, as well as taking part in the comments. :)

    I just started my minigame, and changed a few things (such as arenas being identified as Integers, as I like the Strings better), but there are a few things that I am trying to do, which are a bit messy, so I thought maybe you would have a better idea.

    Basically what I am trying to do, is have waves of zombies. The zombies will come in a new wave after all of the current ones have been killed. How would you recommend the best way to do this? Thanks :)
     
  21. Offline

    xTrollxDudex

    JeremyPark
    Keep current count of zombies spawned in the arena. When the arena starts, spawn x number of zombies and record it. Decrement each time a zombies is killed. (You can use an EntityDeathEvent listener and find the killer, cast to player, and get the arena the player is in).

    When the x number of zombies equals 0, spawn new zombies at the spawn point, and record the number of them.
     
  22. Offline

    JeremyPark


    The idea of getting the killer and then, if the player is in-game, getting the arena sounds good. My main problem was finding a way to link the zombies to the arena. :)
     
  23. Offline

    xTrollxDudex

    JeremyPark
    You don't need to. That isn't important.
     
  24. Offline

    JeremyPark

    Well, anyway I got the zombies spawning now, and it is working great, except for one thing. You will probably facepalm at my question, but I can't figure out how to set the wave count for the arena. I can set a static int in the GameManager class, but it would be global, and conflict with other arenas. So what I need, is the int set in the arena, but able to be modified every minute or so. (Save issue with getting zombies left in the arena)

    Could you help me out with that?


    EDIT: It just occurred to me, that I could use a HashMap<Arena, Integer>();, would that be the best solution?
     
  25. Offline

    Onlineids

    That or a setWave()/getWave() method in the arena class
     
  26. Offline

    JeremyPark

    Yeah, I thought about that, but it wouldn't be arena specific, which is what I need, and I can't really think of how to use the "setWave()" and "getWave()" is an arena specific way.
     
  27. Offline

    xTrollxDudex

    It is arena specific...?
     
  28. Offline

    JeremyPark

    Is it? Maybe... I thought that if it was in the arena class it wouldn't be arena specific, but it would have to be in the arena method inside the arena class... Maybe I was wrong... :/
     
  29. Offline

    xTrollxDudex

    JeremyPark
    I think you are but then again, I don't really understand what you are trying to say.
     
  30. Offline

    Onlineids

    No your right its in the arena class so it is specific just like getId()
     
Thread Status:
Not open for further replies.

Share This Page