Util *BROKEN* *PLEASE READ* Create a Minigame!

Discussion in 'Resources' started by JPG2000, Nov 11, 2013.

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

    callum2904

    This is basically as simple as it is going to get.
     
    The Fancy Whale and Benlewis9000 like this.
  2. Offline

    Benlewis9000

    hmm... I think I'll do a bit more research into constructors and getters/setters then maybe try again once I feel more ready. If anyone can link me to good tuts on these I would be very happy? :)
     
  3. Offline

    The Fancy Whale

    I created a minigame using this tutorial (Excellent tutorial by the way you did an amazing job!), but how do I load arenas that are already in the config. I tried using loadArenas() onEnable but it didn't work. If i join a lobby that was made before a restart or something, I cannot join those old lobbies. How would I go about loading the ones already in the config? Thanks!
    Also, in the endArena method, this line comes up null for (String s: arena.getPlayers()) {
    Anyone know why that might be?
     
  4. The Fancy Whale
    You have to save the arenas into a file and load them onEnable,
    the loadArenas(); does only work if you use your own file, not FileConfiguration fc =null;
     
    The Fancy Whale likes this.
  5. Offline

    The Fancy Whale

    Benlewis9000 Methods aren't too hard they basically work like this
    Code:java
    1. public void sendMessages(Player player) //player is a variable
    2. {
    3. player.sendMessage("This is a message");
    4. }


    Then you can easily send a player the message by just doing:
    Code:java
    1. @EventHandler
    2. public void onJoin(PlayerJoinEvent event)
    3. {
    4. Player player = event.getPlayer();
    5. sendMessages(player);
    6. }

    Does that make any sense?

    I use my own configuration. And onEnable() I use loadArenas(); so I am a little confused why they don't load... maybe I'll look into the method a little more to make sure it's loading all of my new variables..

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  6. The Fancy Whale
    And don't forget to create the arena
    new Arena(keys, joinLocation, startLocation, endLocation, maxPlayers);
     
  7. Offline

    The Fancy Whale

    Oh I think its because I had + "keys." + "joinX" when it should be + keys + ".joinX"
    Looks like a slight error in the ArenaManager
     
  8. Offline

    JPG2000

    Hey guys! Sorry about my giant break, I just wanted to update my self on Bukkit stuff :D
     
  9. Offline

    Benlewis9000

    The Fancy Whale
    Sorry if this is rude, but were you being serious or sarcastic? I know I didn't exactly show it in my post up there, but I can assure you fully I understand how a method works xD I think what I should have said is are there other resources like this that don't function as well, and are more simple, for us lazy people out there ;) But after looking through it all seemed simple enough, just a compilation of arrays, loops and setters and getters ect.
     
  10. Offline

    The Fancy Whale

    You made it sound like you didn't know what a method was... This is about as simple as it gets, so by you wondering if there was an easier way, I assumed you just did not know how to use a method
     
  11. Offline

    Benlewis9000

    The Fancy Whale
    You can always make it simpler, it just then becomes very primitive and boring. Anyway, forget that, it does not matter.
     
  12. Offline

    callum2904

  13. Offline

    ItsLeoFTW

    Can someone tell me how I would make a kit system?
     
  14. Offline

    bballheat

    JPG2000
    I am having trouble with this. I have everything setup in my config, but I'm getting a nullpointer here
    Code:
    if (a.getArenaName().equals(name)) 
    in the ArenaManager class for the getArena method. I'm loading my arenas in my onEnable.
     
  15. Offline

    ever_x

    bballheat
    Ensure you can join arenas in game even after a restart; it is likely that you aren't loading the arenas properly. If this is the case, you might want to check you replace in the loadArenas method + "keys." + with + keys +. If you had already done that check config files aren't null etc. I find the best way to debug something like that is to have the method temporarily take in a player (you) and send that player a message saying exactly what the method is doing, do you can see if something isn't quite working properly.
     
  16. Offline

    MordorKing78

    I cant get this code to work after an reload.

    I already changed it to + keys +

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

    Phasesaber

    How is this (and the other 2 "minigame" tuts out there) a minigame tutorial? This is an Arena Tutorial. This shows nothing about the actual game itself.
     
  18. Offline

    ever_x

    Phasesaber That's the point. It shows you the very basics, and then let's you take all the fine details of knowledge about bukkit to add different game mechanics, effects, messages etc. if they told you exactly how to make a full minigame, you might as well download one from bukkit.
     
    xTrollxDudex likes this.
  19. Offline

    xTrollxDudex

    Phasesaber
    If it wasn't a tutorial, me, JPG, and Paul would've given you the code already ;)
     
  20. Offline

    Phasesaber

    I ended up making my own code.

    They could have at LEAST showed How to make a Listener for them. Maybe even show respawning? Better yet, making more spawn locations.

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

    ever_x

    Phasesaber What do you mean make a listener? The point I shall now repeat is that you do that by yourself. If you want a certain game mechanic such as respawning, make it your goddamn self. This is not a 'how to do everything that might ever challenge you' tutorial. Making more spawn locations is literally a matter of copy/paste-ing one line of code. Go, be free, and take the small fragment of knowledge required to make a vast and complicated minigame and start coding :)
    Have a gold star.
     
  22. Offline

    peabody505

    bballheat
    Code:java
    1. public void onPlayerJoin(PlayerLoginEvent event){
    2. ItemStack apple = new ItemStack(Material.APPLE, 1);
    3. event.getPlayer().getInventory().addItem(apple);
    4. }
     
  23. Offline

    Phasesaber

    But they don't even go in-depth for new spawn points or ANYTHING! This specific one doesn't even work by itself.
     
  24. Offline

    xTrollxDudex

    Phasesaber
    Obviously you don't have a clue of what examining code means. I really think that you need to get practice and sharpen your skills before working on mini games, or even plugins.
     
    ever_x and LegitJava like this.
  25. Offline

    ThatOneDev123

    Hello, thanks for the nice tutorial. I have a question if you don't mind.

    I understand how all of this works, but how do we go about checking the events happening in each game? Let's say for example: We are in a PVP type mini game, and all but one user is dead, we need to now end that specific arena and declare that user a winner.

    How would we do this? Would we use Events and Listeners? That is the only way I see.

    Thank you.
     

  26. Well, when you remove a player from the arena, check every time if the amount of players in that arena is equal to 0, if so then send a message to all players, award all rewards then end the arena to make it playable. Don't for get to remove the winner from the arena afterwards
     
  27. Offline

    ThatOneDev123

    Cool thanks, also I have a question, since we only have one arena manager, if lets say I perform a countdown for the match to start, I should use another thread right? Or else I would be stalling that once instance on the count down.

    Better: http://forums.bukkit.org/threads/arena-question.270670/
     
  28. Offline

    Geekhellmc

    Excellent tutorial! To be honest first time I read I understood nothing, 2nd time I read I was like hmmm, 3rd time i read I was like this is correct! 4rth time I read I was like this is too easy!
     
  29. Offline

    StefanXX

    Seems to be fantastic, I'm gonna try to make my 1v1 plugin work better with this tutorial.
     
  30. Offline

    BeatCycle

    @JPG2000

    Hello, I have a problem when adding events to my plugin;

    is not a problem, it's actually something I'm doing wrong
    can you help me, my event is this:

    Code:java
    1. @EventHandler
    2. public void deathevent(PlayerDeathEvent event){
    3.  
    4. Player p = event.getEntity().getPlayer();
    5.  
    6. String arenaName = null;//how I define this? please<----------
    7.  
    8. Arena arena = ArenaManager.getManager().getArena(arenaName);
    9.  
    10. for (String s: arena.getPlayers()) {
    11. Player u = Bukkit.getPlayer(s);
    12. u.sendMessage(u + " died in the " + arenaName);
    13. }
    14.  
    15. }


    obviously is for nullpointer,
    but as defined in the arena that player?

    please help me


    PD: i don't speak english, but I can translate your reply
     
Thread Status:
Not open for further replies.

Share This Page