mirror of
https://github.com/taoneill/war.git
synced 2024-11-30 14:13:23 +01:00
Added config files. One file per warzone. Defaults and warzone names in war.txt.
This commit is contained in:
parent
f7e2ce06a3
commit
4349c7fd17
@ -2,7 +2,7 @@
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="lib" path="C:/dev/war/minecraft.hmod.war/lib/Minecraft_Mod133.jar" sourcepath="/hmod"/>
|
||||
<classpathentry kind="lib" path="C:/dev/war/minecraft.hmod.war/lib/Minecraft_Mod133.jar" sourcepath="/hmod133"/>
|
||||
<classpathentry kind="lib" path="C:/dev/war/minecraft.hmod.war/lib/minecraft_server-beta1.1_02.jar"/>
|
||||
<classpathentry kind="lib" path="C:/dev/war/minecraft.hmod.war/lib/mysql-connector-java-bin133.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
@ -14,12 +15,16 @@ public class War extends Plugin {
|
||||
String name = "War";
|
||||
String version = "0.1";
|
||||
|
||||
|
||||
private final List<Warzone> warzones = new ArrayList<Warzone>();
|
||||
private final List<Item> defaultLoadout = new ArrayList<Item>();
|
||||
private int defaultLifepool = 7;
|
||||
private boolean defaultFriendlyFire = false;
|
||||
|
||||
public void initialize() {
|
||||
this.log = Logger.getLogger("Minecraft");
|
||||
getLogger().info(name + " " + version + " initialized");
|
||||
|
||||
|
||||
// Register hMod hooks
|
||||
|
||||
etc.getLoader().addListener(
|
||||
PluginLoader.Hook.COMMAND,
|
||||
@ -55,12 +60,22 @@ public class War extends Plugin {
|
||||
this,
|
||||
PluginListener.Priority.MEDIUM);
|
||||
|
||||
// Load files from disk or create them
|
||||
this.defaultLoadout.add(new Item(272, 1, 0));
|
||||
this.defaultLoadout.add(new Item(261, 1, 1));
|
||||
this.defaultLoadout.add(new Item(262, 12, 2));
|
||||
this.defaultLoadout.add(new Item(274, 1, 3));
|
||||
this.defaultLoadout.add(new Item(273, 1, 4));
|
||||
this.defaultLoadout.add(new Item(275, 1, 4));
|
||||
this.defaultLoadout.add(new Item(259, 1, 5));
|
||||
this.defaultLoadout.add(new Item(297, 1, 6));
|
||||
this.defaultLoadout.add(new Item(301, 1, 100));
|
||||
this.defaultLoadout.add(new Item(300, 1, 101));
|
||||
this.defaultLoadout.add(new Item(299, 1, 102));
|
||||
this.defaultLoadout.add(new Item(298, 1, 103));
|
||||
WarMapper.load(this);
|
||||
|
||||
// etc.getLoader().addListener(
|
||||
// PluginLoader.Hook.BLOCK_CREATED,
|
||||
// listener,
|
||||
// this,
|
||||
// PluginListener.Priority.MEDIUM);
|
||||
getLogger().info(name + " " + version + " initialized.");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -89,8 +104,7 @@ public class War extends Plugin {
|
||||
if(team != null) return warzone;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Logger getLogger() {
|
||||
return log;
|
||||
@ -147,4 +161,24 @@ public class War extends Plugin {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Item> getDefaultLoadout() {
|
||||
return defaultLoadout;
|
||||
}
|
||||
|
||||
public void setDefaultLifepool(int defaultLifepool) {
|
||||
this.defaultLifepool = defaultLifepool;
|
||||
}
|
||||
|
||||
public int getDefaultLifepool() {
|
||||
return defaultLifepool;
|
||||
}
|
||||
|
||||
public void setDefaultFriendlyFire(boolean defaultFriendlyFire) {
|
||||
this.defaultFriendlyFire = defaultFriendlyFire;
|
||||
}
|
||||
|
||||
public boolean getDefaultFriendlyFire() {
|
||||
return defaultFriendlyFire;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -162,7 +162,6 @@ public class WarListener extends PluginListener {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Warzone maker commands: /setwarzone, /setwarzonestart, /resetwarzone, /newteam, /setteamspawn, .. /setmonument?
|
||||
|
||||
// /newteam <teamname>
|
||||
@ -174,9 +173,11 @@ public class WarListener extends PluginListener {
|
||||
} else {
|
||||
String name = split[1];
|
||||
Team newTeam = new Team(name, player.getLocation());
|
||||
war.warzone(player.getLocation()).getTeams().add(newTeam);
|
||||
Warzone warzone = war.warzone(player.getLocation());
|
||||
warzone.getTeams().add(newTeam);
|
||||
addSpawnArea(newTeam, player.getLocation(), 41);
|
||||
player.sendMessage(war.str("Team " + name + " created with spawn here."));
|
||||
WarzoneMapper.save(warzone);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -188,7 +189,8 @@ public class WarListener extends PluginListener {
|
||||
"Sets the team spawn. " +
|
||||
"Must be in warzone and team must already exist."));
|
||||
} else {
|
||||
List<Team> teams = war.warzone(player.getLocation()).getTeams();
|
||||
Warzone warzone = war.warzone(player.getLocation());
|
||||
List<Team> teams = warzone.getTeams();
|
||||
Team team = null;
|
||||
for(Team t : teams) {
|
||||
if(t.getName().equals(split[1])) {
|
||||
@ -205,6 +207,8 @@ public class WarListener extends PluginListener {
|
||||
"Sets the team spawn. " +
|
||||
"Must be in warzone and team must already exist."));
|
||||
}
|
||||
|
||||
WarzoneMapper.save(warzone);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -223,23 +227,28 @@ public class WarListener extends PluginListener {
|
||||
Warzone warzone = war.findWarzone(split[1]);
|
||||
if(warzone == null) {
|
||||
// create the warzone
|
||||
Warzone newZone = new Warzone(war.getServer(), split[1]);
|
||||
war.addWarzone(newZone);
|
||||
warzone = new Warzone(war, split[1]);
|
||||
war.addWarzone(warzone);
|
||||
WarMapper.save(war);
|
||||
if(split[2].equals("northwest") || split[2].equals("nw")) {
|
||||
newZone.setNorthwest(player.getLocation());
|
||||
player.sendMessage(war.str("Warzone " + newZone.getName() + " added. Northwesternmost point set at x=" + (int)newZone.getNorthwest().x + " z=" + (int)newZone.getNorthwest().z + "."));
|
||||
warzone.setNorthwest(player.getLocation());
|
||||
player.sendMessage(war.str("Warzone " + warzone.getName() + " added. Northwesternmost point set at x="
|
||||
+ (int)warzone.getNorthwest().x + " z=" + (int)warzone.getNorthwest().z + "."));
|
||||
} else {
|
||||
newZone.setSoutheast(player.getLocation());
|
||||
player.sendMessage(war.str("Warzone " + newZone.getName() + " added. Southeasternmost point set at x=" + (int)newZone.getSoutheast().x + " z=" + (int)newZone.getSoutheast().z + "."));
|
||||
warzone.setSoutheast(player.getLocation());
|
||||
player.sendMessage(war.str("Warzone " + warzone.getName() + " added. Southeasternmost point set at x="
|
||||
+ (int)warzone.getSoutheast().x + " z=" + (int)warzone.getSoutheast().z + "."));
|
||||
}
|
||||
} else {
|
||||
String message = "";
|
||||
if(split[2].equals("northwest") || split[2].equals("nw")) {
|
||||
warzone.setNorthwest(player.getLocation());
|
||||
message += "Northwesternmost point set at x=" + (int)warzone.getNorthwest().x + " z=" + (int)warzone.getNorthwest().z + " on warzone " + warzone.getName() + ".";
|
||||
message += "Northwesternmost point set at x=" + (int)warzone.getNorthwest().x
|
||||
+ " z=" + (int)warzone.getNorthwest().z + " on warzone " + warzone.getName() + ".";
|
||||
} else {
|
||||
warzone.setSoutheast(player.getLocation());
|
||||
message += "Southeasternmost point set at x=" + (int)warzone.getSoutheast().x + " z=" + (int)warzone.getSoutheast().z + " on warzone " + warzone.getName() + ".";
|
||||
message += "Southeasternmost point set at x=" + (int)warzone.getSoutheast().x
|
||||
+ " z=" + (int)warzone.getSoutheast().z + " on warzone " + warzone.getName() + ".";
|
||||
}
|
||||
|
||||
if(warzone.getNorthwest() == null) {
|
||||
@ -260,16 +269,17 @@ public class WarListener extends PluginListener {
|
||||
}
|
||||
player.sendMessage(war.str(message));
|
||||
}
|
||||
WarzoneMapper.save(warzone);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// /setwarzonestart
|
||||
else if(command.equals("/setwarzonestart")) {
|
||||
// /savewarzone
|
||||
else if(command.equals("/savewarzone")) {
|
||||
if(!war.inAnyWarzone(player.getLocation())) {
|
||||
player.sendMessage(war.str("Usage: /setwarzonestart. Must be in warzone. " +
|
||||
player.sendMessage(war.str("Usage: /savewarzone. Must be in warzone. " +
|
||||
"Changes the warzone state at the beginning of every battle. " +
|
||||
"Also sets the teleport point for this warzone " +
|
||||
"(i.e. make sure to use /warzone or the warzone tp point will change). " +
|
||||
@ -281,22 +291,7 @@ public class WarListener extends PluginListener {
|
||||
int savedBlocks = warzone.saveState();
|
||||
warzone.setTeleport(player.getLocation());
|
||||
player.sendMessage(war.str("Warzone " + warzone.getName() + " initial state and teleport location changed. Saved " + savedBlocks + " blocks."));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// /resetwarzone
|
||||
else if(command.equals("/resetwarzone")) {
|
||||
if(!war.inAnyWarzone(player.getLocation())) {
|
||||
player.sendMessage(war.str("Usage: /resetwarzone. Must be in warzone."));
|
||||
} else {
|
||||
Warzone warzone = war.warzone(player.getLocation());
|
||||
for(Team team: warzone.getTeams()) {
|
||||
team.teamcast(war.str("Resetting warzone " + warzone.getName() + "..."));
|
||||
}
|
||||
int resetBlocks = warzone.resetState();
|
||||
Location playerLoc = player.getLocation();
|
||||
player.sendMessage(war.str("Warzone reset. " + resetBlocks + " blocks reset."));
|
||||
WarzoneMapper.save(warzone);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -308,8 +303,9 @@ public class WarListener extends PluginListener {
|
||||
} else {
|
||||
Warzone warzone = war.warzone(player.getLocation());
|
||||
Monument monument = new Monument(split[1], war, player.getLocation());
|
||||
warzone.getMomuments().add(monument);
|
||||
warzone.getMonuments().add(monument);
|
||||
player.sendMessage(war.str("Monument " + monument.getName() + " created."));
|
||||
WarzoneMapper.save(warzone);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -478,6 +474,7 @@ public class WarListener extends PluginListener {
|
||||
|
||||
if(to != null && playerTeam != null
|
||||
&& playerWarzone.nearAnyOwnedMonument(to, playerTeam)
|
||||
&& player.getHealth() < 30
|
||||
&& random.nextInt(42) == 3 ) { // one chance out of many of getting healed
|
||||
player.setHealth(30);
|
||||
player.sendMessage(war.str("Your dance has awakened the monument's voodoo. You were granted full health!"));
|
||||
|
73
minecraft.hmod.war/src/WarMapper.java
Normal file
73
minecraft.hmod.war/src/WarMapper.java
Normal file
@ -0,0 +1,73 @@
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class WarMapper {
|
||||
|
||||
public static void load(War war) {
|
||||
PropertiesFile warConfig = new PropertiesFile("war.txt");
|
||||
|
||||
// Create file if need be
|
||||
if(!warConfig.containsKey("warzones")) {
|
||||
WarMapper.save(war);
|
||||
war.getLogger().info("War config file created.");
|
||||
}
|
||||
|
||||
// warzones
|
||||
String warzonesStr = warConfig.getString("warzones");
|
||||
String[] warzoneSplit = warzonesStr.split(",");
|
||||
war.getWarzones().clear();
|
||||
for(String warzoneName : warzoneSplit) {
|
||||
if(warzoneName != null && !warzoneName.equals("")){
|
||||
Warzone zone = WarzoneMapper.load(war, warzoneName); // cascade load
|
||||
war.getWarzones().add(zone);
|
||||
zone.resetState(); // is this wise?
|
||||
}
|
||||
}
|
||||
|
||||
// defaultLoadout
|
||||
String defaultLoadoutStr = warConfig.getString("defaultLoadout");
|
||||
String[] defaultLoadoutSplit = defaultLoadoutStr.split(";");
|
||||
war.getDefaultLoadout().clear();
|
||||
for(String itemStr : defaultLoadoutSplit) {
|
||||
if(itemStr != null && !itemStr.equals("")) {
|
||||
String[] itemStrSplit = itemStr.split(",");
|
||||
Item item = new Item(Integer.parseInt(itemStrSplit[0]),
|
||||
Integer.parseInt(itemStrSplit[1]), Integer.parseInt(itemStrSplit[2]));
|
||||
war.getDefaultLoadout().add(item);
|
||||
}
|
||||
}
|
||||
|
||||
// defaultLifepool
|
||||
war.setDefaultLifepool(warConfig.getInt("defaultLifepool"));
|
||||
|
||||
// defaultFriendlyFire
|
||||
war.setDefaultFriendlyFire(warConfig.getBoolean("defaultFriendlyFire"));
|
||||
}
|
||||
|
||||
public static void save(War war) {
|
||||
PropertiesFile warConfig = new PropertiesFile("war.txt");
|
||||
String warzonesStr = "";
|
||||
|
||||
// warzones
|
||||
for(Warzone zone : war.getWarzones()) {
|
||||
warzonesStr += zone.getName() + ",";
|
||||
}
|
||||
warConfig.setString("warzones", warzonesStr);
|
||||
|
||||
// defaultLoadout
|
||||
String defaultLoadoutStr = "";
|
||||
List<Item> items = war.getDefaultLoadout();
|
||||
for(Item item : items) {
|
||||
defaultLoadoutStr += item.getItemId() + "," + item.getAmount() + "," + item.getSlot() + ";";
|
||||
}
|
||||
warConfig.setString("defaultLoadout", defaultLoadoutStr);
|
||||
|
||||
// defaultLifepool
|
||||
warConfig.setInt("defaultLifePool", war.getDefaultLifepool());
|
||||
|
||||
// defaultFriendlyFire
|
||||
warConfig.setBoolean("defaultFriendlyFire", war.getDefaultFriendlyFire());
|
||||
|
||||
warConfig.save();
|
||||
}
|
||||
}
|
@ -10,11 +10,19 @@ public class Warzone {
|
||||
private final Server server;
|
||||
|
||||
private int[][][] initialState = null;
|
||||
private Location teleport;
|
||||
private Location teleport;
|
||||
private boolean friendlyFire;
|
||||
private War war;
|
||||
private int lifePool;
|
||||
private List<Item> loadout;
|
||||
|
||||
public Warzone(Server server, String name) {
|
||||
this.server = server;
|
||||
public Warzone(War war, String name) {
|
||||
this.war = war;
|
||||
this.server = war.getServer();
|
||||
this.name = name;
|
||||
this.friendlyFire = war.getDefaultFriendlyFire();
|
||||
this.setLifePool(war.getDefaultLifepool());
|
||||
this.setLoadout(war.getDefaultLoadout());
|
||||
}
|
||||
|
||||
public boolean ready() {
|
||||
@ -224,16 +232,9 @@ public class Warzone {
|
||||
Inventory playerInv = player.getInventory();
|
||||
playerInv.clearContents();
|
||||
playerInv.update();
|
||||
playerInv.setSlot(new Item(Item.Type.StoneSword), 0);
|
||||
playerInv.setSlot(new Item(Item.Type.Bow), 1);
|
||||
playerInv.setSlot(new Item(Item.Type.Arrow, 12), 2);
|
||||
playerInv.setSlot(new Item(Item.Type.StonePickaxe), 3);
|
||||
playerInv.setSlot(new Item(Item.Type.StoneSpade), 4);
|
||||
playerInv.addItem(new Item(Item.Type.Bread, 3));
|
||||
playerInv.setSlot(new Item(Item.Type.LeatherBoots), 100);
|
||||
playerInv.setSlot(new Item(Item.Type.LeatherLeggings), 101);
|
||||
playerInv.setSlot(new Item(Item.Type.LeatherChestplate), 102);
|
||||
playerInv.setSlot(new Item(Item.Type.LeatherHelmet), 103);
|
||||
for(Item loadoutItem : loadout) {
|
||||
playerInv.addItem(loadoutItem);
|
||||
}
|
||||
playerInv.update();
|
||||
player.setHealth(30);
|
||||
player.setFireTicks(0);
|
||||
@ -273,9 +274,34 @@ public class Warzone {
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<Monument> getMomuments() {
|
||||
public List<Monument> getMonuments() {
|
||||
return monuments;
|
||||
}
|
||||
|
||||
public boolean getFriendlyFire() {
|
||||
// TODO Auto-generated method stub
|
||||
return this.friendlyFire;
|
||||
}
|
||||
|
||||
public void setLoadout(List<Item> loadout) {
|
||||
this.loadout = loadout;
|
||||
}
|
||||
|
||||
public List<Item> getLoadout() {
|
||||
return loadout;
|
||||
}
|
||||
|
||||
public void setLifePool(int lifePool) {
|
||||
this.lifePool = lifePool;
|
||||
}
|
||||
|
||||
public int getLifePool() {
|
||||
return lifePool;
|
||||
}
|
||||
|
||||
public void setFriendlyFire(boolean ffOn) {
|
||||
this.friendlyFire = ffOn;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
170
minecraft.hmod.war/src/WarzoneMapper.java
Normal file
170
minecraft.hmod.war/src/WarzoneMapper.java
Normal file
@ -0,0 +1,170 @@
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class WarzoneMapper {
|
||||
|
||||
public static Warzone load(War war, String name) {
|
||||
PropertiesFile warzoneConfig = new PropertiesFile("warzone-" + name + ".txt");
|
||||
Warzone warzone = new Warzone(war, name);
|
||||
|
||||
// Create file if needed
|
||||
if(!warzoneConfig.containsKey("name")) {
|
||||
WarzoneMapper.save(warzone);
|
||||
war.getLogger().info("Warzone " + name + " config file created.");
|
||||
}
|
||||
|
||||
// northwest
|
||||
String nwStr = warzoneConfig.getString("northWest");
|
||||
String[] nwStrSplit = nwStr.split(",");
|
||||
int nwX = Integer.parseInt(nwStrSplit[0]);
|
||||
int nwY = Integer.parseInt(nwStrSplit[1]);
|
||||
int nwZ = Integer.parseInt(nwStrSplit[2]);
|
||||
Location nw = new Location(nwX, nwY, nwZ);
|
||||
warzone.setNorthwest(nw);
|
||||
|
||||
// southeast
|
||||
String seStr = warzoneConfig.getString("southEast");
|
||||
String[] seStrSplit = seStr.split(",");
|
||||
int seX = Integer.parseInt(seStrSplit[0]);
|
||||
int seY = Integer.parseInt(seStrSplit[1]);
|
||||
int seZ = Integer.parseInt(seStrSplit[2]);
|
||||
Location se = new Location(seX, seY, seZ);
|
||||
warzone.setSoutheast(se);
|
||||
|
||||
// teleport
|
||||
String teleportStr = warzoneConfig.getString("teleport");
|
||||
if(teleportStr != null && !teleportStr.equals("")) {
|
||||
String[] teleportSplit = teleportStr.split(",");
|
||||
int teleX = Integer.parseInt(teleportSplit[0]);
|
||||
int teleY = Integer.parseInt(teleportSplit[1]);
|
||||
int teleZ = Integer.parseInt(teleportSplit[2]);
|
||||
warzone.setTeleport(new Location(teleX, teleY, teleZ));
|
||||
}
|
||||
|
||||
// teams
|
||||
String teamsStr = warzoneConfig.getString("teams");
|
||||
String[] teamsSplit = teamsStr.split(";");
|
||||
warzone.getTeams().clear();
|
||||
for(String teamStr : teamsSplit) {
|
||||
if(teamStr != null && !teamStr.equals("")){
|
||||
String[] teamStrSplit = teamStr.split(",");
|
||||
int teamX = Integer.parseInt(teamStrSplit[1]);
|
||||
int teamY = Integer.parseInt(teamStrSplit[2]);
|
||||
int teamZ = Integer.parseInt(teamStrSplit[3]);
|
||||
Team team = new Team(teamStrSplit[0],
|
||||
new Location(teamX, teamY, teamZ));
|
||||
warzone.getTeams().add(team);
|
||||
}
|
||||
}
|
||||
|
||||
// ff
|
||||
warzone.setFriendlyFire(warzoneConfig.getBoolean("friendlyFire"));
|
||||
|
||||
// loadout
|
||||
String loadoutStr = warzoneConfig.getString("loadout");
|
||||
String[] loadoutStrSplit = loadoutStr.split(";");
|
||||
warzone.getLoadout().clear();
|
||||
for(String itemStr : loadoutStrSplit) {
|
||||
if(itemStr != null && !itemStr.equals("")) {
|
||||
String[] itemStrSplit = itemStr.split(",");
|
||||
Item item = new Item(Integer.parseInt(itemStrSplit[0]),
|
||||
Integer.parseInt(itemStrSplit[1]), Integer.parseInt(itemStrSplit[2]));
|
||||
warzone.getLoadout().add(item);
|
||||
}
|
||||
}
|
||||
|
||||
// life pool
|
||||
warzone.setLifePool(warzoneConfig.getInt("lifePool"));
|
||||
|
||||
// monuments
|
||||
String monumentsStr = warzoneConfig.getString("monuments");
|
||||
String[] monumentsSplit = monumentsStr.split(";");
|
||||
warzone.getMonuments().clear();
|
||||
for(String monumentStr : monumentsSplit) {
|
||||
if(monumentStr != null && !monumentStr.equals("")){
|
||||
String[] monumentStrSplit = monumentStr.split(",");
|
||||
int monumentX = Integer.parseInt(monumentStrSplit[1]);
|
||||
int monumentY = Integer.parseInt(monumentStrSplit[2]);
|
||||
int monumentZ = Integer.parseInt(monumentStrSplit[3]);
|
||||
Monument monument = new Monument(monumentStrSplit[0], war,
|
||||
new Location(monumentX, monumentY, monumentZ));
|
||||
warzone.getMonuments().add(monument);
|
||||
}
|
||||
}
|
||||
|
||||
return warzone;
|
||||
|
||||
}
|
||||
|
||||
public static void save(Warzone warzone) {
|
||||
PropertiesFile warzoneConfig = new PropertiesFile("warzone-" + warzone.getName() + ".txt");
|
||||
|
||||
// name
|
||||
warzoneConfig.setString("name", warzone.getName());
|
||||
|
||||
// northwest
|
||||
String nwStr = "";
|
||||
Location nw = warzone.getNorthwest();
|
||||
if(nw != null) {
|
||||
nwStr = (int)nw.x + "," + (int)nw.y + "," + (int)nw.z;
|
||||
}
|
||||
warzoneConfig.setString("northWest", nwStr);
|
||||
|
||||
// southeast
|
||||
String seStr = "";
|
||||
Location se = warzone.getSoutheast();
|
||||
if(se != null) {
|
||||
seStr = (int)se.x + "," + (int)se.y + "," + (int)se.z;
|
||||
}
|
||||
warzoneConfig.setString("southEast", seStr);
|
||||
|
||||
// teleport
|
||||
String teleportStr = "";
|
||||
Location tele = warzone.getTeleport();
|
||||
if(tele != null) {
|
||||
teleportStr = (int)tele.x + "," + (int)tele.y + "," + (int)tele.z;
|
||||
}
|
||||
warzoneConfig.setString("teleport", teleportStr);
|
||||
|
||||
// teams
|
||||
String teamsStr = "";
|
||||
List<Team> teams = warzone.getTeams();
|
||||
for(Team team : teams) {
|
||||
Location spawn = team.getTeamSpawn();
|
||||
teamsStr += team.getName() + "," + (int)spawn.x + "," + (int)spawn.y + "," + (int)spawn.z + ";";
|
||||
}
|
||||
warzoneConfig.setString("teams", teamsStr);
|
||||
|
||||
// ff
|
||||
warzoneConfig.setBoolean("firendlyFire", warzone.getFriendlyFire());
|
||||
|
||||
// loadout
|
||||
String loadoutStr = "";
|
||||
List<Item> items = warzone.getLoadout();
|
||||
for(Item item : items) {
|
||||
loadoutStr += item.getItemId() + "," + item.getAmount() + "," + item.getSlot() + ";";
|
||||
}
|
||||
warzoneConfig.setString("loadout", loadoutStr);
|
||||
|
||||
// life pool
|
||||
warzoneConfig.setInt("lifePool", warzone.getLifePool());
|
||||
|
||||
// monuments
|
||||
String monumentsStr = "";
|
||||
List<Monument> monuments = warzone.getMonuments();
|
||||
for(Monument monument : monuments) {
|
||||
Location monumentLoc = monument.getLocation();
|
||||
monumentsStr += monument.getName() + "," + (int)monumentLoc.x + "," + (int)monumentLoc.y + "," + (int)monumentLoc.z + ";";
|
||||
}
|
||||
warzoneConfig.setString("monuments", monumentsStr);
|
||||
|
||||
warzoneConfig.save();
|
||||
}
|
||||
|
||||
public static void delete(String name) {
|
||||
File warzoneConfig = new File("warzone-" + name + ".txt");
|
||||
warzoneConfig.delete();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user