Skip to content

Configuration guide

Zachoz edited this page Jan 4, 2015 · 38 revisions

Where to start?

Well, you've found your way to our maps repository, so there's a good start.

What is this repo?

This repo stores our main map provider plugin. OresomeBattles works in two pieces. It has the core OresomeBattles plugin, and then it has 'Map Providers' that supply maps to it. MapsPlugin is our primary map provider plugin. OresomeBattles allows multiple map provider plugins, so we can have multiple plugins like this supplying maps to it.

Okay, that's cool. How can I configure my own map?

All OresomeBattles map configurations are done in Java. This allows much more flexibility and customisation for each map. Most people will see the word "Java" and think "OMG! CODE! COO\DE!", but trust me, it's really simple. Below will be a step by step guide of how to configure it, and then even submit it to us. If you need help with anything, feel free to ask for help from one of our map configuration team members. See https://github.com/OresomeCraft/MapsPlugin for a list of team members.

Down to business, configuring the map

Follow the step by step guide below to successfully configure your own OresomeBattles map!

First off, copy the BattleTemplate.java file, you can get that from here


Map details

Before looking through the following I would looking at the Map config template here. This will make the below make a bit more sense.

Setting the map's basic details

@MapConfig(
        name = "arctic", // Shorten & lowercase name of the map, this should be the name of the world
        fullName = "Arctic", // Full captilised map name.
        creators = {"zachoz", "ScruffyRules"}, // Map creators.
        gamemodes = {Gamemode.TDM, Gamemode.FFA} // Game modes
)

As you can see you're able to set which game modes the map can play. Current available options are: Gamemode.TDM, Gamemode.FFA, Gamemode.INFECTION, Gamemode.CTF, Gamemode.KOTH, Gamemode.LMS, Gamemode.LTS, Gamemode.TIOT

Defining the map's region

The next part defines the region of the map. This is the cuboid area that surrounds the playable map. Simply get the two blocks at both ends of a rectangular selection, for consistency's sake, x,y,z1 should be the highest block and x,y,x2 the lower block. The easiest way to get this information is to make a WorldEdit selection around the map, this will give you the coordinates of each block.

@Region(
        x1 = 0,
        y1 = 0,
        z1 = 0,
        x2 = 0,
        y2 = 0,
        z2 = 0
)

Map Attributes

Attributes are predefined configuration variables that allow you to easily enable, disable or alter features of your map. The attributes annotation may look something like this:

@Attributes(
        allowBuild = false,
        fireSpread = false,
        tdmTime = 10,
        disabledDrops = {Material.BOW, Material.IRON_SWORD}
)

Attributes are comma separated, and by convention put on a new line. If you're only adding one attribute, no commas are needed. You will notice in the example that the first 3 attributes have a comma at the end, but the 4th does not, the last defined attribute is not meant to have a comma. Attributes by default have default values, so unless you want to change them you won't need to worry about defining them.

For a full list of attributes and definitions of what they are and how to use them, click here!

Team meta data

If your map allows a team based game mode, such as TDM, DTM, CTF, etc; you can change team attributes such as the name and colour of the team. Please note, that in the code these teams are still referred to with variables similar to "redTeam" and "blueTeam", however in game it will all appear as the team names and colours you have defined. Your annotation might look something like this:

@TeamMeta(
        redTeamName = "Orange Team",
        redTeamColour = ChatColor.GOLD,
        blueTeamName = "Warriors",
        blueTeamColour = ChatColor.DARK_PURPLE
)

Updating the class file name and constructor

The code below only needs to be slightly changed. Simply change where it says "Arctic" to the name of your map. If you don't change 'Arctic' to the name of your own map, the code won't work. Also remember to rename the actual file (Template.java) to the name of your own map, eg. Arctic.java.

public class Arctic extends BattleMap {

    public Arctic() {
        super.initiate(this);
    }

Setting spawn points

Each team has their own defined spawn points. If more than one spawn point is defined, the plugin will automatically spawn players at each spawnpoint.

TDM/team based gamemode spawn points

    public void readyTDMSpawns() { // Method to prepare TDM/CTF/KoTH spawns.
        // Add red spawn points.
        redSpawns.add(new Location(w, X, Y, Z, YAW, 0);
        redSpawns.add(new Location(w, -141, 66, -1142, -152, 0));

        // Add blue spawn points.
        blueSpawns.add(new Location(w, X, Y, Z, YAW, 0);
        blueSpawns.add(new Location(w, -127, 70, -1158, -162, 0));

        // CTF stuff - Optional, put this here if you want CTF on your map!
        Location redFlag = new Location(w, 0, 1, -10); // Location of the red team's flag (X, Y, Z)
        Location blueFlag = new Location(w, 0, 1, 10); // Location of the blue team's flag (X, Y, Z)
        setCTFFlags(name, redFlag, blueFlag); // Add the flags!

        // King of the Hill stuff - Optional
        setKoTHMonument(new Location(w, -3, 89, 78)); // Set location of the monument for KoTH
    }

X - X coordinate

Y - Y coordinate

Z - Z coordinate

YAW - Direction. (The number to the right of the compass direction in the F3 menu)

Simply replace these variables with the actual values of the coordinates. You may have as many or as little TDM spawn points as you wish, but there of course must be at least one. Easy, right?

FFA/Infection/LMS spawn points

    public void readyFFASpawns() { // Method to prepare FFA/Infection spawns.
        // Set Free for all spawn points.
        FFASpawns.add(new Location(w, X, Y, Z, YAW, 0);
        FFASpawns.add(new Location(w, X, Y, Z, YAW, 0);
        FFASpawns.add(new Location(w, X, Y, Z, YAW, 0);
        FFASpawns.add(new Location(w, X, Y, Z, YAW, 0);
        FFASpawns.add(new Location(w, X, Y, Z, YAW, 0);
        FFASpawns.add(new Location(w, -125, 71, -1132, -95, 0));
        FFASpawns.add(new Location(w, -101, 71, -1159, -51, 0));
    }

The same goes for adding FFA spawns, however these spawns are used for all players. This is practically the same as configuring the TDM spawn points, just replace the variables as follows.

FFASpawns is also where the Infection spawns are defined. FFA and Infection share the same spawn points.

Note: ALL maps must have the FFA method with at least one spawn defined. This is what OresomeBattles uses for spectator spawns!


Inventories

Out of all things here inventories are probably the most complex, but they're actually super simple!

    public void applyInventory(final BattlePlayer p) {
        Inventory i = p.getInventory();

        // Define items. (This is fairly straight forward right?)
        ItemStack HEALTH_POTION = new ItemStack(Material.POTION, 1, (short) 16373);
        ItemStack STEAK = new ItemStack(Material.COOKED_BEEF, 1);
        ItemStack BOW = new ItemStack(Material.BOW, 1);
        ItemStack ARROWS = new ItemStack(Material.ARROW, 64);
        ItemStack IRON_HELMET = new ItemStack(Material.IRON_HELMET, 1);
        ItemStack IRON_CHESTPLATE = new ItemStack(Material.IRON_CHESTPLATE, 1);
        ItemStack IRON_PANTS = new ItemStack(Material.IRON_LEGGINGS, 1);
        ItemStack IRON_BOOTS = new ItemStack(Material.IRON_BOOTS, 1);
        ItemStack IRON_SWORD = new ItemStack(Material.IRON_SWORD, 1);

        p.getInventory().setBoots(IRON_BOOTS); // Set boots
        p.getInventory().setLeggings(IRON_PANTS); // Set pants
        p.getInventory().setChestplate(IRON_CHESTPLATE); // Set chest plate
        p.getInventory().setHelmet(IRON_HELMET); // Set helmet

        // Add items into inventory bar.
        // The numer being the slot number. (Remember: Slot 1 is actually 0, Slot 2 is 1, etc)
        // Second arg is the item being added.
        i.setItem(0, IRON_SWORD);
        i.setItem(1, BOW);
        i.setItem(2, STEAK);
        i.setItem(3, HEALTH_POTION);
        i.setItem(4, ARROWS);
    }

Now the thing that's confusing with Inventories is actually defining the item, especially since not all items are named as you think they would be. Here's a breakdown of the code to actually define the item:

   ItemStack IRON_SWORD = new ItemStack(Material.IRON_SWORD, 1);

ItemStack: Showing that we're defining an item(s).

IRON_SWORD: Name of the item's variable.

new ItemStack: Again, a new Item, leave that as is.

Material.IRON_SWORD: Getting the actual item.

1: Amount of that item to give.

For a full list of materials, see http://jd.bukkit.org/dev/apidocs/org/bukkit/Material.html


End of basic map configuration.

No really, that's it. The map is configured! (To a basic level anyway, usually this is sufficient, though.)

Advanced configuration

To do more advanced configuration for your battle map, check out our 'Advanced Configuration' guide. To get there click here