mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 20:16:36 -04:00
Don't save global blocks list on server start
also remove some obsolete LS/ZS config stuff
This commit is contained in:
parent
084fc09e5f
commit
7ffa5493ad
@ -144,7 +144,6 @@ namespace MCGalaxy {
|
||||
Logger.LogError(ex);
|
||||
}
|
||||
|
||||
Save(true, null);
|
||||
// As the BlockDefinition instances in levels will now be different
|
||||
// to the instances in GlobalDefs, we need to update them.
|
||||
if (oldDefs != null) UpdateLoadedLevels(oldDefs);
|
||||
|
@ -91,14 +91,13 @@ namespace MCGalaxy {
|
||||
if (who == null) return;
|
||||
if (who == p) { Player.Message(p, "Trying to talk to yourself, huh?"); return; }
|
||||
|
||||
if (who.Ignores.All) {
|
||||
DoFakePM(p, who, message);
|
||||
} else if (who.Ignores.Names.CaselessContains(p.name)) {
|
||||
DoFakePM(p, who, message);
|
||||
} else {
|
||||
DoPM(p, who, message);
|
||||
}
|
||||
Logger.Log(LogType.PrivateChat, "{0} @{1}: {2}", p.name, who.name, message);
|
||||
Player.Message(p, "[<] {0}: &f{1}", who.ColoredName, message);
|
||||
|
||||
if (!Chat.Ignoring(who, p)) {
|
||||
Player.Message(who, "&9[>] {0}: &f{1}", p.ColoredName, message);
|
||||
}
|
||||
|
||||
p.CheckForMessageSpam();
|
||||
}
|
||||
|
||||
@ -109,16 +108,5 @@ namespace MCGalaxy {
|
||||
|
||||
p.CheckForMessageSpam();
|
||||
}
|
||||
|
||||
static void DoFakePM(Player p, Player who, string message) {
|
||||
Logger.Log(LogType.PrivateChat, "{0} @{1}: {2}", p.name, who.name, message);
|
||||
Player.Message(p, "[<] {0}: &f{1}", who.ColoredName, message);
|
||||
}
|
||||
|
||||
static void DoPM(Player p, Player who, string message) {
|
||||
Logger.Log(LogType.PrivateChat, "{0} @{1}: {2}", p.name, who.name, message);
|
||||
Player.Message(p, "[<] {0}: &f{1}", who.ColoredName, message);
|
||||
Player.Message(who, "&9[>] {0}: &f{1}", p.ColoredName, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -732,7 +732,7 @@ namespace MCGalaxy.Commands.CPE {
|
||||
"Minimum coordinates for a normal block are &40 &20 &10." } },
|
||||
{ "max", new string[] { "Enter the three maximum coordinates of the cube in units (separated by spaces). 1 block = 16 units.",
|
||||
"Maximum coordinates for a normal block are &416 &216 &116." } },
|
||||
{ "collide", new string[] { "Type a number between '0' and '6' for collision type.",
|
||||
{ "collide", new string[] { "Type a number between '0' and '7' for collision type.",
|
||||
"0 - block is walk-through (e.g. air).", "1 - block is swim-through/climbable (e.g. rope).",
|
||||
"2 - block is solid (e.g. dirt).", "3 - block is solid, but slippery like ice",
|
||||
"4 - block is solid, but even slipperier than ice", "5 - block is swim-through like water",
|
||||
|
@ -44,8 +44,6 @@ namespace MCGalaxy {
|
||||
old = new OldPerms();
|
||||
if (PropertiesFile.Read(Paths.ServerPropsFile, ref old, LineProcessor))
|
||||
Server.SettingsUpdate();
|
||||
if (old.saveZS)
|
||||
ZSConfig.SaveSettings();
|
||||
ZSConfig.LoadSettings();
|
||||
|
||||
Database.Backend = ServerConfig.UseMySQL ? MySQLBackend.Instance : SQLiteBackend.Instance;
|
||||
@ -88,12 +86,7 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
if (!ConfigElement.Parse(Server.serverConfig, key, value, null)) {
|
||||
// Backwards compatibility: ZS used to be part of server.properties
|
||||
if (ConfigElement.Parse(Server.zombieConfig, key, value, null)) {
|
||||
perms.saveZS = true;
|
||||
} else {
|
||||
Logger.Log(LogType.Warning, "\"{0}\" was not a recognised server property key.", key);
|
||||
}
|
||||
Logger.Log(LogType.Warning, "\"{0}\" was not a recognised server property key.", key);
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +96,6 @@ namespace MCGalaxy {
|
||||
public int viewPerm = -1, nextPerm = -1, clearPerm = -1, opchatPerm = -1, adminchatPerm = -1;
|
||||
public int mapGenLimit = -1, mapGenLimitAdmin = -1;
|
||||
public int afkKickMins = -1; public LevelPermission afkKickMax = LevelPermission.Banned;
|
||||
public bool saveZS;
|
||||
}
|
||||
|
||||
internal static void FixupOldPerms() {
|
||||
|
@ -41,13 +41,11 @@ namespace MCGalaxy.Games {
|
||||
return data;
|
||||
}
|
||||
|
||||
bool needsSaveSettings;
|
||||
public void LoadSettings() {
|
||||
if (!File.Exists("properties/lavasurvival.properties")) { SaveSettings(); return; }
|
||||
|
||||
try {
|
||||
PropertiesFile.Read("properties/lavasurvival.properties", ProcessSettingsLine);
|
||||
if (needsSaveSettings) SaveSettings();
|
||||
} catch (Exception e) {
|
||||
Logger.LogError(e);
|
||||
}
|
||||
@ -57,15 +55,6 @@ namespace MCGalaxy.Games {
|
||||
switch (key.ToLower()) {
|
||||
case "start-on-startup": StartOnStartup = bool.Parse(value); break;
|
||||
case "lives": MaxLives = int.Parse(value); break;
|
||||
|
||||
case "setup-rank":
|
||||
LevelPermission setupRank = Group.ParsePermOrName(value, LevelPermission.Admin);
|
||||
UpdateExtraPerms(setupRank, 1);
|
||||
break;
|
||||
case "control-rank":
|
||||
LevelPermission controlRank = Group.ParsePermOrName(value, LevelPermission.Operator);
|
||||
UpdateExtraPerms(controlRank, 2);
|
||||
break;
|
||||
case "maps":
|
||||
foreach (string name in value.Split(',')) {
|
||||
string map = name.Trim();
|
||||
@ -77,13 +66,6 @@ namespace MCGalaxy.Games {
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateExtraPerms(LevelPermission perm, int num) {
|
||||
CommandExtraPerms.Load();
|
||||
CommandExtraPerms.Set("lavasurvival", perm, "temp desc", num);
|
||||
CommandExtraPerms.Save();
|
||||
needsSaveSettings = true;
|
||||
}
|
||||
|
||||
public void SaveSettings() {
|
||||
using (StreamWriter w = new StreamWriter("properties/lavasurvival.properties")) {
|
||||
w.WriteLine("#Lava Survival main properties");
|
||||
|
@ -32,8 +32,8 @@ namespace MCGalaxy {
|
||||
internal Connection connection;
|
||||
internal string[] channels, opchannels;
|
||||
internal string nick, server;
|
||||
internal bool reset = false;
|
||||
internal byte retries = 0;
|
||||
internal bool resetting;
|
||||
internal byte retries;
|
||||
IRCHandlers handlers;
|
||||
ConnectionArgs args;
|
||||
|
||||
@ -78,7 +78,7 @@ namespace MCGalaxy {
|
||||
|
||||
/// <summary> Disconnects this bot from IRC, then reconnects to IRC if IRC is enabled. </summary>
|
||||
public void Reset() {
|
||||
reset = true;
|
||||
resetting = true;
|
||||
retries = 0;
|
||||
Disconnect("IRC Bot resetting...");
|
||||
if (!ServerConfig.UseIRC) return;
|
||||
|
@ -125,27 +125,30 @@ namespace MCGalaxy.Network {
|
||||
bot.Say("*" + p.DisplayName + " " + message, stealth);
|
||||
}
|
||||
|
||||
bool ToPublicChannel(ChatScope scope, object arg, ChatMessageFilter filter) {
|
||||
return Chat.scopeFilters[(int)scope](ircGuest, arg)
|
||||
&& (filter == null || filter(ircGuest, arg));
|
||||
void MessageToIRC(ChatScope scope, string msg, object arg, ChatMessageFilter filter) {
|
||||
ChatMessageFilter scopeFilter = Chat.scopeFilters[(int)scope];
|
||||
|
||||
if (scopeFilter(ircGuest, arg) && (filter == null || filter(ircGuest, arg))) {
|
||||
bot.Say(msg, false);
|
||||
} else {
|
||||
// TODO: Check filters!!!!!
|
||||
bot.Say(msg, true);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleChatSys(ChatScope scope, string msg, object arg,
|
||||
ref ChatMessageFilter filter, bool irc) {
|
||||
if (!irc) return;
|
||||
bot.Say(msg, !ToPublicChannel(scope, arg, filter));
|
||||
if (irc) MessageToIRC(scope, msg, arg, filter);
|
||||
}
|
||||
|
||||
void HandleChatFrom(ChatScope scope, Player source, string msg,
|
||||
object arg, ref ChatMessageFilter filter, bool irc) {
|
||||
if (!irc) return;
|
||||
bot.Say(Unescape(source, msg), !ToPublicChannel(scope, arg, filter));
|
||||
if (irc) MessageToIRC(scope, Unescape(source, msg), arg, filter);
|
||||
}
|
||||
|
||||
void HandleChat(ChatScope scope, Player source, string msg,
|
||||
object arg, ref ChatMessageFilter filter, bool irc) {
|
||||
if (!irc) return;
|
||||
bot.Say(Unescape(source, msg), !ToPublicChannel(scope, arg, filter));
|
||||
if (irc) MessageToIRC(scope, Unescape(source, msg), arg, filter);
|
||||
}
|
||||
|
||||
void HandleShutdown(bool restarting, string message) {
|
||||
@ -344,7 +347,7 @@ namespace MCGalaxy.Network {
|
||||
|
||||
void Listener_OnRegistered() {
|
||||
Logger.Log(LogType.IRCCActivity, "Connected to IRC!");
|
||||
bot.reset = false;
|
||||
bot.resetting = false;
|
||||
bot.retries = 0;
|
||||
|
||||
Authenticate();
|
||||
@ -378,7 +381,7 @@ namespace MCGalaxy.Network {
|
||||
}
|
||||
|
||||
void Listener_OnDisconnected() {
|
||||
if (!bot.reset && bot.retries < 3) { bot.retries++; bot.Connect(); }
|
||||
if (!bot.resetting && bot.retries < 3) { bot.retries++; bot.Connect(); }
|
||||
}
|
||||
|
||||
void Listener_OnNick(UserInfo user, string newNick) {
|
||||
|
@ -55,7 +55,7 @@ namespace MCGalaxy {
|
||||
PlayerChat,
|
||||
|
||||
/// <summary> Chat from IRC. </summary>
|
||||
IRCChat,
|
||||
IRCChat,
|
||||
|
||||
/// <summary> Chat to all players in a particular chatroom, or across all chatrooms. </summary>
|
||||
ChatroomChat,
|
||||
|
@ -54,7 +54,7 @@ namespace MCGalaxy {
|
||||
public static INetworkListen Listener;
|
||||
|
||||
//Other
|
||||
public static bool ServerSetupFinished = false;
|
||||
public static bool SetupFinished = false;
|
||||
public static CTFGame ctf = new CTFGame();
|
||||
|
||||
public static PlayerList bannedIP, whiteList, ircControllers, invalidIds;
|
||||
|
@ -62,7 +62,7 @@ namespace MCGalaxy {
|
||||
hidden = PlayerList.Load("ranks/hidden.txt");
|
||||
vip = PlayerList.Load("text/vip.txt");
|
||||
noEmotes = PlayerList.Load("text/emotelist.txt");
|
||||
lockdown = PlayerList.Load("text/lockdown.txt");
|
||||
lockdown = PlayerList.Load("text/lockdown.txt");
|
||||
models = PlayerExtList.Load("extra/models.txt");
|
||||
skins = PlayerExtList.Load("extra/skins.txt");
|
||||
reach = PlayerExtList.Load("extra/reach.txt");
|
||||
@ -71,9 +71,9 @@ namespace MCGalaxy {
|
||||
modelScales = PlayerExtList.Load("extra/modelscales.txt");
|
||||
|
||||
muted = PlayerExtList.Load("ranks/muted.txt");
|
||||
frozen = PlayerExtList.Load("ranks/frozen.txt");
|
||||
frozen = PlayerExtList.Load("ranks/frozen.txt");
|
||||
tempRanks = PlayerExtList.Load(Paths.TempRanksFile);
|
||||
tempBans = PlayerExtList.Load(Paths.TempBansFile);
|
||||
tempBans = PlayerExtList.Load(Paths.TempBansFile);
|
||||
ModerationTasks.QueueTasks();
|
||||
|
||||
if (ServerConfig.WhitelistedOnly)
|
||||
@ -129,7 +129,7 @@ namespace MCGalaxy {
|
||||
TimeSpan.FromMilliseconds(20));
|
||||
|
||||
Logger.Log(LogType.SystemActivity, "Finished setting up server, finding classicube.net url..");
|
||||
ServerSetupFinished = true;
|
||||
SetupFinished = true;
|
||||
}
|
||||
|
||||
static void InitZombieSurvival() {
|
||||
|
@ -268,7 +268,7 @@ namespace MCGalaxy {
|
||||
lvl.SaveBlockDBChanges();
|
||||
}
|
||||
|
||||
if (Server.ServerSetupFinished && !ServerConfig.AutoLoadMaps) {
|
||||
if (Server.SetupFinished && !ServerConfig.AutoLoadMaps) {
|
||||
File.WriteAllText("text/autoload.txt", autoload);
|
||||
}
|
||||
} catch (Exception ex) { Logger.LogError(ex); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user