private void onSecond() { currentTime++; if (currentTime < 0) { world.setTime(0); ScoreboardManager.makeScore( "Main", DisplaySlot.SIDEBAR, translationsConfig.getScoreBoardGameStartingIn(), -currentTime); if (mainConfig.isTeleportToSpawnLocationPregame() && -currentTime == mainConfig.getSecondsToTeleportPlayerToSpawn()) { for (Gamer gamer : HungergamesApi.getPlayerManager().getGamers()) { HungergamesApi.getPlayerManager().sendToSpawn(gamer); if (mainConfig.isPreventMovingFromSpawnUsingPotions()) { for (Player player : Bukkit.getOnlinePlayers()) { player.addPotionEffect( new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 200), true); player.addPotionEffect( new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 200), true); } } } } if (mainConfig.isGameStarting(currentTime)) Bukkit.broadcastMessage( String.format( translationsConfig.getBroadcastGameStartingIn(), returnTime(currentTime))); } else if (currentTime == 0) { if (pm.getGamers().size() < mainConfig.getMinPlayersForGameStart()) { currentTime = -90; ScoreboardManager.makeScore( "Main", DisplaySlot.SIDEBAR, translationsConfig.getScoreBoardGameStartingIn(), -currentTime); Bukkit.broadcastMessage(translationsConfig.getBroadcastNotEnoughPlayers()); } else { startGame(); return; } } else if (mainConfig.getAmountBorderClosesInPerSecond() > 0 && currentTime > mainConfig.getBorderStartsClosingIn()) { double borderSize = mainConfig.getBorderSize() - mainConfig.getAmountBorderClosesInPerSecond(); if (borderSize < 0) borderSize = 0; mainConfig.setBorderSize(borderSize); ScoreboardManager.makeScore( "Main", DisplaySlot.SIDEBAR, translationsConfig.getScoreboardBorderSize(), (int) mainConfig.getBorderSize()); } for (Gamer gamer : pm.getGamers()) { this.doBorder(gamer); } if (mainConfig.getTimeForInvincibility() > 0 && currentTime <= mainConfig.getTimeForInvincibility() && currentTime >= 0) { ScoreboardManager.makeScore( "Main", DisplaySlot.SIDEBAR, translationsConfig.getScoreboardInvincibleRemaining(), mainConfig.getTimeForInvincibility() - currentTime); if (currentTime == mainConfig.getTimeForInvincibility()) { Bukkit.broadcastMessage(translationsConfig.getBroadcastInvincibilityWornOff()); ScoreboardManager.hideScore( "Main", DisplaySlot.SIDEBAR, translationsConfig.getScoreboardInvincibleRemaining()); Bukkit.getPluginManager().callEvent(new InvincibilityWearOffEvent()); } else if (mainConfig.advertiseInvincibility(currentTime)) { Bukkit.broadcastMessage( String.format( translationsConfig.getBroadcastInvincibiltyWearsOffIn(), returnTime(mainConfig.getTimeForInvincibility() - currentTime))); } } ScoreboardManager.doStage(); }
private void onSecond() { currentTime++; if (currentTime < 0) { world.setTime(0); ScoreboardManager.makeScore( "Main", DisplaySlot.SIDEBAR, translationsConfig.getScoreBoardGameStartingIn(), -currentTime); if (mainConfig.isGameStarting(currentTime)) Bukkit.broadcastMessage( String.format( translationsConfig.getBroadcastGameStartingIn(), returnTime(currentTime))); } else if (currentTime == 0) { if (pm.getGamers().size() < mainConfig.getMinPlayersForGameStart()) { currentTime = -90; ScoreboardManager.makeScore( "Main", DisplaySlot.SIDEBAR, translationsConfig.getScoreBoardGameStartingIn(), -currentTime); Bukkit.broadcastMessage(translationsConfig.getBroadcastNotEnoughPlayers()); } else { startGame(); return; } } else if (mainConfig.getAmountBorderClosesInPerSecond() > 0 && currentTime > mainConfig.getBorderStartsClosingIn()) { mainConfig.setBorderSize( mainConfig.getBorderSize() - mainConfig.getAmountBorderClosesInPerSecond()); ScoreboardManager.makeScore( "Main", DisplaySlot.SIDEBAR, translationsConfig.getScoreboardBorderSize(), (int) mainConfig.getBorderSize()); } for (Gamer gamer : pm.getGamers()) { this.doBorder(gamer); } if (mainConfig.getTimeForInvincibility() > 0 && currentTime <= mainConfig.getTimeForInvincibility() && currentTime >= 0) { ScoreboardManager.makeScore( "Main", DisplaySlot.SIDEBAR, translationsConfig.getScoreboardInvincibleRemaining(), mainConfig.getTimeForInvincibility() - currentTime); if (currentTime == mainConfig.getTimeForInvincibility()) { Bukkit.broadcastMessage(translationsConfig.getBroadcastInvincibilityWornOff()); ScoreboardManager.hideScore( "Main", DisplaySlot.SIDEBAR, translationsConfig.getScoreboardInvincibleRemaining()); Bukkit.getPluginManager().callEvent(new InvincibilityWearOffEvent()); } else if (mainConfig.advertiseInvincibility(currentTime)) { Bukkit.broadcastMessage( String.format( translationsConfig.getBroadcastInvincibiltyWearsOffIn(), returnTime(mainConfig.getTimeForInvincibility() - currentTime))); } } ScoreboardManager.doStage(); }