mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 03:55:18 -04:00
For consistency with pretty much all other server software, /ban kicks player too if online
This commit is contained in:
parent
eb97813b01
commit
db2bbf9246
@ -23,6 +23,9 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
public override string name { get { return "Ban"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new CommandAlias[] { new CommandAlias("KickBan"), new CommandAlias("kb") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message.Length == 0) { Help(p); return; }
|
||||
@ -57,7 +60,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/Ban [player] <reason>");
|
||||
Player.Message(p, "%HBans a player without kicking them.");
|
||||
Player.Message(p, "%HBans a player (and kicks them if online).");
|
||||
Player.Message(p, "%HFor <reason>, @number can be used as a shortcut for that rule.");
|
||||
}
|
||||
}
|
||||
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
namespace MCGalaxy.Commands.Moderation {
|
||||
public sealed class CmdKickban : Command {
|
||||
public override string name { get { return "KickBan"; } }
|
||||
public override string shortcut { get { return "kb"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message.Length == 0) { Help(p); return; }
|
||||
Command.all.FindByName("Ban").Use(p, message);
|
||||
Command.all.FindByName("Kick").Use(p, message);
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/KickBan [player] <reason>");
|
||||
Player.Message(p, "%HKicks and bans a player with an optional message.");
|
||||
}
|
||||
}
|
||||
}
|
@ -138,7 +138,7 @@ namespace MCGalaxy.Core {
|
||||
|
||||
if (e.Duration.Ticks != 0) {
|
||||
string banner = e.Actor == null ? "(console)" : e.Actor.truename;
|
||||
DateTime end = DateTime.UtcNow.Add(e.Duration);
|
||||
DateTime end = DateTime.UtcNow.Add(e.Duration);
|
||||
Server.tempBans.AddOrReplace(e.Target, Ban.PackTempBanData(e.Reason, banner, end));
|
||||
Server.tempBans.Save();
|
||||
|
||||
@ -148,6 +148,11 @@ namespace MCGalaxy.Core {
|
||||
Ban.DeleteBan(e.Target);
|
||||
Ban.BanPlayer(e.Actor, e.Target, e.Reason, !e.Announce, e.TargetGroup.Name);
|
||||
ModActionCmd.ChangeRank(e.Target, e.targetGroup, Group.BannedRank, who);
|
||||
|
||||
if (who != null) {
|
||||
string msg = e.Reason.Length == 0 ? ServerConfig.DefaultBanMessage : e.Reason;
|
||||
who.Kick("Banned by " + e.ActorName + ": " + msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,6 @@
|
||||
<Compile Include="Commands\Moderation\CmdJail.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdJoker.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdKick.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdKickban.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdLocation.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdModerate.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdMoveAll.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user