mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-25 06:04:46 -04:00
Fix /xmute with negative intervals, /clones now shows banned players in a separate colour, use display names for join/leave on IRC, show IRC kicks.
This commit is contained in:
parent
62f985fd32
commit
5b9f2d9bc8
@ -28,9 +28,9 @@ namespace MCGalaxy.Commands {
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
bool showInfected = p.Game.Aka;
|
||||
p.Game.Aka = !p.Game.Aka;
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
Player.SendMessage(p, "AKA mode is now: " + (p.Game.Aka ? "&aon" : "&coff"));
|
||||
|
||||
foreach (Player pl in players) {
|
||||
if (pl.level != p.level || p == pl || !Player.CanSee(p, pl) || pl.Game.Referee) continue;
|
||||
|
@ -68,7 +68,12 @@ namespace MCGalaxy.Commands {
|
||||
for (int i = 0; i < alts.Count; i++) {
|
||||
if (alts[i].CaselessEq(value)) return;
|
||||
}
|
||||
alts.Add(value);
|
||||
|
||||
Group grp = Group.findPerm(LevelPermission.Banned);
|
||||
if (Ban.IsBanned(value))
|
||||
alts.Add(grp.color + value + "%S");
|
||||
else
|
||||
alts.Add(value);
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
|
@ -49,8 +49,9 @@ namespace MCGalaxy.Commands
|
||||
if (messageOps)
|
||||
Chat.GlobalMessageOps("To Ops -" + p.color + p.DisplayName + "%S- is now &finvisible%S.");
|
||||
|
||||
Player.SendChatFrom(p, "&c- " + p.FullName + " %S" + PlayerDB.GetLogoutMessage(p), false);
|
||||
Server.IRC.Say(p.DisplayName + " left the game (Disconnected.)");
|
||||
string discMsg = PlayerDB.GetLogoutMessage(p);
|
||||
Player.SendChatFrom(p, "&c- " + p.FullName + " %S" + discMsg, false);
|
||||
Server.IRC.Say(p.DisplayName + " left the game (" + discMsg + ")");
|
||||
if (messageOps && !p.opchat) opchat.Use(p, message);
|
||||
} else {
|
||||
Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
|
||||
|
@ -18,60 +18,49 @@
|
||||
*/
|
||||
using System;
|
||||
using System.Threading;
|
||||
namespace MCGalaxy.Commands
|
||||
{
|
||||
public sealed class CmdXmute : Command
|
||||
{
|
||||
namespace MCGalaxy.Commands {
|
||||
|
||||
public sealed class CmdXmute : Command {
|
||||
|
||||
public override string name { get { return "xmute"; } }
|
||||
public override string shortcut { get { return ""; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message == "") { Help(p); return; }
|
||||
if (p == null) {
|
||||
Player.SendMessage(p, "This command can only be used in-game. Use /mute [Player] instead."); return;
|
||||
}
|
||||
|
||||
var split = message.Split(' ');
|
||||
Player muter = PlayerInfo.FindOrShowMatches(p, split[0]);
|
||||
string[] args = message.Split(' ');
|
||||
Player muter = PlayerInfo.FindOrShowMatches(p, args[0]);
|
||||
if (muter == null) return;
|
||||
|
||||
if (p != null && muter.group.Permission > p.group.Permission)
|
||||
{
|
||||
if (p != null && muter.group.Permission > p.group.Permission) {
|
||||
MessageTooHighRank(p, "xmute", true); return;
|
||||
}
|
||||
if (p == muter)
|
||||
{
|
||||
Player.SendMessage(p, "You cannot use xmute on yourself!");
|
||||
return;
|
||||
if (p == muter) {
|
||||
Player.SendMessage(p, "You cannot use xmute on yourself!"); return;
|
||||
}
|
||||
Command.all.Find("mute").Use(p, muter.name);
|
||||
|
||||
int time = 120;
|
||||
try
|
||||
{
|
||||
time = Convert.ToInt32(message.Split(' ')[1]);
|
||||
if (!int.TryParse(args[1], out time)) {
|
||||
Player.SendMessage(p, "Invalid time given."); Help(p); return;
|
||||
}
|
||||
catch/* (Exception ex)*/
|
||||
{
|
||||
Player.SendMessage(p, "Invalid time given.");
|
||||
Help(p);
|
||||
return;
|
||||
if (time <= 0) {
|
||||
Player.SendMessage(p, "Time must be positive and greater than zero."); return;
|
||||
}
|
||||
|
||||
Player.GlobalMessage(muter.color + muter.DisplayName + Server.DefaultColor + " has been muted for " + time + " seconds");
|
||||
|
||||
Player.GlobalMessage(muter.color + muter.DisplayName + " %Shas been muted for " + time + " seconds");
|
||||
Player.SendMessage(muter, "You have been muted for " + time + " seconds");
|
||||
|
||||
Thread.Sleep(time * 1000);
|
||||
|
||||
Command.all.Find("mute").Use(p, muter.name);
|
||||
}
|
||||
|
||||
// This one controls what happens when you use /help [commandname].
|
||||
public override void Help(Player p)
|
||||
{
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.SendMessage(p, "/xmute <player> <seconds> - Mutes <player> for <seconds> seconds");
|
||||
}
|
||||
}
|
||||
|
@ -140,14 +140,14 @@ namespace MCGalaxy {
|
||||
if (!Server.guestLeaveNotify && p.group.Permission <= LevelPermission.Guest) return;
|
||||
reason = Colors.MinecraftToIrcColors(reason);
|
||||
if (!p.hidden)
|
||||
connection.Sender.PublicMessage(channel, p.name + " left the game (" + reason + ")");
|
||||
connection.Sender.PublicMessage(channel, p.DisplayName + " left the game (" + reason + ")");
|
||||
}
|
||||
|
||||
void Player_PlayerConnect(Player p) {
|
||||
if (!Server.irc || !IsConnected()) return;
|
||||
if (!Server.guestJoinNotify && p.group.Permission <= LevelPermission.Guest) return;
|
||||
if (!p.hidden)
|
||||
connection.Sender.PublicMessage(channel, p.name + " joined the game");
|
||||
connection.Sender.PublicMessage(channel, p.DisplayName + " joined the game");
|
||||
}
|
||||
|
||||
void Listener_OnQuit(UserInfo user, string reason) {
|
||||
@ -155,7 +155,7 @@ namespace MCGalaxy {
|
||||
RemoveNick(user.Nick, chanNicks);
|
||||
if (user.Nick == nick) return;
|
||||
Server.s.Log(user.Nick + " has left IRC");
|
||||
Player.GlobalMessage("%I" + user.Nick + Server.DefaultColor + " has left IRC");
|
||||
Player.GlobalMessage("%I[IRC] " + user.Nick + " has left");
|
||||
}
|
||||
|
||||
void Listener_OnError(ReplyCode code, string message) {
|
||||
@ -394,6 +394,8 @@ namespace MCGalaxy {
|
||||
void Listener_OnKick(UserInfo user, string channel, string kickee, string reason) {
|
||||
List<string> chanNicks = GetNicks(channel);
|
||||
RemoveNick(user.Nick, chanNicks);
|
||||
Server.s.Log(kickee + " kicked " + user.Nick + " from IRC");
|
||||
Player.GlobalMessage("%I[IRC] " + kickee + " kicked " + user.Nick);
|
||||
}
|
||||
|
||||
void Listener_OnKill(UserInfo user, string nick, string reason) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user