Let Bukkit serialize (some) inventories...

Since ConfigurationSerializable, there's no need to manually serialize
items anymore, and thus we let Bukkit serialize player inventories for
when players join arenas.

However, the "repairables" in the soft-restore mechanism still use the
now obsolete SerializableItem and SerializableInventory classes, and
should perhaps be rewritten.

Note that for 1.0, it may still be necessary to write a custom means
of serializing items, since we don't know if a given implementation
supports native serialization (however it should be possible to rely
on Bukkit's in the Bukkit-specific classes).
This commit is contained in:
Andreas Troelsen
2013-06-10 00:44:56 +02:00
parent c23e01e1dd
commit ffe270511c
3 changed files with 74 additions and 119 deletions
+12 -2
View File
@@ -792,7 +792,12 @@ public class ArenaImpl implements Arena
mp.update();
// And update the inventory as well.
inventoryManager.storeInventory(p);
try {
inventoryManager.storeInv(p);
} catch (Exception e) {
e.printStackTrace();
Messenger.severe("Failed to store inventory for player " + p.getName() + "!");
}
}
@Override
@@ -858,7 +863,12 @@ public class ArenaImpl implements Arena
private void restoreInvAndExp(Player p) {
inventoryManager.clearInventory(p);
inventoryManager.restoreInventory(p);
try {
inventoryManager.restoreInv(p);
} catch (Exception e) {
e.printStackTrace();
Messenger.severe("Failed to restore inventory for player " + p.getName() + "!");
}
rewardManager.grantRewards(p);
if (!settings.getBoolean("keep-exp", false)) {