mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-19 12:18:03 -04:00
Merge pull request #7 from Fire200055/master
Added quit command, updated heartbeat so it shows if there's an error when finding URL, and made IRC commands better.
This commit is contained in:
commit
d149cb07f5
33
Commands/CmdQuit.cs
Normal file
33
Commands/CmdQuit.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MCGalaxy.Commands
|
||||
{
|
||||
public sealed class CmdQuit : Command
|
||||
{
|
||||
public override string name { get { return "quit"; } }
|
||||
public override string shortcut { get { return ""; } }
|
||||
public override string type { get { return "other"; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
|
||||
public CmdQuit() { }
|
||||
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
if (message != "")
|
||||
{
|
||||
p.Kick("Left the game: " + message);
|
||||
}
|
||||
else
|
||||
{
|
||||
p.Kick("Left the game.");
|
||||
}
|
||||
}
|
||||
public override void Help(Player p)
|
||||
{
|
||||
Player.SendMessage(p, "/quit <reason> - Leave the server.");
|
||||
}
|
||||
}
|
||||
}
|
@ -319,6 +319,7 @@ namespace MCGalaxy
|
||||
all.Add(new CmdZombieGame());
|
||||
all.Add(new CmdZone());
|
||||
all.Add(new CmdZz());
|
||||
all.Add(new CmdQuit());
|
||||
core.commands = new List<Command>(all.commands);
|
||||
Scripting.Autoload();
|
||||
}
|
||||
|
10
ForgeBot.cs
10
ForgeBot.cs
@ -175,15 +175,16 @@ namespace MCGalaxy {
|
||||
void Listener_OnPublic(UserInfo user, string channel, string message) {
|
||||
//string allowedchars = "1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./!@#$%^*()_+QWERTYUIOPASDFGHJKL:\"ZXCVBNM<>? ";
|
||||
// Allowed chars are any ASCII char between 20h/32 and 7Ah/122 inclusive, except for 26h/38 (&) and 60h/96 (`)
|
||||
if(message.StartsWith(".who") || message.StartsWith(".players"))
|
||||
string ircCommand = message.Split(' ')[0].ToLower();
|
||||
if (ircCommand == ".who" || ircCommand == ".players")
|
||||
{
|
||||
CmdPlayers();
|
||||
}
|
||||
if(message.StartsWith(".x"))
|
||||
if (ircCommand == ".x")
|
||||
{
|
||||
if (Server.ircControllers.Contains(user.Nick))
|
||||
{
|
||||
if (message.Split(' ')[1] == "resetbot" || banCmd.Contains(message.Split(' ')[0])) { Server.IRC.Say("You cannot use this command from IRC!"); return; }
|
||||
if (message.Split(' ')[1].Equals("resetbot", StringComparison.OrdinalIgnoreCase) || banCmd.Contains(ircCommand)) { Server.IRC.Say("You cannot use this command from IRC!"); return; }
|
||||
if (Player.CommandHasBadColourCodes(null, message)) { Server.IRC.Say("Your command had invalid color codes!"); return; }
|
||||
|
||||
Command cmd = Command.all.Find(message.Split(' ')[1]);
|
||||
@ -218,7 +219,6 @@ namespace MCGalaxy {
|
||||
if(String.IsNullOrEmpty(message.Trim()))
|
||||
message = ".";
|
||||
|
||||
|
||||
if (channel == opchannel) {
|
||||
Server.s.Log(String.Format("(OPs): [IRC] {0}: {1}", user.Nick, message));
|
||||
Player.GlobalMessageOps(String.Format("To Ops &f-{0}[IRC] {1}&f- {2}", Server.IRCColour, user.Nick, Server.profanityFilter ? ProfanityFilter.Parse(message) : message));
|
||||
@ -235,7 +235,7 @@ namespace MCGalaxy {
|
||||
retries = 0;
|
||||
if (Server.ircIdentify && Server.ircPassword != "") {
|
||||
Server.s.Log("Identifying with NickServ");
|
||||
connection.Sender.PrivateMessage("nickserv", "IDENTIFY " + Server.ircPassword);
|
||||
connection.Sender.PrivateMessage("NickServ", "IDENTIFY " + Server.ircPassword);
|
||||
}
|
||||
|
||||
Server.s.Log("Joining channels...");
|
||||
|
@ -59,12 +59,21 @@ namespace MCGalaxy
|
||||
{
|
||||
Server.Hash = newHash;
|
||||
Server.URL = line;
|
||||
Server.s.UpdateUrl(Server.URL);
|
||||
File.WriteAllText("text/externalurl.txt", Server.URL);
|
||||
if (UrlSaid == false)
|
||||
if (!Server.URL.Contains("\"errors\": ["))
|
||||
{
|
||||
Server.s.Log("ClassiCube URL found: " + Server.URL);
|
||||
UrlSaid = true;
|
||||
Server.s.UpdateUrl(Server.URL);
|
||||
File.WriteAllText("text/externalurl.txt", Server.URL);
|
||||
if (UrlSaid == false)
|
||||
{
|
||||
Server.s.Log("ClassiCube URL found: " + Server.URL);
|
||||
UrlSaid = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Server.URL = "Error while finding URL. Is the port open?";
|
||||
Server.s.UpdateUrl(Server.URL);
|
||||
Server.s.Log(Server.URL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +123,7 @@
|
||||
<Compile Include="Commands\CmdGcrules.cs" />
|
||||
<Compile Include="Commands\CmdModel.cs" />
|
||||
<Compile Include="Commands\CmdMods.cs" />
|
||||
<Compile Include="Commands\CmdQuit.cs" />
|
||||
<Compile Include="Commands\CmdSearch.cs" />
|
||||
<Compile Include="Commands\CmdStaff.cs" />
|
||||
<Compile Include="Commands\CmdTexture.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user