mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 23:02:04 -04:00
Remove some unused code, also allow configuring gen/admingen limits. (Thanks FabTheZen)
This commit is contained in:
parent
8fe518da49
commit
98ed1bc4f4
@ -44,18 +44,6 @@ namespace MCGalaxy.Commands
|
|||||||
if (p.ignoreGlobalChat || p.ignoreAll) { Player.SendMessage(p, "You cannot use Global Chat while you have it muted."); return; }
|
if (p.ignoreGlobalChat || p.ignoreAll) { Player.SendMessage(p, "You cannot use Global Chat while you have it muted."); return; }
|
||||||
if (Server.chatmod && !p.voice) { Player.SendMessage(p, "You cannot use Global Chat while in Chat Moderation!"); return; }
|
if (Server.chatmod && !p.voice) { Player.SendMessage(p, "You cannot use Global Chat while in Chat Moderation!"); return; }
|
||||||
if (!Server.gcaccepted.Contains(p.name.ToLower())) { RulesMethod(p); return; }
|
if (!Server.gcaccepted.Contains(p.name.ToLower())) { RulesMethod(p); return; }
|
||||||
|
|
||||||
string reason;
|
|
||||||
if (Server.gcnamebans.TryGetValue(p.name.ToLower(), out reason)) {
|
|
||||||
Player.SendMessage(p, "You are %cBANNED" + Server.DefaultColor + " from %GGlobal Chat" + Server.DefaultColor + " by " + reason);
|
|
||||||
Player.SendMessage(p, "You can apply a 'Ban Appeal' at %9www.mcgalaxy.ml");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Server.gcipbans.TryGetValue(p.ip, out reason)) {
|
|
||||||
Player.SendMessage(p, "Your IP is %cBANNED" + Server.DefaultColor + " from%G Global Chat" + Server.DefaultColor + " by " + reason);
|
|
||||||
Player.SendMessage(p, "You can apply a 'Ban Appeal' at %9www.mcgalaxy.ml");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} //Server.GlobalChat.Say((p != null ? p.name + ": " : "Console: ") + message, p);
|
} //Server.GlobalChat.Say((p != null ? p.name + ": " : "Console: ") + message, p);
|
||||||
Server.GlobalChat.Say(p == null ? "Console: " + message : p.name + ": " + message, p);
|
Server.GlobalChat.Say(p == null ? "Console: " + message : p.name + ": " + message, p);
|
||||||
Player.GlobalMessage("%G<[Global] " + (p != null ? p.name + ": " : "Console: ") + "&f" + (Server.profanityFilter ? ProfanityFilter.Parse(message) : message), true);
|
Player.GlobalMessage("%G<[Global] " + (p != null ? p.name + ": " : "Console: ") + "&f" + (Server.profanityFilter ? ProfanityFilter.Parse(message) : message), true);
|
||||||
|
@ -37,19 +37,35 @@ namespace MCGalaxy.Commands {
|
|||||||
switch (args[0].ToLower()) {
|
switch (args[0].ToLower()) {
|
||||||
case "rt":
|
case "rt":
|
||||||
case "reloadthreshold":
|
case "reloadthreshold":
|
||||||
Player.GlobalMessage("Threshold before drawing reloads map changed to &b" + limit);
|
Player.GlobalMessage("Threshold before drawing reloads map set to &b" + limit);
|
||||||
Server.DrawReloadLimit = limit; return;
|
Server.DrawReloadLimit = limit;
|
||||||
|
SrvProperties.Save(); return;
|
||||||
case "rp":
|
case "rp":
|
||||||
case "restartphysics":
|
case "restartphysics":
|
||||||
Player.GlobalMessage("Custom /rp's limit was changed to &b" + limit);
|
Player.GlobalMessage("Custom /rp's limit was changed to &b" + limit);
|
||||||
Server.rpLimit = limit; return;
|
Server.rpLimit = limit;
|
||||||
|
SrvProperties.Save(); return;
|
||||||
case "rpnormal":
|
case "rpnormal":
|
||||||
Player.GlobalMessage("Normal /rp's limit was changed to &b" + limit);
|
Player.GlobalMessage("Normal /rp's limit set to &b" + limit);
|
||||||
Server.rpNormLimit = limit; return;
|
Server.rpNormLimit = limit;
|
||||||
|
SrvProperties.Save(); return;
|
||||||
case "pu":
|
case "pu":
|
||||||
case "physicsundo":
|
case "physicsundo":
|
||||||
Player.GlobalMessage("Physics undo max entries was changed to &b" + limit);
|
Player.GlobalMessage("Physics undo max entries set to &b" + limit);
|
||||||
Server.physUndo = limit; return;
|
Server.physUndo = limit;
|
||||||
|
SrvProperties.Save(); return;
|
||||||
|
case "gen":
|
||||||
|
case "genlimit":
|
||||||
|
Player.GlobalMessage("Maximum volume of maps players can generate set to &b" + limit);
|
||||||
|
Server.MapGenLimit = limit;
|
||||||
|
SrvProperties.Save(); return;
|
||||||
|
case "genadmin":
|
||||||
|
case "genadminlimit":
|
||||||
|
case "admingen":
|
||||||
|
case "admingenlimit":
|
||||||
|
Player.GlobalMessage("Maximum volume of maps admins can generate set to &b" + limit);
|
||||||
|
Server.MapGenLimitAdmin = limit;
|
||||||
|
SrvProperties.Save(); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.Length == 2) { Player.SendMessage(p, "You need to provide a rank name for this type."); return; }
|
if (args.Length == 2) { Player.SendMessage(p, "You need to provide a rank name for this type."); return; }
|
||||||
@ -59,11 +75,11 @@ namespace MCGalaxy.Commands {
|
|||||||
switch (args[0].ToLower()) {
|
switch (args[0].ToLower()) {
|
||||||
case "dl":
|
case "dl":
|
||||||
case "drawlimit":
|
case "drawlimit":
|
||||||
Player.GlobalMessage(grp.color + grp.name + "%S's draw limit was set to &b" + limit);
|
Player.GlobalMessage(grp.color + grp.name + "%S's draw limit set to &b" + limit);
|
||||||
grp.maxBlocks = limit; break;
|
grp.maxBlocks = limit; break;
|
||||||
case "mu":
|
case "mu":
|
||||||
case "maxundo":
|
case "maxundo":
|
||||||
Player.GlobalMessage(grp.color + grp.name + "%S's undo limit was set to &b" + limit);
|
Player.GlobalMessage(grp.color + grp.name + "%S's undo limit set to &b" + limit);
|
||||||
grp.maxUndo = limit; break;
|
grp.maxUndo = limit; break;
|
||||||
default:
|
default:
|
||||||
Help(p); return;
|
Help(p); return;
|
||||||
@ -74,7 +90,8 @@ namespace MCGalaxy.Commands {
|
|||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
Player.SendMessage(p, "/limit <type> <amount> [rank] - Sets the limit for <type>");
|
Player.SendMessage(p, "/limit <type> <amount> [rank] - Sets the limit for <type>");
|
||||||
Player.SendMessage(p, "Valid types: reloadthreshold(rt), restartphysics(rp), " +
|
Player.SendMessage(p, "Valid types: reloadthreshold(rt), restartphysics(rp), " +
|
||||||
"rpnormal, physicsundo(pu), drawlimit(dl), maxundo(mu)");
|
"rpnormal, physicsundo(pu), drawlimit(dl), maxundo(mu), genlimit(gen), " +
|
||||||
|
"admingenlimit(admingen)");
|
||||||
Player.SendMessage(p, "Rank is required for drawlimit and maxundo types.");
|
Player.SendMessage(p, "Rank is required for drawlimit and maxundo types.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,10 +60,13 @@ namespace MCGalaxy.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
int limit = p.group.Permission < LevelPermission.Admin ? 30000000 : 225000000;
|
int limit = p.group.Permission < LevelPermission.Admin ?
|
||||||
if (x * y * z > limit ) {
|
Server.MapGenLimit : Server.MapGenLimitAdmin;
|
||||||
string text = String.Format("Cannot create a map with over {0} million blocks",
|
if ((long)x * y * z > limit ) {
|
||||||
limit / 1000000);
|
string text = "You cannot create a map with over ";
|
||||||
|
if (limit > 1000 * 1000) text += (limit / (1000 * 1000)) + " million blocks";
|
||||||
|
else if (limit > 1000) text += (limit / 1000) + " thousand blocks";
|
||||||
|
else text += limit + " blocks";
|
||||||
Player.SendMessage(p, text); return;
|
Player.SendMessage(p, text); return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ namespace MCGalaxy.Commands {
|
|||||||
if (hasExt && url == "")
|
if (hasExt && url == "")
|
||||||
pl.SendCurrentMapAppearance();
|
pl.SendCurrentMapAppearance();
|
||||||
}
|
}
|
||||||
SrvProperties.Save("properties/server.properties");
|
SrvProperties.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateLevel(Player p, bool zip) {
|
void UpdateLevel(Player p, bool zip) {
|
||||||
|
@ -163,7 +163,6 @@ namespace MCGalaxy.Commands
|
|||||||
|
|
||||||
Server.afkset = new List<string>();
|
Server.afkset = new List<string>();
|
||||||
Server.ircafkset = new List<string>();
|
Server.ircafkset = new List<string>();
|
||||||
Server.afkmessages = new List<string>();
|
|
||||||
Server.messages = new List<string>();
|
Server.messages = new List<string>();
|
||||||
|
|
||||||
Server.restartcountdown = "";
|
Server.restartcountdown = "";
|
||||||
@ -256,6 +255,8 @@ namespace MCGalaxy.Commands
|
|||||||
Server.notifyOnJoinLeave = false;
|
Server.notifyOnJoinLeave = false;
|
||||||
Server.repeatMessage = false;
|
Server.repeatMessage = false;
|
||||||
Server.DrawReloadLimit = 10000;
|
Server.DrawReloadLimit = 10000;
|
||||||
|
Server.MapGenLimit = 30 * 1000 * 1000;
|
||||||
|
Server.MapGenLimitAdmin = 225 * 1000 * 1000;
|
||||||
|
|
||||||
Server.checkUpdates = true;
|
Server.checkUpdates = true;
|
||||||
|
|
||||||
|
@ -551,6 +551,14 @@ namespace MCGalaxy {
|
|||||||
try { Server.DrawReloadLimit = int.Parse(value); }
|
try { Server.DrawReloadLimit = int.Parse(value); }
|
||||||
catch { Server.s.Log("Invalid " + key + ". Using default"); Server.DrawReloadLimit = 10000; }
|
catch { Server.s.Log("Invalid " + key + ". Using default"); Server.DrawReloadLimit = 10000; }
|
||||||
break;
|
break;
|
||||||
|
case "map-gen-limit":
|
||||||
|
try { Server.MapGenLimit = int.Parse(value); }
|
||||||
|
catch { Server.s.Log("Invalid " + key + ". Using default"); Server.MapGenLimit = 30 * 1000 * 1000; }
|
||||||
|
break;
|
||||||
|
case "map-gen-limit-admin":
|
||||||
|
try { Server.MapGenLimitAdmin = int.Parse(value); }
|
||||||
|
catch { Server.s.Log("Invalid " + key + ". Using default"); Server.MapGenLimitAdmin = 225 * 1000 * 1000; }
|
||||||
|
break;
|
||||||
|
|
||||||
case "review-view-perm":
|
case "review-view-perm":
|
||||||
try {
|
try {
|
||||||
@ -640,6 +648,8 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
} return true;
|
} return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Save() { Save("properties/server.properties"); }
|
||||||
|
|
||||||
public static void Save(string givenPath) {
|
public static void Save(string givenPath) {
|
||||||
try {
|
try {
|
||||||
@ -817,6 +827,8 @@ namespace MCGalaxy {
|
|||||||
w.WriteLine("total-undo = " + Server.totalUndo);
|
w.WriteLine("total-undo = " + Server.totalUndo);
|
||||||
w.WriteLine("physics-undo-max = " + Server.physUndo);
|
w.WriteLine("physics-undo-max = " + Server.physUndo);
|
||||||
w.WriteLine("draw-reload-limit = " + Server.DrawReloadLimit);
|
w.WriteLine("draw-reload-limit = " + Server.DrawReloadLimit);
|
||||||
|
w.WriteLine("map-gen-limit = " + Server.MapGenLimit);
|
||||||
|
w.WriteLine("map-gen-limit-admin = " + Server.MapGenLimitAdmin);
|
||||||
w.WriteLine();
|
w.WriteLine();
|
||||||
w.WriteLine("# backup options");
|
w.WriteLine("# backup options");
|
||||||
w.WriteLine("backup-time = " + Server.backupInterval.ToString());
|
w.WriteLine("backup-time = " + Server.backupInterval.ToString());
|
||||||
|
@ -77,11 +77,10 @@ namespace MCGalaxy
|
|||||||
|
|
||||||
public static Version Version { get { return System.Reflection.Assembly.GetAssembly(typeof(Server)).GetName().Version; } }
|
public static Version Version { get { return System.Reflection.Assembly.GetAssembly(typeof(Server)).GetName().Version; } }
|
||||||
|
|
||||||
public static string VersionString
|
public static string VersionString {
|
||||||
{
|
get {
|
||||||
get
|
Version v = Version;
|
||||||
{
|
return v.Major + "." + v.Minor + "." + v.Build;
|
||||||
return Version.Major + "." + Version.Minor + "." + Version.Build;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,13 +92,7 @@ namespace MCGalaxy
|
|||||||
public static System.Timers.Timer updateTimer = new System.Timers.Timer(100);
|
public static System.Timers.Timer updateTimer = new System.Timers.Timer(100);
|
||||||
//static System.Timers.Timer heartbeatTimer = new System.Timers.Timer(60000); //Every 45 seconds
|
//static System.Timers.Timer heartbeatTimer = new System.Timers.Timer(60000); //Every 45 seconds
|
||||||
static System.Timers.Timer messageTimer = new System.Timers.Timer(60000 * 5); //Every 5 mins
|
static System.Timers.Timer messageTimer = new System.Timers.Timer(60000 * 5); //Every 5 mins
|
||||||
public static System.Timers.Timer cloneTimer = new System.Timers.Timer(5000);
|
|
||||||
|
|
||||||
//public static Thread physThread;
|
|
||||||
//public static bool physPause;
|
|
||||||
//public static DateTime physResume = DateTime.Now;
|
|
||||||
//public static System.Timers.Timer physTimer = new System.Timers.Timer(1000);
|
|
||||||
// static Thread botsThread;
|
|
||||||
//Chatrooms
|
//Chatrooms
|
||||||
public static List<string> Chatrooms = new List<string>();
|
public static List<string> Chatrooms = new List<string>();
|
||||||
//Other
|
//Other
|
||||||
@ -136,17 +129,11 @@ namespace MCGalaxy
|
|||||||
public static List<string> reviewlist = new List<string>();
|
public static List<string> reviewlist = new List<string>();
|
||||||
//Global Chat Rules Accepted list
|
//Global Chat Rules Accepted list
|
||||||
public static List<string> gcaccepted = new List<string>();
|
public static List<string> gcaccepted = new List<string>();
|
||||||
//public static List<levelID> allLevels = new List<levelID>();
|
|
||||||
public struct levelID { public int ID; public string name; }
|
|
||||||
|
|
||||||
public static List<string> afkset = new List<string>();
|
public static List<string> afkset = new List<string>();
|
||||||
public static List<string> ircafkset = new List<string>();
|
public static List<string> ircafkset = new List<string>();
|
||||||
public static List<string> afkmessages = new List<string>();
|
|
||||||
public static List<string> messages = new List<string>();
|
public static List<string> messages = new List<string>();
|
||||||
|
|
||||||
public static Dictionary<string, string> gcnamebans = new Dictionary<string, string>();
|
|
||||||
public static Dictionary<string, string> gcipbans = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
public static DateTime timeOnline;
|
public static DateTime timeOnline;
|
||||||
public static string IP;
|
public static string IP;
|
||||||
//auto updater stuff
|
//auto updater stuff
|
||||||
@ -351,6 +338,8 @@ namespace MCGalaxy
|
|||||||
public static LevelPermission reviewclear = LevelPermission.Operator;
|
public static LevelPermission reviewclear = LevelPermission.Operator;
|
||||||
|
|
||||||
public static int DrawReloadLimit = 10000;
|
public static int DrawReloadLimit = 10000;
|
||||||
|
public static int MapGenLimitAdmin = 225 * 1000 * 1000;
|
||||||
|
public static int MapGenLimit = 30 * 1000 * 1000;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public static MainLoop ml;
|
public static MainLoop ml;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user