mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 12:46:11 +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();
|
playerInv.clear();
|
||||||
|
|
||||||
for(ItemStack item : originalContents.getContents()) {
|
for(ItemStack item : originalContents.getContents()) {
|
||||||
if(item.getTypeId() != 0) {
|
if(item != null && item.getTypeId() != 0) {
|
||||||
playerInv.addItem(item);
|
playerInv.addItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -504,7 +504,7 @@ public class Warzone {
|
|||||||
playerInv.clear(playerInv.getSize() + 2);
|
playerInv.clear(playerInv.getSize() + 2);
|
||||||
playerInv.clear(playerInv.getSize() + 3); // helmet/blockHead
|
playerInv.clear(playerInv.getSize() + 3); // helmet/blockHead
|
||||||
for(ItemStack item : originalContents.getContents()) {
|
for(ItemStack item : originalContents.getContents()) {
|
||||||
if(item.getTypeId() != 0) {
|
if(item != null && item.getTypeId() != 0) {
|
||||||
playerInv.addItem(item);
|
playerInv.addItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,29 +27,33 @@ public class RestoreWarhubJob implements Runnable {
|
|||||||
int hubY = Integer.parseInt(hubStrSplit[1]);
|
int hubY = Integer.parseInt(hubStrSplit[1]);
|
||||||
int hubZ = Integer.parseInt(hubStrSplit[2]);
|
int hubZ = Integer.parseInt(hubStrSplit[2]);
|
||||||
World world = null;
|
World world = null;
|
||||||
|
String worldName;
|
||||||
if(hubStrSplit.length > 3) {
|
if(hubStrSplit.length > 3) {
|
||||||
String worldName = hubStrSplit[3];
|
worldName = hubStrSplit[3];
|
||||||
world = war.getServer().getWorld(worldName);
|
world = war.getServer().getWorld(worldName);
|
||||||
} else {
|
} else {
|
||||||
|
worldName = "DEFAULT";
|
||||||
world = war.getServer().getWorlds().get(0); // default to first world
|
world = war.getServer().getWorlds().get(0); // default to first world
|
||||||
}
|
}
|
||||||
Location hubLocation = new Location(world, hubX, hubY, hubZ);
|
if(world != null) {
|
||||||
WarHub hub = new WarHub(war, hubLocation);
|
Location hubLocation = new Location(world, hubX, hubY, hubZ);
|
||||||
war.setWarHub(hub);
|
WarHub hub = new WarHub(war, hubLocation);
|
||||||
Volume vol = VolumeMapper.loadVolume("warhub", "", war, world);
|
war.setWarHub(hub);
|
||||||
hub.setVolume(vol);
|
Volume vol = VolumeMapper.loadVolume("warhub", "", war, world);
|
||||||
hub.getVolume().resetBlocks();
|
hub.setVolume(vol);
|
||||||
hub.initialize();
|
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()) {
|
// 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)
|
||||||
if(zone.getLobby() != null) {
|
for(Warzone zone : war.getWarzones()) {
|
||||||
zone.getLobby().getVolume().resetBlocks();
|
if(zone.getLobby() != null) {
|
||||||
zone.getLobby().initialize();
|
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) {
|
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 {
|
} else {
|
||||||
// Create the zone
|
// Create the zone
|
||||||
Warzone warzone = new Warzone(war, world, name);
|
Warzone warzone = new Warzone(war, world, name);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: War
|
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.
|
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
|
||||||
author: tommytony
|
author: tommytony
|
||||||
website: war.tommytony.com
|
website: war.tommytony.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: War
|
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.
|
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
|
||||||
author: tommytony
|
author: tommytony
|
||||||
website: war.tommytony.com
|
website: war.tommytony.com
|
||||||
|
Loading…
Reference in New Issue
Block a user