MinigameAPI Basics

Feb 20, 2019
MinigameAPI Basics
  • Part 1: Creating a new game and basics (You Are Here)
    Part 2: Customizing Plugin
    Wiki - Home Page

    First thing's first, we're going to download MinigameAPI. You can get a fresh version here.

    Now, you're going to add "MinigameAPI" to your build path, If you don't know how, Please redirect to this wiki.

    Now, we can start creating our first arena.

    We are going to do this by creating a command, /createarena [name], however I will give the example method below
    Code (Text):
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
                if (!(sender instanceof Player)) {
                   return true;
                }

                Player p = (Player) sender;
     
                if (args.length < 1) {
                    p.sendMessage("Not enough arguments");
                    return true;
                }
                Arena a = MinigameAPI.createArena(args[0]);
                a.setGameLobby(p.getLocation);
                return true;
        }

    }
    Now we have an arena, and want players to be able to join the game. We can do that by using methods in the API.

    Code (Text):
    Arena a = MinigameAPI.getArena("game"); //the arena name. It is what args[0] was in above command
    a.addPlayer(p);
  • Loading...
  • Loading...