mirror of
https://github.com/taoneill/war.git
synced 2024-11-23 18:55:28 +01:00
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:
parent
d84ed6e410
commit
b9c0030e3c
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user