A start on gh-83. Won't completely break when MultiVerse isn't finished loading. Will handle this better later.

This commit is contained in:
taoneill 2011-03-14 23:52:24 -04:00
parent 1cf30f18b8
commit fc70b78040
4 changed files with 233 additions and 280 deletions

View File

@ -1,15 +0,0 @@
package com.tommytony.war;
import org.bukkit.ChatColor;
import org.bukkit.Material;
/**
*
* @author tommytony
*
*/
public class TeamChatColors {
public static final ChatColor TEAMDIAMOND = ChatColor.DARK_AQUA;
public static final ChatColor TEAMIRON = ChatColor.GRAY;
public static final ChatColor TEAMGOLD = ChatColor.GOLD;
}

View File

@ -1,39 +0,0 @@
package com.tommytony.war;
import org.bukkit.Material;
/**
*
* @author tommytony
*
*/
public class TeamMaterials {
public static final Material TEAMDIAMOND = Material.DIAMOND_BLOCK;
public static final Material TEAMIRON = Material.IRON_BLOCK;
public static final Material TEAMGOLD = Material.GOLD_BLOCK;
public static Material teamMaterialFromString(String str) {
String lowered = str.toLowerCase();
if(lowered.equals("diamond") || lowered.equals("d")) {
return TEAMDIAMOND;
} else if (lowered.equals("iron") || lowered.equals("i")) {
return TEAMIRON;
} else if (lowered.equals("gold") || lowered.equals("g")) {
return TEAMGOLD;
}
return null;
}
public static String teamMaterialToString(Material material) {
if(material.getId() == TEAMDIAMOND.getId()) {
return "diamond";
}
if(material.getId() == TEAMIRON.getId()) {
return "iron";
}
if(material.getId() == TEAMGOLD.getId()) {
return "gold";
}
return null;
}
}

View File

@ -55,6 +55,7 @@ public class WarMapper {
if(warzoneName != null && !warzoneName.equals("")){
war.logInfo("Restoring zone " + warzoneName + "...");
Warzone zone = WarzoneMapper.load(war, warzoneName, !newWar); // cascade load, only load blocks if warzone exists
if(zone != null) { // could have failed, would've been logged already
war.getWarzones().add(zone);
zone.getVolume().resetBlocks();
if(zone.getLobby() != null) {
@ -63,6 +64,7 @@ public class WarMapper {
zone.initializeZone(); // is this wise?
}
}
}
// zone makers
String makersStr = warConfig.getString("zoneMakers");

View File

@ -47,6 +47,10 @@ public class WarzoneMapper {
world = war.getServer().getWorld(worldStr);
}
if(world == null) {
war.logWarn("Failed to restore warzone " + name + "! World " + worldStr + " was not loaded yet. Try /reload once the server is up and running.");
} else {
// Create the zone
Warzone warzone = new Warzone(war, world, name);
@ -281,7 +285,8 @@ public class WarzoneMapper {
}
return warzone;
}
return null;
}
public static void save(War war, Warzone warzone, boolean saveAllBlocks) {