Created
October 8, 2013 23:44
-
-
Save PaulBGD/6893760 to your computer and use it in GitHub Desktop.
Arena Resource 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.ultimate.Arena; | |
import org.bukkit.Location; | |
import org.bukkit.configuration.file.FileConfiguration; | |
public class Arena { | |
private String name; // A spot to store our arena's name | |
private Location l1, l2; // Our two corners | |
private Location spawn, stop; // Where we start and stop | |
private PlayerManager playerManager; // This is to manage all of the players | |
// We'll create a new instance of this class with all the data | |
public Arena(String name, Location l1, Location l2, Location spawn, Location stop) { | |
// Assign it all to local variables.. | |
this.name = name; | |
this.l1 = l1; | |
this.l2 = l2; | |
this.spawn = spawn; | |
this.stop = stop; | |
// Now get a new PlayerManager | |
playerManager = new PlayerManager(this); | |
// We'll have the arena register itself | |
ArenaManager.addArena(this); | |
} | |
// Now, we'll put a few methods here to get the variables | |
public String getName() { | |
return name; | |
} | |
public Location getLocationOne() { | |
return l1; | |
} | |
public Location getLocationTwo() { | |
return l2; | |
} | |
public Location getSpawn() { | |
return spawn; | |
} | |
public Location getStop() { | |
return stop; | |
} | |
// Add a method to get the playerManager | |
public PlayerManager getPlayerManager() { | |
return playerManager; | |
} | |
// For loading from/to a config | |
public void save(FileConfiguration c, String path) { | |
path += "." + name + "."; | |
c.set(path + "l1", LocationUtils.fromLocation(l1, true, false)); | |
c.set(path + "l2", LocationUtils.fromLocation(l1, true, false)); | |
c.set(path + "spawn", LocationUtils.fromLocation(l1, false, true)); | |
c.set(path + "stop", LocationUtils.fromLocation(l1, false, true)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment