mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
make games commands have 1 extra permission to maange them
This commit is contained in:
parent
ad4f3bf457
commit
a15b3aeccd
@ -27,8 +27,10 @@ namespace MCGalaxy.Commands.Fun {
|
||||
public override string shortcut { get { return "CTFSetup"; } }
|
||||
public override string type { get { return CommandTypes.Games; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
public override bool SuperUseable { get { return false; } }
|
||||
public override CommandPerm[] ExtraPerms {
|
||||
get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can manage CTF") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message.CaselessEq("go")) {
|
||||
@ -56,17 +58,19 @@ namespace MCGalaxy.Commands.Fun {
|
||||
PlayerActions.ChangeMap(p, Server.ctf.Map.name);
|
||||
}
|
||||
|
||||
static void HandleStart(Player p) {
|
||||
void HandleStart(Player p) {
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (Server.ctf == null) {
|
||||
Player.Message(p, "Initialising CTF..");
|
||||
Server.ctf = new CTFGame();
|
||||
}
|
||||
|
||||
if (!Server.ctf.Start(p)) return;
|
||||
Chat.MessageGlobal("A CTF GAME IS STARTING AT CTF! TYPE %T/Goto " + Server.ctf.Map.name + " %Sto join!");
|
||||
Chat.MessageGlobal("A CTF GAME IS STARTING! TYPE %T/CTF goto %Sto join!");
|
||||
}
|
||||
|
||||
static void HandleStop(Player p) {
|
||||
void HandleStop(Player p) {
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (Server.ctf == null || !Server.ctf.started) {
|
||||
Player.Message(p, "No CTF game is active."); return;
|
||||
}
|
||||
@ -74,7 +78,8 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
|
||||
static void HandleAdd(Player p) {
|
||||
void HandleAdd(Player p) {
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (!Directory.Exists("CTF")) Directory.CreateDirectory("CTF");
|
||||
List<string> maps = GetCtfMaps();
|
||||
|
||||
@ -87,7 +92,8 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
}
|
||||
|
||||
static void HandleRemove(Player p) {
|
||||
void HandleRemove(Player p) {
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (!Directory.Exists("CTF")) Directory.CreateDirectory("CTF");
|
||||
List<string> maps = GetCtfMaps();
|
||||
|
||||
@ -107,6 +113,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
|
||||
|
||||
void HandleSet(Player p, string property) {
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
CTFConfig cfg = RetrieveConfig(p);
|
||||
|
||||
if (property.CaselessEq("bluespawn")) {
|
||||
@ -176,12 +183,11 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/CTF go %H- Moves you to the current CTF map.");
|
||||
Player.Message(p, "%T/CTF start/stop %H- Starts/stops the CTF game.");
|
||||
Player.Message(p, "%T/CTF add/remove");
|
||||
Player.Message(p, "%HAdds or removes current map from list of CTF maps.");
|
||||
Player.Message(p, "%T/CTF start/stop %H- Starts/stops the CTF game");
|
||||
Player.Message(p, "%T/CTF add/remove %H- Adds/removes current map from CTF map list");
|
||||
Player.Message(p, "%T/CTF set [property]");
|
||||
Player.Message(p, "%HSets a CTF game property, see %T/Help CTF set");
|
||||
Player.Message(p, "%T/CTF go %H- Moves you to the current CTF map");
|
||||
}
|
||||
|
||||
public override void Help(Player p, string message) {
|
||||
|
@ -33,10 +33,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public override bool SuperUseable { get { return false; } }
|
||||
public override CommandPerm[] ExtraPerms {
|
||||
get { return new[] {
|
||||
new CommandPerm(LevelPermission.Operator, "+ can send the countdown rules to everybody"),
|
||||
new CommandPerm(LevelPermission.Operator, "+ can setup and manage countdown"),
|
||||
}; }
|
||||
get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can manage countdown") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
@ -152,30 +149,15 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleRules(Player p, string target) {
|
||||
Player who = p;
|
||||
if (target.Length > 0 && HasExtraPerm(p, 1)) {
|
||||
who = PlayerInfo.FindMatches(p, target);
|
||||
if (who == null) return;
|
||||
|
||||
if (p.Rank < who.Rank) {
|
||||
MessageTooHighRank(p, "send countdown rules", true); return;
|
||||
}
|
||||
}
|
||||
|
||||
Player.Message(who, "The aim of the game is to stay alive the longest.");
|
||||
Player.Message(who, "Don't fall in the lava!");
|
||||
Player.Message(who, "Blocks on the ground will disapear randomly, first going yellow, then orange, then red and finally disappearing.");
|
||||
Player.Message(who, "The last person alive wins!");
|
||||
|
||||
if (p != who) {
|
||||
Player.Message(who, "Countdown rules sent to you by " + p.ColoredName);
|
||||
Player.Message(p, "Countdown rules sent to: " + who.ColoredName);
|
||||
}
|
||||
Player.Message(p, "The aim of the game is to stay alive the longest.");
|
||||
Player.Message(p, "Don't fall in the lava!");
|
||||
Player.Message(p, "Blocks on the ground will disapear randomly, first going yellow, then orange, then red and finally disappearing.");
|
||||
Player.Message(p, "The last person alive wins!");
|
||||
}
|
||||
|
||||
|
||||
void HandleGenerate(Player p, CountdownGame game, string x, string y, string z) {
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
|
||||
int width, height, length;
|
||||
if(!int.TryParse(x, out width) || !int.TryParse(y, out height) || !int.TryParse(z, out length)) {
|
||||
@ -190,7 +172,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleEnable(Player p, CountdownGame game) {
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
|
||||
if (game.Status == CountdownGameStatus.Disabled) {
|
||||
game.Enable(p);
|
||||
@ -200,7 +182,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleDisable(Player p, CountdownGame game) {
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
|
||||
if (game.Status == CountdownGameStatus.Disabled) {
|
||||
Player.Message(p, "Countdown is not running."); return;
|
||||
@ -210,7 +192,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
|
||||
|
||||
void HandleStart(Player p, CountdownGame game, string speed, string mode) {
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
|
||||
switch (game.Status) {
|
||||
case CountdownGameStatus.Disabled:
|
||||
@ -243,7 +225,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleEnd(Player p, CountdownGame game) {
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
|
||||
switch (game.Status) {
|
||||
case CountdownGameStatus.Disabled:
|
||||
@ -256,7 +238,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleReset(Player p, CountdownGame game, string type) {
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
|
||||
switch (game.Status) {
|
||||
case CountdownGameStatus.Disabled:
|
||||
@ -273,14 +255,6 @@ namespace MCGalaxy.Commands.Fun {
|
||||
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/CD join/leave %H- joins/leaves the game");
|
||||
Player.Message(p, "%T/CD players %H- lists players currently playing");
|
||||
Player.Message(p, "%T/CD rules %H- view the rules of countdown");
|
||||
if (HasExtraPerm(p, 1)) {
|
||||
Player.Message(p, "%T/CD rules [player] %H- sends rules to that player.");
|
||||
}
|
||||
|
||||
if (!HasExtraPerm(p, 2)) return;
|
||||
Player.Message(p, "%T/CD generate [width] [height] [length] %H- generates the countdown map (default is 32x32x32)");
|
||||
Player.Message(p, "%T/CD enable/disable %H- enables/disables countdown");
|
||||
Player.Message(p, "%T/CD start <speed> <mode> %H- starts a round of countdown");
|
||||
@ -288,6 +262,9 @@ namespace MCGalaxy.Commands.Fun {
|
||||
Player.Message(p, "%H mode can be: normal or freeze");
|
||||
Player.Message(p, "%T/CD end %H- force ends current round of countdown");
|
||||
Player.Message(p, "%T/CD reset %H- resets the map. %T/CD start %Halso resets map.");
|
||||
Player.Message(p, "%T/CD join/leave %H- joins/leaves the game");
|
||||
Player.Message(p, "%T/CD players %H- lists players currently playing");
|
||||
Player.Message(p, "%T/CD rules %H- view the rules of countdown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
public override string type { get { return CommandTypes.Games; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public override CommandPerm[] ExtraPerms {
|
||||
get { return new[] { new CommandPerm(LevelPermission.Admin, "+ can setup lava survival"),
|
||||
new CommandPerm(LevelPermission.Operator, "+ can start/stop lava survival") }; }
|
||||
get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can manage lava survival") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
@ -262,17 +261,12 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/LS go %H- Join the fun!");
|
||||
Player.Message(p, "%T/LS info %H- View current round info and time.");
|
||||
|
||||
if (HasExtraPerm(p, 1)) {
|
||||
Player.Message(p, "%T/LS start <map> %H- Starts Lava Survival, optionally on the given map.");
|
||||
Player.Message(p, "%T/LS stop %H- Stops the current Lava Survival game.");
|
||||
Player.Message(p, "%T/LS end %H- End the current round or vote.");
|
||||
}
|
||||
if (HasExtraPerm(p, 2)) {
|
||||
Player.Message(p, "%T/LS setup %H- Setup lava survival, use it for more info.");
|
||||
}
|
||||
Player.Message(p, "%T/LS info %H- View current round info and time.");
|
||||
Player.Message(p, "%T/LS go %H- Join the fun!");
|
||||
}
|
||||
|
||||
void SetupHelp(Player p, string mode = "") {
|
||||
|
@ -18,6 +18,7 @@
|
||||
using System;
|
||||
|
||||
namespace MCGalaxy.Commands.Fun {
|
||||
|
||||
public class CmdMapLike : Command {
|
||||
public override string name { get { return "MapLike"; } }
|
||||
public override string shortcut { get { return "Like"; } }
|
||||
|
@ -25,10 +25,12 @@ namespace MCGalaxy.Commands.Fun {
|
||||
public override string shortcut { get { return "ZG"; } }
|
||||
public override string type { get { return CommandTypes.Games; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("ZS"), new CommandAlias("ZombieSurvival") }; }
|
||||
}
|
||||
public override CommandPerm[] ExtraPerms {
|
||||
get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can manage zombie survival") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
ZSGame game = Server.zombie;
|
||||
@ -76,7 +78,8 @@ namespace MCGalaxy.Commands.Fun {
|
||||
Player.Message(p, "Running on map: " + game.MapName);
|
||||
}
|
||||
|
||||
static void HandleStart(Player p, ZSGame game, string[] args) {
|
||||
void HandleStart(Player p, ZSGame game, string[] args) {
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (game.Running) {
|
||||
Player.Message(p, "There is already a Zombie Survival game currently in progress."); return;
|
||||
}
|
||||
@ -94,7 +97,8 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
}
|
||||
|
||||
static void HandleEnd(Player p, ZSGame game) {
|
||||
void HandleEnd(Player p, ZSGame game) {
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (game.RoundInProgress) {
|
||||
game.EndRound();
|
||||
} else {
|
||||
@ -102,7 +106,8 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
}
|
||||
|
||||
static void HandleStop(Player p, ZSGame game) {
|
||||
void HandleStop(Player p, ZSGame game) {
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (!game.Running) {
|
||||
Player.Message(p, "There is no Zombie Survival game currently in progress."); return;
|
||||
}
|
||||
@ -119,14 +124,15 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleSet(Player p, ZSGame game, string[] args) {
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (args.Length == 1) { Help(p, "set"); return; }
|
||||
|
||||
if (args[1].CaselessEq("hitbox")) { HandleHitbox(p, game, args); return; }
|
||||
if (args[1].CaselessEq("maxmove")) { HandleMaxMove(p, game, args); return; }
|
||||
if (args[1].CaselessEq("hitbox")) { SetHitbox(p, game, args); return; }
|
||||
if (args[1].CaselessEq("maxmove")) { SetMaxMove(p, game, args); return; }
|
||||
Help(p, "set");
|
||||
}
|
||||
|
||||
static void HandleHitbox(Player p, ZSGame game, string[] args) {
|
||||
static void SetHitbox(Player p, ZSGame game, string[] args) {
|
||||
if (args.Length == 2) {
|
||||
Player.Message(p, "Hitbox detection is currently &a" + ZSConfig.HitboxPrecision + " %Sunits apart.");
|
||||
return;
|
||||
@ -140,7 +146,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
ZSConfig.SaveSettings();
|
||||
}
|
||||
|
||||
static void HandleMaxMove(Player p, ZSGame game, string[] args) {
|
||||
static void SetMaxMove(Player p, ZSGame game, string[] args) {
|
||||
if (args.Length == 2) {
|
||||
Player.Message(p, "Maxmium move distance is currently &a" + ZSConfig.MaxMoveDistance + " %Sunits apart.");
|
||||
return;
|
||||
@ -155,14 +161,14 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/ZG status %H- Outputs current status of Zombie Survival.");
|
||||
Player.Message(p, "%T/ZG go %H- Moves you to the current Zombie Survival map.");
|
||||
Player.Message(p, "%T/ZG start 0 %H- Runs Zombie Survival for infinite rounds.");
|
||||
Player.Message(p, "%T/ZG start [x] %H- Runs Zombie Survival for [x] rounds.");
|
||||
Player.Message(p, "%T/ZG end %H- Ends current round of Zombie Survival.");
|
||||
Player.Message(p, "%T/ZG stop %H- Immediately stops Zombie Survival.");
|
||||
Player.Message(p, "%T/ZG set [property] [value]");
|
||||
Player.Message(p, "%HSets a Zombie Survival game property, see %T/Help ZG set");
|
||||
Player.Message(p, "%T/ZG status %H- Outputs current status of Zombie Survival.");
|
||||
Player.Message(p, "%T/ZG go %H- Moves you to the current Zombie Survival map.");
|
||||
}
|
||||
|
||||
public override void Help(Player p, string message) {
|
||||
|
@ -162,12 +162,11 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/Report [Player] [Reason] %H- Reports that player for the given reason.");
|
||||
if (!HasExtraPerm(p, 1)) return;
|
||||
Player.Message(p, "%T/Report list %H- Lists all reported players.");
|
||||
Player.Message(p, "%T/Report check [Player] %H- Views reports for that player.");
|
||||
Player.Message(p, "%T/Report delete [Player] %H- Deletes reports for that player.");
|
||||
Player.Message(p, "%T/Report clear %H- Clears &call%H reports.");
|
||||
Player.Message(p, "%T/Report [Player] [Reason] %H- Reports that player for the given reason.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user