use of com.skelril.skree.service.internal.playerstate.InventoryStorageStateException in project Skree by Skelril.
the class TempleOfFateInstance method add.
@Override
public Clause<Player, ZoneStatus> add(Player player) {
player.setLocation(startingPoint);
Optional<PlayerStateService> optService = Sponge.getServiceManager().provide(PlayerStateService.class);
if (optService.isPresent()) {
PlayerStateService service = optService.get();
try {
service.storeInventory(player);
service.releaseInventory(player);
player.offer(Keys.POTION_EFFECTS, new ArrayList<>());
player.getInventory().clear();
} catch (InventoryStorageStateException e) {
e.printStackTrace();
return new Clause<>(player, ZoneStatus.ERROR);
}
}
participants.add(player);
return new Clause<>(player, ZoneStatus.ADDED);
}
use of com.skelril.skree.service.internal.playerstate.InventoryStorageStateException in project Skree by Skelril.
the class SkyWarsInstance method add.
@Override
public Clause<Player, ZoneStatus> add(Player player) {
if (state != SkyWarsState.LOBBY) {
return new Clause<>(player, ZoneStatus.NO_REJOIN);
}
player.setLocation(startingLocation);
Optional<PlayerStateService> optService = Sponge.getServiceManager().provide(PlayerStateService.class);
if (optService.isPresent()) {
PlayerStateService service = optService.get();
try {
service.storeInventory(player);
service.releaseInventory(player);
giveTeamHoods(player);
} catch (InventoryStorageStateException e) {
e.printStackTrace();
return new Clause<>(player, ZoneStatus.ERROR);
}
}
playerDataMapping.put(player, new SkyWarsPlayerData());
return new Clause<>(player, ZoneStatus.ADDED);
}
use of com.skelril.skree.service.internal.playerstate.InventoryStorageStateException in project Skree by Skelril.
the class GoldRushInstance method tryToStart.
public void tryToStart() {
BigDecimal coffersNeeded = getCoffersNeeded();
if (coffersNeeded.compareTo(BigDecimal.ZERO) >= 0) {
MessageChannel channel = getPlayerMessageChannel(PlayerClassifier.SPECTATOR);
channel.send(Text.of(TextColors.RED, "Your party doesn't have a high enough coffer risk!"));
channel.send(Text.of(TextColors.RED, "At least ", coffersNeeded, " more coffers must be risked."));
return;
}
Optional<PlayerStateService> optService = Sponge.getServiceManager().provide(PlayerStateService.class);
for (Player player : getPlayers(PlayerClassifier.PARTICIPANT)) {
if (optService.isPresent()) {
PlayerStateService service = optService.get();
try {
service.storeInventory(player);
service.releaseInventory(player);
player.getInventory().clear();
} catch (InventoryStorageStateException e) {
e.printStackTrace();
player.sendMessage(Text.of(TextColors.RED, "An error occurred while saving your inventory, contact an admin!"));
return;
}
} else {
if (player.getInventory().query(PlayerInventory.class, EquipmentInventory.class).size() > 0) {
getPlayerMessageChannel(PlayerClassifier.SPECTATOR).send(Text.of(TextColors.RED, "All players inventories must be empty."));
return;
}
}
}
readyPlayers();
calculateLootSplit();
// Reset tryToStart clock
startTime = System.currentTimeMillis();
// Add content
populateChest();
runLavaChance();
setFloodStartTime();
}
use of com.skelril.skree.service.internal.playerstate.InventoryStorageStateException in project Skree by Skelril.
the class JungleRaidInstance method add.
@Override
public Clause<Player, ZoneStatus> add(Player player) {
if (state != JungleRaidState.LOBBY) {
return new Clause<>(player, ZoneStatus.NO_REJOIN);
}
player.setLocation(lobbySpawnLocation);
Optional<PlayerStateService> optService = Sponge.getServiceManager().provide(PlayerStateService.class);
if (optService.isPresent()) {
PlayerStateService service = optService.get();
try {
service.storeInventory(player);
service.releaseInventory(player);
giveBaseEquipment(player, JungleRaidClass.BALANCED);
} catch (InventoryStorageStateException e) {
e.printStackTrace();
return new Clause<>(player, ZoneStatus.ERROR);
}
}
participants.add(player);
return new Clause<>(player, ZoneStatus.ADDED);
}
use of com.skelril.skree.service.internal.playerstate.InventoryStorageStateException in project Skree by Skelril.
the class ZoneWaitingLobby method add.
public void add(Player player) {
Optional<PlayerStateService> optService = Sponge.getServiceManager().provide(PlayerStateService.class);
if (optService.isPresent()) {
PlayerStateService service = optService.get();
try {
service.storeInventory(player);
service.releaseInventory(player);
player.getInventory().clear();
player.getInventory().offer(newItemStack(ItemTypes.COOKED_BEEF, 64));
} catch (InventoryStorageStateException e) {
e.printStackTrace();
}
}
player.setLocation(entryPointSupplier.get());
player.sendMessage(Text.of(TextColors.YELLOW, "Your instance is building..."));
player.sendMessage(Text.of(TextColors.YELLOW, "You will automatically be teleported when it's finished."));
player.sendMessage(Text.of(TextColors.YELLOW, "For now have a snowball fight!"));
playingPlayers.put(player, 0);
}
Aggregations