Fix /xjail still moving higher ranked players to the xjail map (but not actually jailing them). (thanks lavacraft)

This commit is contained in:
UnknownShadow200 2016-09-05 23:31:39 +10:00
parent b8a306e62c
commit f020920ba5
2 changed files with 19 additions and 16 deletions

View File

@ -39,7 +39,7 @@ namespace MCGalaxy.Commands
if (who == null) return; if (who == null) return;
if (!who.jailed) { if (!who.jailed) {
if (p != null &&who.Rank >= p.Rank) { if (p != null && who.Rank >= p.Rank) {
MessageTooHighRank(p, "jail", false); return; MessageTooHighRank(p, "jail", false); return;
} }
Player.Message(p, "You jailed " + who.DisplayName); Player.Message(p, "You jailed " + who.DisplayName);

View File

@ -1,7 +1,7 @@
/* /*
Copyright 2011 MCForge Copyright 2011 MCForge
Dual-licensed under the Educational Community License, Version 2.0 and Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at obtain a copy of the Licenses at
@ -42,32 +42,35 @@ namespace MCGalaxy.Commands {
return; return;
} }
Player pl = PlayerInfo.FindMatches(p, message); Player who = PlayerInfo.FindMatches(p, message);
if (pl == null) return; if (who == null) return;
if (p != null && who.Rank >= p.Rank) {
MessageTooHighRank(p, "xjail", false); return;
}
Command spawn = Command.all.Find("spawn"); Command spawn = Command.all.Find("spawn");
Command freeze = Command.all.Find("freeze"); Command freeze = Command.all.Find("freeze");
Command mute = Command.all.Find("mute"); Command mute = Command.all.Find("mute");
string data = Server.jailed.Find(pl.name); string data = Server.jailed.Find(who.name);
if (data == null) { if (data == null) {
if (!pl.muted) mute.Use(p, message); if (!who.muted) mute.Use(p, message);
if (!pl.frozen) freeze.Use(p, message); if (!who.frozen) freeze.Use(p, message);
PlayerActions.ChangeMap(pl, xjailMap); PlayerActions.ChangeMap(who, xjailMap);
pl.BlockUntilLoad(10); who.BlockUntilLoad(10);
jail.Use(p, message); jail.Use(p, message);
Chat.MessageAll("{0} %Swas XJailed!", pl.ColoredName); Chat.MessageAll("{0} %Swas XJailed!", who.ColoredName);
} else { } else {
if (pl.muted) mute.Use(p, message); if (who.muted) mute.Use(p, message);
if (pl.frozen) freeze.Use(p, message); if (who.frozen) freeze.Use(p, message);
PlayerActions.ChangeMap(pl, Server.mainLevel.name); PlayerActions.ChangeMap(who, Server.mainLevel.name);
pl.BlockUntilLoad(10); who.BlockUntilLoad(10);
jail.Use(p, message); jail.Use(p, message);
spawn.Use(pl, ""); spawn.Use(who, "");
Chat.MessageAll("{0} %Swas released from XJail!", pl.ColoredName); Chat.MessageAll("{0} %Swas released from XJail!", who.ColoredName);
} }
} }