Search in sources :

Example 11 with PlayerStateService

use of com.skelril.skree.service.PlayerStateService in project Skree by Skelril.

the class JungleRaidInstance method tryInventoryRestore.

public void tryInventoryRestore(Player player) {
    Optional<PlayerStateService> optService = Sponge.getServiceManager().provide(PlayerStateService.class);
    if (optService.isPresent()) {
        PlayerStateService service = optService.get();
        service.loadInventoryIfStored(player);
    }
}
Also used : PlayerStateService(com.skelril.skree.service.PlayerStateService)

Example 12 with PlayerStateService

use of com.skelril.skree.service.PlayerStateService in project Skree by Skelril.

the class SkyWarsInstance method remove.

@Override
public Clause<Player, ZoneStatus> remove(Player player) {
    player.offer(Keys.FALL_DISTANCE, 0F);
    playerLost(player);
    Optional<PlayerStateService> optService = Sponge.getServiceManager().provide(PlayerStateService.class);
    if (optService.isPresent()) {
        PlayerStateService service = optService.get();
        service.loadInventoryIfStored(player);
    }
    return super.remove(player);
}
Also used : PlayerStateService(com.skelril.skree.service.PlayerStateService)

Aggregations

PlayerStateService (com.skelril.skree.service.PlayerStateService)12 InventoryStorageStateException (com.skelril.skree.service.internal.playerstate.InventoryStorageStateException)5 Clause (com.skelril.nitro.Clause)3 BigDecimal (java.math.BigDecimal)2 Player (org.spongepowered.api.entity.living.player.Player)2 ItemStackFactory.newItemStack (com.skelril.nitro.item.ItemStackFactory.newItemStack)1 MarketService (com.skelril.skree.service.MarketService)1 GameMode (org.spongepowered.api.entity.living.player.gamemode.GameMode)1 ItemStack (org.spongepowered.api.item.inventory.ItemStack)1 MessageChannel (org.spongepowered.api.text.channel.MessageChannel)1