mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-21 19:42:37 -04:00
Don't allow TPing to people or using /where on playing CTF/countdown. Improve /tw setup status message.
This commit is contained in:
parent
c7ce45e64c
commit
ae7e9ee21b
@ -732,48 +732,27 @@ namespace MCGalaxy.Commands.Fun {
|
||||
//1
|
||||
if (it.lvl == null) { Player.Message(p, "Level: " + Colors.red + "NONE"); }
|
||||
else { Player.Message(p, "Level: " + Colors.green + it.lvl.name); }
|
||||
//2
|
||||
if (it.GameMode == TntWarsGame.TntWarsGameMode.FFA) { Player.Message(p, "Gamemode: " + Colors.green + "FFA"); }
|
||||
if (it.GameMode == TntWarsGame.TntWarsGameMode.TDM) { Player.Message(p, "Gamemode: " + Colors.green + "TDM"); }
|
||||
//3
|
||||
if (it.Difficulty == TntWarsGame.TntWarsDifficulty.Easy) { Player.Message(p, "Game difficulty: " + Colors.green + "Easy"); }
|
||||
if (it.Difficulty == TntWarsGame.TntWarsDifficulty.Normal) { Player.Message(p, "Game difficulty: " + Colors.green + "Normal"); }
|
||||
if (it.Difficulty == TntWarsGame.TntWarsDifficulty.Hard) { Player.Message(p, "Game difficulty: " + Colors.green + "Hard"); }
|
||||
if (it.Difficulty == TntWarsGame.TntWarsDifficulty.Extreme) { Player.Message(p, "Game difficulty: " + Colors.green + "Extreme"); }
|
||||
//4
|
||||
if (cfg.MaxPlayerActiveTnt >= 1) { Player.Message(p, "TNT per player at a time: " + Colors.green + cfg.MaxPlayerActiveTnt); }
|
||||
else if (cfg.MaxPlayerActiveTnt == 0) { Player.Message(p, "TNT per player at a time: " + Colors.green + "unlimited"); }
|
||||
//5
|
||||
if (cfg.InitialGracePeriod) { Player.Message(p, "Grace period: " + Colors.green + "enabled"); }
|
||||
if (!cfg.InitialGracePeriod) { Player.Message(p, "Grace period: " + Colors.green + "disabled"); }
|
||||
//6
|
||||
Player.Message(p, "Grace period time: " + Colors.green + cfg.GracePeriodSeconds + " seconds");
|
||||
//7
|
||||
if (cfg.BalanceTeams) { Player.Message(p, "Balance teams: " + Colors.green + "enabled"); }
|
||||
if (!cfg.BalanceTeams) { Player.Message(p, "Balance teams: " + Colors.green + "disabled"); }
|
||||
//8
|
||||
Player.Message(p, "Score limit: " + Colors.green + it.ScoreLimit + " points");
|
||||
//9
|
||||
if (cfg.Streaks) { Player.Message(p, "Streaks: " + Colors.green + "enabled"); }
|
||||
if (!cfg.Streaks) { Player.Message(p, "Streaks: " + Colors.green + "disabled"); }
|
||||
//10
|
||||
if (cfg.MultiKillBonus == 0) { Player.Message(p, "Multikill bonus: " + Colors.green + "disabled"); }
|
||||
if (cfg.MultiKillBonus != 0) { Player.Message(p, "Multikill bonus: " + Colors.green + "enabled"); }
|
||||
//11
|
||||
Player.Message(p, "Score per kill: " + Colors.green + cfg.ScorePerKill + " points");
|
||||
//12
|
||||
if (cfg.AssistScore == 0) { Player.Message(p, "Assists: " + Colors.green + "disabled"); }
|
||||
if (cfg.AssistScore != 0) { Player.Message(p, "Assists : " + Colors.green + "enabled (at " + cfg.AssistScore + " points)"); }
|
||||
//13
|
||||
if (cfg.TeamKills) { Player.Message(p, "Team killing: " + Colors.green + "enabled"); }
|
||||
if (!cfg.TeamKills) { Player.Message(p, "Team killing: " + Colors.green + "disabled"); }
|
||||
//14
|
||||
|
||||
Player.Message(p, "Gamemode: &a{0} %Sat difficulty &a{1}", it.GameMode, it.Difficulty);
|
||||
Player.Message(p, "TNT per player at a time: &a{0}",
|
||||
cfg.MaxPlayerActiveTnt == 0 ? "unlimited" : cfg.MaxPlayerActiveTnt.ToString());
|
||||
Player.Message(p, "Grace period: {0} %S(for {1} seconds)",
|
||||
GetBool(cfg.InitialGracePeriod), cfg.GracePeriodSeconds);
|
||||
Player.Message(p, "Team balancing: {0}%S, Team killing: {1}",
|
||||
GetBool(cfg.BalanceTeams), GetBool(cfg.TeamKills));
|
||||
Player.Message(p, "Score: Limit of &a{0} %Spoints, &a{1} %Spoints per kill",
|
||||
it.ScoreLimit, cfg.ScorePerKill);
|
||||
Player.Message(p, "Streaks: {0}%S, Multikill bonus: {1}",
|
||||
GetBool(cfg.Streaks), GetBool(cfg.MultiKillBonus != 0));
|
||||
Player.Message(p, "Assists: {0} %S(at {1} points)",
|
||||
GetBool(cfg.AssistScore > 0), cfg.AssistScore);
|
||||
it.CheckAllSetUp(p);
|
||||
//15
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static string GetBool(bool value) { return value ? "&aEnabled" : "&cDisabled"; }
|
||||
|
||||
static void SetSpawn(Player p, ref ushort[] target, string name) {
|
||||
target = new ushort[5];
|
||||
target[0] = (ushort)p.Pos.BlockX;
|
||||
@ -959,10 +938,10 @@ namespace MCGalaxy.Commands.Fun {
|
||||
case "check":
|
||||
case "current":
|
||||
case "c":
|
||||
Player.Message(p, "TNT Wars: {0} is currently {1}", name, target ? "&aenabled" : "&cdisabled"); return false;
|
||||
Player.Message(p, "TNT Wars: {0} is currently {1}", name, GetBool(target)); return false;
|
||||
default:
|
||||
target = !target;
|
||||
Player.Message(p, "TNT Wars: {0} is now {1}", name, target ? "&aenabled" : "&cdisabled"); return true;
|
||||
Player.Message(p, "TNT Wars: {0} is now {1}", name, GetBool(target)); return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using MCGalaxy.Games;
|
||||
|
||||
namespace MCGalaxy.Commands.Info {
|
||||
public sealed class CmdWhere : Command {
|
||||
@ -27,7 +28,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
int matches;
|
||||
Player pl = PlayerInfo.FindMatches(p, message, out matches);
|
||||
if (pl == null) return;
|
||||
if (pl.level.CurrentGame() != null && !(p == null || p.Game.Referee)) {
|
||||
|
||||
if (IGame.GameOn(pl.level) != null && !(p == null || p.Game.Referee)) {
|
||||
Player.Message(p, "You can only use /where on people in games when you are in referee mode."); return;
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ namespace MCGalaxy.Commands.Misc {
|
||||
MessageTooHighRank(p, "teleport to", true); return false;
|
||||
}
|
||||
|
||||
IGame game = target.level.CurrentGame();
|
||||
IGame game = IGame.GameOn(target.level);
|
||||
if (!p.Game.Referee && game != null) {
|
||||
Player.Message(p, "You can only teleport to players in " +
|
||||
"a game when you are in referee mode."); return false;
|
||||
|
@ -26,17 +26,6 @@ using MCGalaxy.Network;
|
||||
using BlockID = System.UInt16;
|
||||
|
||||
namespace MCGalaxy.Games {
|
||||
|
||||
public enum CountdownGameStatus {
|
||||
/// <summary> Countdown is not running. </summary>
|
||||
Disabled,
|
||||
/// <summary> Countdown is running, but no round has begun yet. </summary>
|
||||
Enabled,
|
||||
/// <summary> Timer is counting down to start of round. </summary>
|
||||
RoundCountdown,
|
||||
/// <summary> Round is in progress. </summary>
|
||||
RoundInProgress,
|
||||
}
|
||||
|
||||
class CountdownLevelPicker : LevelPicker {
|
||||
public override List<string> GetCandidateMaps() { return new List<string>() { "countdown" }; }
|
||||
|
@ -25,6 +25,17 @@ namespace MCGalaxy.Games {
|
||||
public Level Map;
|
||||
public bool Running;
|
||||
public abstract string GameName { get; }
|
||||
|
||||
public static VolatileArray<IGame> RunningGames = new VolatileArray<IGame>(false);
|
||||
public static IGame GameOn(Level lvl) {
|
||||
if (lvl == null) return null;
|
||||
IGame[] games = RunningGames.Items;
|
||||
|
||||
foreach (IGame game in games) {
|
||||
if (game.Map == lvl) return game;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual bool HandlesChatMessage(Player p, string message) { return false; }
|
||||
public virtual void PlayerJoinedGame(Player p) { }
|
||||
|
@ -58,6 +58,7 @@ namespace MCGalaxy.Games {
|
||||
RoundsLeft = rounds;
|
||||
Running = true;
|
||||
HookEventHandlers();
|
||||
IGame.RunningGames.Add(this);
|
||||
|
||||
Thread t = new Thread(RunGame);
|
||||
t.Name = "MCG_" + GameName;
|
||||
@ -79,6 +80,7 @@ namespace MCGalaxy.Games {
|
||||
try { End(); }
|
||||
catch (Exception ex2) { Logger.LogError(ex2); }
|
||||
}
|
||||
IGame.RunningGames.Remove(this);
|
||||
}
|
||||
|
||||
protected virtual string GetStartMap(string forcedMap) {
|
||||
@ -174,6 +176,7 @@ namespace MCGalaxy.Games {
|
||||
public override void End() {
|
||||
if (!Running) return;
|
||||
Running = false;
|
||||
IGame.RunningGames.Remove(this);
|
||||
|
||||
UnhookEventHandlers();
|
||||
EndGame();
|
||||
|
@ -754,7 +754,7 @@ namespace MCGalaxy.Games
|
||||
|
||||
}
|
||||
|
||||
public void SendPlayerCheckSetupErrors(Player p)
|
||||
void SendPlayerCheckSetupErrors(Player p)
|
||||
{
|
||||
if (lvl == null)
|
||||
{
|
||||
|
@ -115,14 +115,6 @@ namespace MCGalaxy {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary> The currently active game running on this map,
|
||||
/// or null if there is no game running. </summary>
|
||||
public IGame CurrentGame() {
|
||||
if (Server.zombie.Running && Server.zombie.Map == this) return Server.zombie;
|
||||
if (Server.lava.Running && Server.lava.Map == this) return Server.lava;
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool CanJoin(Player p) {
|
||||
if (p == null) return true;
|
||||
|
||||
|
@ -121,7 +121,7 @@ namespace MCGalaxy {
|
||||
Team team = Game.Team;
|
||||
prefix += team != null ? "<" + team.Color + team.Name + color + "> " : "";
|
||||
|
||||
IGame game = level == null ? null : level.CurrentGame();
|
||||
IGame game = IGame.GameOn(level);
|
||||
if (game != null) game.AdjustPrefix(this, ref prefix);
|
||||
|
||||
bool isDev = Server.Devs.CaselessContains(truename);
|
||||
|
Loading…
x
Reference in New Issue
Block a user