mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Get rid of Group.concatList and Level.CheckLoadOnGoto
Also less usage of ServerConfig.DefaultColor
This commit is contained in:
parent
80ea964409
commit
ff703947e5
@ -569,7 +569,7 @@ namespace MCGalaxy.Gui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
string mesg = pl.p.ColoredName + ServerConfig.DefaultColor + " " + "is now";
|
string mesg = pl.p.ColoredName + " %Sis now";
|
||||||
if ( pl.Red ) {
|
if ( pl.Red ) {
|
||||||
mesg += " on the " + Colors.red + "red team";
|
mesg += " on the " + Colors.red + "red team";
|
||||||
}
|
}
|
||||||
@ -577,7 +577,7 @@ namespace MCGalaxy.Gui {
|
|||||||
mesg += " on the " + Colors.blue + "blue team";
|
mesg += " on the " + Colors.blue + "blue team";
|
||||||
}
|
}
|
||||||
if ( pl.spec ) {
|
if ( pl.spec ) {
|
||||||
mesg += ServerConfig.DefaultColor + " (as a spectator)";
|
mesg += " (as a spectator)";
|
||||||
}
|
}
|
||||||
Chat.MessageGlobal(mesg);
|
Chat.MessageGlobal(mesg);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ namespace MCGalaxy.Commands.Fun {
|
|||||||
if (pl.Blue)
|
if (pl.Blue)
|
||||||
msg += " on the " + Colors.blue + "blue team";
|
msg += " on the " + Colors.blue + "blue team";
|
||||||
if (pl.spec)
|
if (pl.spec)
|
||||||
msg += ServerConfig.DefaultColor + " (as a spectator)";
|
msg += " %S(as a spectator)";
|
||||||
Chat.MessageGlobal(msg);
|
Chat.MessageGlobal(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ namespace MCGalaxy.Commands.Info {
|
|||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
string[] args = message.SplitSpaces(2);
|
string[] args = message.SplitSpaces(2);
|
||||||
if (message == "") {
|
if (message == "") {
|
||||||
Player.Message(p, "Available ranks: " + Group.concatList()); return;
|
Player.Message(p, "Available ranks: " +Group.GroupList.Join(g => g.ColoredName)); return;
|
||||||
}
|
}
|
||||||
string modifer = args.Length > 1 ? args[1] : "";
|
string modifer = args.Length > 1 ? args[1] : "";
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ namespace MCGalaxy.Commands.Info {
|
|||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
Player.Message(p, "/viewranks [rank] - Shows all players who have [rank]");
|
Player.Message(p, "/viewranks [rank] - Shows all players who have [rank]");
|
||||||
Player.Message(p, "/viewranks banned - Shows all players who are banned.");
|
Player.Message(p, "/viewranks banned - Shows all players who are banned.");
|
||||||
Player.Message(p, "Available ranks: " + Group.concatList());
|
Player.Message(p, "Available ranks: " + Group.GroupList.Join(g => g.ColoredName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ namespace MCGalaxy.Games
|
|||||||
if (!votes.ContainsKey(opt) && opt != map.name)
|
if (!votes.ContainsKey(opt) && opt != map.name)
|
||||||
{
|
{
|
||||||
votes.Add(opt, 0);
|
votes.Add(opt, 0);
|
||||||
str += ServerConfig.DefaultColor + ", &5" + opt.Capitalize();
|
str += "%S, &5" + opt.Capitalize();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -483,7 +483,7 @@ namespace MCGalaxy.Games
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
foreach (KeyValuePair<string, int> kvp in votes)
|
foreach (KeyValuePair<string, int> kvp in votes)
|
||||||
sb.AppendFormat("{0}, &5{1}", ServerConfig.DefaultColor, kvp.Key.Capitalize());
|
sb.AppendFormat("%S, &5{0}", kvp.Key.Capitalize());
|
||||||
sb.Remove(0, 4);
|
sb.Remove(0, 4);
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
@ -399,14 +399,6 @@ namespace MCGalaxy {
|
|||||||
lvl.UpdateBlockHandlers();
|
lvl.UpdateBlockHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CheckLoadOnGoto(string givenName) {
|
|
||||||
string value = LevelInfo.FindOfflineProperty(givenName, "loadongoto");
|
|
||||||
if (value == null) return true;
|
|
||||||
bool load;
|
|
||||||
if (!bool.TryParse(value, out load)) return true;
|
|
||||||
return load;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChatLevel(string message) {
|
public void ChatLevel(string message) {
|
||||||
ChatLevel(message, LevelPermission.Banned);
|
ChatLevel(message, LevelPermission.Banned);
|
||||||
}
|
}
|
||||||
|
@ -253,20 +253,6 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
return Group.standard;
|
return Group.standard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string concatList(bool includeColor = true, bool skipExtra = false, bool permissions = false) {
|
|
||||||
string sum = "";
|
|
||||||
foreach (Group grp in Group.GroupList) {
|
|
||||||
if (skipExtra && (grp.Permission < LevelPermission.Guest || grp.Permission >= LevelPermission.Nobody)) continue;
|
|
||||||
|
|
||||||
if (includeColor) sum += ", " + grp.ColoredName + ServerConfig.DefaultColor;
|
|
||||||
else if (permissions) sum += ", " + ((int)grp.Permission);
|
|
||||||
else sum += ", " + grp.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (includeColor) sum = sum.Remove(sum.Length - 2);
|
|
||||||
return sum.Remove(0, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary> Returns whether the given player is in the banned rank. </summary>
|
/// <summary> Returns whether the given player is in the banned rank. </summary>
|
||||||
|
@ -560,8 +560,8 @@ namespace MCGalaxy {
|
|||||||
if ( it.GameMode == TntWarsGame.TntWarsGameMode.TDM ) {
|
if ( it.GameMode == TntWarsGame.TntWarsGameMode.TDM ) {
|
||||||
TntWarsGame.player pl = it.FindPlayer(this);
|
TntWarsGame.player pl = it.FindPlayer(this);
|
||||||
foreach ( TntWarsGame.player p in it.Players ) {
|
foreach ( TntWarsGame.player p in it.Players ) {
|
||||||
if ( pl.Red && p.Red ) SendMessage(p.p, "To Team " + Colors.red + "-" + color + name + Colors.red + "- " + ServerConfig.DefaultColor + newtext);
|
if ( pl.Red && p.Red ) SendMessage(p.p, "To Team " + Colors.red + "-" + color + name + Colors.red + "- %S" + newtext);
|
||||||
if ( pl.Blue && p.Blue ) SendMessage(p.p, "To Team " + Colors.blue + "-" + color + name + Colors.blue + "- " + ServerConfig.DefaultColor + newtext);
|
if ( pl.Blue && p.Blue ) SendMessage(p.p, "To Team " + Colors.blue + "-" + color + name + Colors.blue + "- %S" + newtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Log(LogType.GameActivity, "[TNT Wars] [TeamChat (" + ( pl.Red ? "Red" : "Blue" ) + ") " + name + " " + newtext);
|
Logger.Log(LogType.GameActivity, "[TNT Wars] [TeamChat (" + ( pl.Red ? "Red" : "Blue" ) + ") " + name + " " + newtext);
|
||||||
|
@ -83,11 +83,19 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool LoadOfflineLevel(Player p, string name) {
|
static bool LoadOfflineLevel(Player p, string name) {
|
||||||
if (!Level.CheckLoadOnGoto(name)) {
|
string propsPath = LevelInfo.FindPropertiesFile(name);
|
||||||
|
LevelConfig cfg = new LevelConfig();
|
||||||
|
LevelConfig.Load(propsPath, cfg);
|
||||||
|
|
||||||
|
if (!cfg.LoadOnGoto) {
|
||||||
Player.Message(p, "Level \"{0}\" cannot be loaded using /goto.", name);
|
Player.Message(p, "Level \"{0}\" cannot be loaded using /goto.", name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LevelAccessController visitAccess = new LevelAccessController(null, cfg, true);
|
||||||
|
//bool ignorePerms = p.summonedMap != null && p.summonedMap.CaselessEq(name);
|
||||||
|
//if (!visitAccess.CheckDetailed(p, ignorePerms)) return false;
|
||||||
|
|
||||||
CmdLoad.LoadLevel(p, name, true);
|
CmdLoad.LoadLevel(p, name, true);
|
||||||
Level lvl = LevelInfo.FindExact(name);
|
Level lvl = LevelInfo.FindExact(name);
|
||||||
if (lvl != null) return GotoLevel(p, lvl);
|
if (lvl != null) return GotoLevel(p, lvl);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user