mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-08 14:48:47 -04:00
Don't allow using most commands while frozen
This commit is contained in:
parent
7d3e91049f
commit
a8e24d3023
@ -36,7 +36,7 @@ namespace MCGalaxy.Gui.Components {
|
||||
get { return _autoScroll; }
|
||||
set {
|
||||
_autoScroll = value;
|
||||
if ( value ) ScrollToEnd(0);
|
||||
if (value) ScrollToEnd(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,11 +79,6 @@ namespace MCGalaxy.Gui.Components {
|
||||
|
||||
/// <summary> Appends text to this textbox. </summary>
|
||||
public void AppendLog(string text, Color color, bool dateStamp) {
|
||||
if (InvokeRequired) {
|
||||
Invoke((MethodInvoker)(() => AppendLog(text, color, dateStamp)));
|
||||
return;
|
||||
}
|
||||
|
||||
int line = GetLineFromCharIndex(Math.Max(0, TextLength - 1));
|
||||
int selLength = SelectionLength, selStart = 0;
|
||||
if (selLength > 0) selStart = SelectionStart;
|
||||
@ -125,7 +120,6 @@ namespace MCGalaxy.Gui.Components {
|
||||
}
|
||||
|
||||
/// <summary> Appends text with a specific color to this textbox. </summary>
|
||||
/// <remarks> NOT THREAD SAFE </remarks>
|
||||
internal void AppendColoredText(string text, Color color) {
|
||||
SelectionStart = TextLength;
|
||||
SelectionLength = 0;
|
||||
|
@ -106,7 +106,7 @@ namespace MCGalaxy.Blocks {
|
||||
BlockProps props = list[b];
|
||||
|
||||
string deathMsg = props.DeathMessage == null ? "" : props.DeathMessage.Replace(":", "\\;");
|
||||
w.WriteLine(b + ":" + props.IsRails + ":" + props.IsTDoor + ":" + props.IsDoor + ":"
|
||||
w.WriteLine(b + ":" + props.IsRails + ":" + props.IsTDoor + ":" + props.IsDoor + ":"
|
||||
+ props.IsMessageBlock + ":" + props.IsPortal + ":" + props.WaterKills + ":"
|
||||
+ props.LavaKills + ":" + props.KillerBlock + ":" + deathMsg + ":"
|
||||
+ (byte)props.AnimalAI + ":" + props.StackBlock + ":" + props.OPBlock + ":"
|
||||
|
@ -102,7 +102,7 @@ namespace MCGalaxy.Blocks.Physics {
|
||||
int i = indices[j];
|
||||
switch (i) {
|
||||
case 0:
|
||||
if (Expand(lvl, (ushort)(x - 1), y, z)) return;
|
||||
if (Expand(lvl, (ushort)(x - 1), y, z)) return;
|
||||
break;
|
||||
case 1:
|
||||
if (Expand(lvl, (ushort)(x + 1), y, z)) return;
|
||||
|
@ -53,7 +53,6 @@ namespace MCGalaxy.Blocks.Physics {
|
||||
}
|
||||
|
||||
static void Firework(ref PhysInfo C, int size, Level lvl, Random rand) {
|
||||
if (lvl.physics < 1 || lvl.physics == 5) return;
|
||||
int rand1 = rand.Next(Block.Red, Block.White);
|
||||
int rand2 = rand.Next(Block.Red, Block.White);
|
||||
int min = Math.Min(rand1, rand2), max = Math.Max(rand1, rand2);
|
||||
|
@ -81,9 +81,7 @@ namespace MCGalaxy.Blocks.Physics {
|
||||
|
||||
case Block.Sand:
|
||||
if (lvl.physics > 1) { //Adv physics changes sand to glass next to lava
|
||||
if (lvl.physics != 5) {
|
||||
lvl.AddUpdate(index, Block.Glass, default(PhysicsArgs));
|
||||
}
|
||||
lvl.AddUpdate(index, Block.Glass, default(PhysicsArgs));
|
||||
} else {
|
||||
lvl.AddCheck(index);
|
||||
} break;
|
||||
|
@ -17,6 +17,7 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
public override string name { get { return "AdminChat"; } }
|
||||
public override string shortcut { get { return "Admin"; } }
|
||||
public override string type { get { return CommandTypes.Chat; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
public override CommandPerm[] ExtraPerms {
|
||||
get { return new[] { new CommandPerm(LevelPermission.Admin, "+ can read adminchat messages") }; }
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
public override string name { get { return "Clear"; } }
|
||||
public override string shortcut { get { return "cls"; } }
|
||||
public override string type { get { return CommandTypes.Chat; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("PlayerCLS"), new CommandAlias("GlobalCLS", "global"), new CommandAlias("gcls", "global") }; }
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
public override string name { get { return "Me"; } }
|
||||
public override string type { get { return CommandTypes.Chat; } }
|
||||
public override bool SuperUseable { get { return false; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message.Length == 0) { Player.Message(p, "You"); return; }
|
||||
|
@ -20,6 +20,7 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
public override string name { get { return "OpChat"; } }
|
||||
public override string shortcut { get { return "Op"; } }
|
||||
public override string type { get { return CommandTypes.Chat; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
public override CommandPerm[] ExtraPerms {
|
||||
get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can read opchat messages") }; }
|
||||
}
|
||||
|
@ -25,7 +25,8 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
public override string shortcut { get { return "rm"; } }
|
||||
public override string type { get { return CommandTypes.Chat; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message.Length == 0) { Help(p); return; }
|
||||
if (!MessageCmd.CanSpeak(p, name)) return;
|
||||
|
@ -24,7 +24,8 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
public override string name { get { return "Send"; } }
|
||||
public override string type { get { return CommandTypes.Chat; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
string[] parts = message.SplitSpaces(2);
|
||||
if (message.Length == 0 || parts.Length == 1) { Help(p); return; }
|
||||
|
@ -20,7 +20,8 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
public override string name { get { return "Whisper"; } }
|
||||
public override string type { get { return CommandTypes.Chat; } }
|
||||
public override bool SuperUseable { get { return false; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message.Length == 0) {
|
||||
p.whisper = !p.whisper; p.whisperTo = "";
|
||||
|
@ -51,7 +51,9 @@ namespace MCGalaxy {
|
||||
/// <summary> Whether this command is restricted in usage in message blocks.
|
||||
/// Restricted commands require the player to have the extra permission for /mb to be able to be placed in message blocks. </summary>
|
||||
public virtual bool MessageBlockRestricted { get { return false; } }
|
||||
|
||||
/// <summary> Whether this command can be used by players who are frozen. </summary>
|
||||
public virtual bool UseableWhenFrozen { get { return false; } }
|
||||
|
||||
public static CommandList all = new CommandList();
|
||||
public static CommandList core = new CommandList();
|
||||
|
||||
|
@ -21,7 +21,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
public sealed class CmdBanInfo : Command {
|
||||
public override string name { get { return "BanInfo"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (CheckSuper(p, message, "player name")) return;
|
||||
if (message.Length == 0) message = p.name;
|
||||
|
@ -24,6 +24,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
public sealed class CmdBlocks : Command {
|
||||
public override string name { get { return "Blocks"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("Materials") }; }
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
public override string shortcut { get { return "Alts"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("WhoIP") }; }
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
public override string name { get { return "Commands"; } }
|
||||
public override string shortcut { get { return "Cmds"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("CmdList") }; }
|
||||
}
|
||||
|
@ -20,7 +20,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
public override string name { get { return "Devs"; } }
|
||||
public override string shortcut { get { return "Dev"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message.Length > 0) { Help(p); return; }
|
||||
Player.Message(p, "&9{1} devs: %S{0}", Server.Devs.Join(), Server.SoftwareName);
|
||||
|
@ -21,7 +21,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
public sealed class CmdFaq : Command {
|
||||
public override string name { get { return "FAQ"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
TextFile faqFile = TextFile.Files["FAQ"];
|
||||
faqFile.EnsureExists();
|
||||
|
@ -22,6 +22,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
public sealed class CmdHelp : Command {
|
||||
public override string name { get { return "Help"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("CmdHelp"), new CommandAlias("Ranks", "ranks"),
|
||||
new CommandAlias("Colors", "colors"), new CommandAlias("Emotes", "emotes") }; }
|
||||
|
@ -22,7 +22,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
public override string name { get { return "Levels"; } }
|
||||
public override string shortcut { get { return "Maps"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
Level[] loaded = LevelInfo.Loaded.Items;
|
||||
Player.Message(p, "Loaded maps [physics level] (&c[no] %Sif not visitable): ");
|
||||
|
@ -30,6 +30,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
public override string shortcut { get { return "mi"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("WInfo"), new CommandAlias("WorldInfo") }; }
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
public sealed class CmdNews : Command {
|
||||
public override string name { get { return "News"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
TextFile newsText = TextFile.Files["News"];
|
||||
|
@ -21,7 +21,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
public sealed class CmdOpRules : Command {
|
||||
public override string name { get { return "OpRules"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
TextFile oprulesFile = TextFile.Files["OpRules"];
|
||||
oprulesFile.EnsureExists();
|
||||
|
@ -26,6 +26,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
public sealed class CmdOpStats : Command {
|
||||
public override string name { get { return "OpStats"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
string end = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
@ -24,7 +24,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
public override string name { get { return "PClients"; } }
|
||||
public override string shortcut { get { return "Clients"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
Dictionary<string, List<Player>> clients = new Dictionary<string, List<Player>>();
|
||||
Player[] online = PlayerInfo.Online.Items;
|
||||
|
@ -25,7 +25,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
public override string shortcut { get { return "ri"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (CheckSuper(p, message, "player name")) return;
|
||||
if (message.Length == 0) message = p.name;
|
||||
|
@ -25,7 +25,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
public override string name { get { return "Search"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
string[] args = message.SplitSpaces(3);
|
||||
if (args.Length < 2) { Help(p); return; }
|
||||
|
@ -22,7 +22,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
public sealed class CmdSeen : Command {
|
||||
public override string name { get { return "Seen"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message.Length == 0) { Help(p); return; }
|
||||
|
||||
|
@ -25,6 +25,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
public override string name { get { return "ServerInfo"; } }
|
||||
public override string shortcut { get { return "SInfo"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("Host"), new CommandAlias("ZAll") }; }
|
||||
}
|
||||
|
@ -23,7 +23,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
public override string name { get { return "Time"; } }
|
||||
public override string shortcut { get { return "ti"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
Player.Message(p, "Server time: {0:HH:mm:ss} on {0:d}", DateTime.Now);
|
||||
if (!Server.zombie.Running) return;
|
||||
|
@ -22,7 +22,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
public sealed class CmdView : Command {
|
||||
public override string name { get { return "View"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (!Directory.Exists("extra/text/"))
|
||||
Directory.CreateDirectory("extra/text");
|
||||
|
@ -23,6 +23,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
public sealed class CmdViewRanks : Command {
|
||||
public override string name { get { return "ViewRanks"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("Ops", "operator"), new CommandAlias("Admins", "superop"),
|
||||
new CommandAlias("Banned", "banned"), new CommandAlias("BanList", "banned") }; }
|
||||
|
@ -23,7 +23,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
public override string name { get { return "WhoNick"; } }
|
||||
public override string shortcut { get { return "RealName"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message.Length == 0) { Help(p); return; }
|
||||
Player nick = FindNick(p, message);
|
||||
|
@ -23,6 +23,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
public override string name { get { return "WhoIs"; } }
|
||||
public override string shortcut { get { return "WhoWas"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
public override CommandPerm[] ExtraPerms {
|
||||
get { return new[] { new CommandPerm(LevelPermission.AdvBuilder, "+ can see player's IP and if on whitelist") }; }
|
||||
}
|
||||
|
@ -25,7 +25,8 @@ namespace MCGalaxy.Commands.Info {
|
||||
public override string name { get { return "Worlds"; } }
|
||||
public override string shortcut { get { return "Unloaded"; } }
|
||||
public override string type { get { return CommandTypes.Information; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
string[] files = LevelInfo.AllMapFiles();
|
||||
Player.Message(p, "Maps (&c[no] %Sif not visitable): ");
|
||||
|
@ -161,7 +161,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
public override string shortcut { get { return "ZTest"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
Player.Message(p, "Place or delete a block where you would like to check for zones.");
|
||||
p.MakeSelection(1, null, TestZone);
|
||||
@ -197,7 +197,8 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
public override string shortcut { get { return "Zones"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
|
||||
public override bool UseableWhenFrozen { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
Zone[] zones = p.level.Zones.Items;
|
||||
MultiPageOutput.Output(p, zones, FormatZone, "ZoneList", "zones", message, true);
|
||||
|
@ -68,7 +68,7 @@ namespace MCGalaxy.Core {
|
||||
p.aiming = false;
|
||||
p.ClearBlockchange();
|
||||
}
|
||||
if (!p.level.Config.UseBlockDB) {
|
||||
if (!level.Config.UseBlockDB) {
|
||||
Player.Message(p, "BlockDB is disabled here, &cyou will not be able to /undo or /redo");
|
||||
}
|
||||
}
|
||||
|
@ -742,6 +742,9 @@ namespace MCGalaxy {
|
||||
if (level.IsMuseum && !command.museumUsable ) {
|
||||
SendMessage("Cannot use this command while in a museum."); return null;
|
||||
}
|
||||
if (frozen && !command.UseableWhenFrozen) {
|
||||
SendMessage("Cannot use this command while frozen."); return null;
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user