Core: Make /summon require an extra permission to summon all players.

This commit is contained in:
UnknownShadow200 2016-09-14 09:36:28 +10:00
parent 8ea543898d
commit 9d4121c77d
5 changed files with 48 additions and 40 deletions

View File

@ -40,8 +40,8 @@ namespace MCGalaxy.Commands {
}
public override void Help(Player p) {
Player.Message(p, "%T/impersonate <player> <message>");
Player.Message(p, "%HSends a message as if it came from <player>");
Player.Message(p, "%T/impersonate [player] [message]");
Player.Message(p, "%HSends a message as if it came from [player]");
}
}
}

View File

@ -47,7 +47,7 @@ namespace MCGalaxy.Commands {
}
public override void Help(Player p) {
Player.Message(p, "%T/sendcmd <player> <command> [arguments]");
Player.Message(p, "%T/sendcmd [player] [command] <arguments>");
Player.Message(p, "%HMake another user use a command. (e.g /sendcmd bob tp bob2)");
}
}

View File

@ -26,7 +26,10 @@ namespace MCGalaxy.Commands {
public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("fetch") }; }
get { return new[] { new CommandAlias("fetch"), new CommandAlias("bring") }; }
}
public override CommandPerm[] ExtraPerms {
get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can summon all players") }; }
}
public CmdSummon() { }
@ -35,6 +38,13 @@ namespace MCGalaxy.Commands {
if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (message.CaselessEq("all")) {
if (CheckExtraPerm(p)) SummonAll(p);
} else {
SummonPlayer(p, message);
}
}
static void SummonAll(Player p) {
Player[] players = PlayerInfo.Online.Items;
foreach (Player pl in players) {
if (pl.level == p.level && pl != p && p.Rank > pl.Rank) {
@ -42,10 +52,10 @@ namespace MCGalaxy.Commands {
pl.SendMessage("You were summoned by " + p.ColoredName + "%S.");
}
}
Chat.MessageAll("{0} %Ssummoned everyone!", p.ColoredName);
return;
Chat.MessageLevel(p.level, p.ColoredName + " %Ssummoned everyone");
}
static void SummonPlayer(Player p, string message) {
Player who = PlayerInfo.FindMatches(p, message);
if (who == null) return;
if (p.Rank < who.Rank) {
@ -53,19 +63,19 @@ namespace MCGalaxy.Commands {
}
if (p.level != who.level) {
Player.Message(p, who.ColoredName + " %Sis in a different Level. Forcefetching has started!");
Player.Message(p, who.ColoredName + " %Sis in a different Level, moving them..");
PlayerActions.ChangeMap(who, p.level);
Thread.Sleep(1000);
// Sleep for a bit while they load
p.BlockUntilLoad(10); // wait for them to load
}
if (p.level != who.level) return; // in case they were unable to move to this level
who.SendOwnHeadPos(p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0);
who.SendMessage("You were summoned by " + p.ColoredName + "%S.");
}
public override void Help(Player p) {
Player.Message(p, "%T/summon <player>");
Player.Message(p, "%HSummons a player to your position.");
Player.Message(p, "%T/summon [player]");
Player.Message(p, "%HSummons [player] to your position.");
Player.Message(p, "%T/summon all");
Player.Message(p, "%HSummons all players in your map");
}

View File

@ -15,10 +15,8 @@
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
namespace MCGalaxy.Commands
{
public sealed class CmdTimer : Command
{
namespace MCGalaxy.Commands {
public sealed class CmdTimer : Command {
public override string name { get { return "timer"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Other; } }