Closes gh-148. Closes gh-147. Updated to CB670. Fixed NPE when restoring inventory and now handling warhub reset attemps on missing world. This is War v1.4.1 (Slim).

This commit is contained in:
taoneill 2011-04-10 14:16:00 -04:00
parent d84ed6e410
commit b9c0030e3c
6 changed files with 26 additions and 22 deletions

View File

@ -61,7 +61,7 @@ public class WarPlayerListener extends PlayerListener {
playerInv.clear();
for(ItemStack item : originalContents.getContents()) {
if(item.getTypeId() != 0) {
if(item != null && item.getTypeId() != 0) {
playerInv.addItem(item);
}
}

View File

@ -504,7 +504,7 @@ public class Warzone {
playerInv.clear(playerInv.getSize() + 2);
playerInv.clear(playerInv.getSize() + 3); // helmet/blockHead
for(ItemStack item : originalContents.getContents()) {
if(item.getTypeId() != 0) {
if(item != null && item.getTypeId() != 0) {
playerInv.addItem(item);
}
}

View File

@ -27,29 +27,33 @@ public class RestoreWarhubJob implements Runnable {
int hubY = Integer.parseInt(hubStrSplit[1]);
int hubZ = Integer.parseInt(hubStrSplit[2]);
World world = null;
String worldName;
if(hubStrSplit.length > 3) {
String worldName = hubStrSplit[3];
worldName = hubStrSplit[3];
world = war.getServer().getWorld(worldName);
} else {
worldName = "DEFAULT";
world = war.getServer().getWorlds().get(0); // default to first world
}
Location hubLocation = new Location(world, hubX, hubY, hubZ);
WarHub hub = new WarHub(war, hubLocation);
war.setWarHub(hub);
Volume vol = VolumeMapper.loadVolume("warhub", "", war, world);
hub.setVolume(vol);
hub.getVolume().resetBlocks();
hub.initialize();
// In the previous job started by the mapper, warzones were created, but their lobbies are missing the war hub gate (because it didn't exist yet)
for(Warzone zone : war.getWarzones()) {
if(zone.getLobby() != null) {
zone.getLobby().getVolume().resetBlocks();
zone.getLobby().initialize();
if(world != null) {
Location hubLocation = new Location(world, hubX, hubY, hubZ);
WarHub hub = new WarHub(war, hubLocation);
war.setWarHub(hub);
Volume vol = VolumeMapper.loadVolume("warhub", "", war, world);
hub.setVolume(vol);
hub.getVolume().resetBlocks();
hub.initialize();
// In the previous job started by the mapper, warzones were created, but their lobbies are missing the war hub gate (because it didn't exist yet)
for(Warzone zone : war.getWarzones()) {
if(zone.getLobby() != null) {
zone.getLobby().getVolume().resetBlocks();
zone.getLobby().initialize();
}
}
war.logInfo("Warhub ready.");
} else {
war.logWarn("Failed to restore warhub. The specified world (name: " + worldName + ") does not exist!");
}
war.logInfo("Warhub ready.");
}
}

View File

@ -49,7 +49,7 @@ public class WarzoneMapper {
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.");
war.logWarn("Failed to restore warzone " + name + ". The specified world (name: " + worldStr + ") does not exist!");
} else {
// Create the zone
Warzone warzone = new Warzone(war, world, name);

View File

@ -1,5 +1,5 @@
name: War
version: 1.4 (Slim)
version: 1.4.1 (Slim)
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
author: tommytony
website: war.tommytony.com

View File

@ -1,5 +1,5 @@
name: War
version: 1.4 (Slim)
version: 1.4.1 (Slim)
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
author: tommytony
website: war.tommytony.com