Allow disabling of game start sounds, and changing of the game PrepareTime.
This commit is contained in:
parent
340441edbe
commit
f12d0bf9ef
@ -11,20 +11,13 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Hanging;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.minecart.CommandMinecart;
|
||||
import org.bukkit.entity.minecart.ExplosiveMinecart;
|
||||
import org.bukkit.entity.minecart.HopperMinecart;
|
||||
import org.bukkit.entity.minecart.PoweredMinecart;
|
||||
import org.bukkit.entity.minecart.StorageMinecart;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -32,8 +25,6 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
@ -43,14 +34,11 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTabTitle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent;
|
||||
@ -243,6 +231,9 @@ public abstract class Game implements Listener
|
||||
public boolean GemBoosterEnabled = true;
|
||||
public boolean GemDoubleEnabled = true;
|
||||
|
||||
public long PrepareTime = 9000;
|
||||
public boolean PlaySoundGameStart = true;
|
||||
|
||||
//Gameplay Data
|
||||
public HashMap<Location, Player> PrivateBlockMap = new HashMap<Location, Player>();
|
||||
public HashMap<String, Integer> PrivateBlockCount = new HashMap<String, Integer>();
|
||||
@ -947,7 +938,7 @@ public abstract class Game implements Listener
|
||||
AnnounceGame(player);
|
||||
|
||||
if (AnnounceSilence)
|
||||
Manager.GetChat().Silence(9000, false);
|
||||
Manager.GetChat().Silence(PrepareTime, false);
|
||||
}
|
||||
|
||||
public void AnnounceGame(Player player)
|
||||
|
@ -85,7 +85,7 @@ public class GameLootManager implements Listener
|
||||
|
||||
if (!event.GetGame().CanGiveLoot)
|
||||
{
|
||||
event.GetGame().Announce(C.Bold + "Game Loot Disabled. Requires " + requirement + " Players.");
|
||||
event.GetGame().Announce(C.Bold + "Game Loot Disabled. Requires " + requirement + " Players.", event.GetGame().PlaySoundGameStart);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -121,12 +121,14 @@ public class GameManager implements Listener
|
||||
|
||||
if (Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
double health = (9 - (System.currentTimeMillis() - Manager.GetGame().GetStateTime())/1000d) / 9d;
|
||||
|
||||
Game game = Manager.GetGame();
|
||||
|
||||
double percentage = (double) (System.currentTimeMillis() - game.GetStateTime()) / game.PrepareTime;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
UtilTextBottom.displayProgress("Game Start", 1-health,
|
||||
UtilTime.MakeStr(Math.max(0, 9000 - (System.currentTimeMillis() - Manager.GetGame().GetStateTime()))), player);
|
||||
UtilTextBottom.displayProgress("Game Start", percentage,
|
||||
UtilTime.MakeStr(Math.max(0, game.PrepareTime - (System.currentTimeMillis() - game.GetStateTime()))), player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -177,12 +179,17 @@ public class GameManager implements Listener
|
||||
{
|
||||
if (game.CanStartPrepareCountdown())
|
||||
{
|
||||
if (UtilTime.elapsed(game.GetStateTime(), 9000))
|
||||
if (UtilTime.elapsed(game.GetStateTime(), game.PrepareTime))
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 2f, 2f);
|
||||
int players = game.GetPlayers(true).size();
|
||||
|
||||
if (players < 2 || game.PlaySoundGameStart)
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 2f, 2f);
|
||||
}
|
||||
|
||||
if (game.GetPlayers(true).size() < 2)
|
||||
if (players < 2)
|
||||
{
|
||||
game.Announce(C.cWhite + C.Bold + game.GetName() + " ended, not enough players!");
|
||||
game.SetState(GameState.Dead);
|
||||
|
@ -45,7 +45,7 @@ public class GameStatManager implements Listener
|
||||
event.GetGame().CanAddStats = (double)event.GetGame().GetPlayers(true).size() >= requirement;
|
||||
|
||||
if (!event.GetGame().CanAddStats)
|
||||
event.GetGame().Announce(C.Bold + "Stats/Achievements Disabled. Requires " + requirement + " Players.");
|
||||
event.GetGame().Announce(C.Bold + "Stats/Achievements Disabled. Requires " + requirement + " Players.", event.GetGame().PlaySoundGameStart);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
Loading…
Reference in New Issue
Block a user