Ensure that players inventories are saved often

This commit is contained in:
Sam 2017-11-08 22:37:22 +00:00 committed by Alexander Meech
parent cfe5f38ed4
commit 6383f6d074

View File

@ -29,7 +29,8 @@ import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerKitGiveEvent;
@ -130,11 +131,15 @@ public class CakePlayerModule extends CakeModule
}
@EventHandler(priority = EventPriority.LOWEST)
public void saveInventory(CustomDamageEvent event)
public void saveInventory(UpdateEvent event)
{
Player player = event.GetDamageePlayer();
{
return;
}
if (player == null || !UtilInv.contains(player, RUNE_OF_HOLDING.getType(), RUNE_OF_HOLDING.getData().getData(), 1))
_game.GetPlayers(true).forEach(player ->
{
if (UtilInv.contains(player, RUNE_OF_HOLDING.getType(), RUNE_OF_HOLDING.getData().getData(), 1))
{
return;
}
@ -146,6 +151,7 @@ public class CakePlayerModule extends CakeModule
inventory.getContents(),
inventory.getArmorContents()
});
});
}
@EventHandler(priority = EventPriority.LOWEST)