diff --git a/MCGalaxy/Chat/LineWrapper.cs b/MCGalaxy/Chat/LineWrapper.cs index 64498c250..ce2c82e34 100644 --- a/MCGalaxy/Chat/LineWrapper.cs +++ b/MCGalaxy/Chat/LineWrapper.cs @@ -28,36 +28,35 @@ namespace MCGalaxy { message = Regex.Replace(message, @"(&[0-9a-f])+$", ""); int limit = NetUtils.StringSize; string color = ""; - while ( message.Length > 0 ) { - //if (Regex.IsMatch(message, "&a")) break; + while (message.Length > 0) { - if ( lines.Count > 0 ) { - if ( message[0] == '&' ) + if (lines.Count > 0 ) { + if (message[0] == '&') message = "> " + message.Trim(); else message = "> " + color + message.Trim(); } - if ( message.IndexOf("&") == message.IndexOf("&", message.IndexOf("&") + 1) - 2 ) + if (message.IndexOf("&") == message.IndexOf("&", message.IndexOf("&") + 1) - 2) message = message.Remove(message.IndexOf("&"), 2); - if ( message.Length <= limit ) { lines.Add(message); break; } - for ( int i = limit - 1; i > limit - 20; --i ) - if ( message[i] == ' ' ) { + if (message.Length <= limit) { lines.Add(message); break; } + for (int i = limit - 1; i > limit - 20; i--) + if (message[i] == ' ') { lines.Add(message.Substring(0, i)); goto Next; } retry: - if ( message.Length == 0 || limit == 0 ) { return lines; } + if (message.Length == 0 || limit == 0) { return lines; } try { - if ( message.Substring(limit - 2, 1) == "&" || message.Substring(limit - 1, 1) == "&" ) { + if (message.Substring(limit - 2, 1) == "&" || message.Substring(limit - 1, 1) == "&") { message = message.Remove(limit - 2, 1); limit -= 2; goto retry; } - else if ( message[limit - 1] < 32 || message[limit - 1] > 127 ) { + else if (message[limit - 1] < 32 || message[limit - 1] > 127) { message = message.Remove(limit - 1, 1); limit -= 1; //goto retry; @@ -67,29 +66,29 @@ namespace MCGalaxy { lines.Add(message.Substring(0, limit)); Next: message = message.Substring(lines[lines.Count - 1].Length); - if ( lines.Count == 1 ) limit = 60; + if (lines.Count == 1) limit = 60; int index = lines[lines.Count - 1].LastIndexOf('&'); - if ( index != -1 ) { - if ( index < lines[lines.Count - 1].Length - 1 ) { + if (index != -1) { + if (index < lines[lines.Count - 1].Length - 1) { char next = lines[lines.Count - 1][index + 1]; - if ( Colors.Map(ref next) ) color = "&" + next; - if ( index == lines[lines.Count - 1].Length - 1 ) { + if (Colors.Map(ref next)) color = "&" + next; + if (index == lines[lines.Count - 1].Length - 1) { lines[lines.Count - 1] = lines[lines.Count - 1].Substring(0, lines[lines.Count - 1].Length - 2); } } - else if ( message.Length != 0 ) { + else if (message.Length != 0) { char next = message[0]; - if ( Colors.Map(ref next) ) color = "&" + next; + if (Colors.Map(ref next)) color = "&" + next; lines[lines.Count - 1] = lines[lines.Count - 1].Substring(0, lines[lines.Count - 1].Length - 1); message = message.Substring(1); } } } - for ( int i = 0; i < lines.Count; i++ ) // Gotta do it the old fashioned way... + for (int i = 0; i < lines.Count; i++) // Gotta do it the old fashioned way... { char[] temp = lines[i].ToCharArray(); - if ( temp[temp.Length - 2] == '&' ) { + if (temp[temp.Length - 2] == '&') { temp[temp.Length - 1] = ' '; temp[temp.Length - 2] = ' '; } diff --git a/MCGalaxy/Commands/Chat/CmdSend.cs b/MCGalaxy/Commands/Chat/CmdSend.cs index bde53d1b4..cf722984b 100644 --- a/MCGalaxy/Commands/Chat/CmdSend.cs +++ b/MCGalaxy/Commands/Chat/CmdSend.cs @@ -16,7 +16,6 @@ permissions and limitations under the Licenses. */ using System; -using System.Text.RegularExpressions; using MCGalaxy.SQL; namespace MCGalaxy.Commands.Chatting { diff --git a/MCGalaxy/Player/Player.Handlers.cs b/MCGalaxy/Player/Player.Handlers.cs index 0c3ff10da..a54a1dfb4 100644 --- a/MCGalaxy/Player/Player.Handlers.cs +++ b/MCGalaxy/Player/Player.Handlers.cs @@ -28,7 +28,6 @@ using MCGalaxy.Network; using MCGalaxy.SQL; using MCGalaxy.Util; using BlockID = System.UInt16; -using BlockRaw = System.Byte; namespace MCGalaxy { public partial class Player : IDisposable { diff --git a/MCGalaxy/Player/Player.cs b/MCGalaxy/Player/Player.cs index e74d4ec2d..98fd467a6 100644 --- a/MCGalaxy/Player/Player.cs +++ b/MCGalaxy/Player/Player.cs @@ -15,19 +15,16 @@ permissions and limitations under the Licenses. using System; using System.Collections.Generic; using System.IO; -using System.Net; using System.Net.Sockets; using System.Threading; -using MCGalaxy.Blocks; using MCGalaxy.DB; using MCGalaxy.Drawing; using MCGalaxy.Events.EconomyEvents; using MCGalaxy.Events.PlayerEvents; using MCGalaxy.Games; -using MCGalaxy.SQL; -using MCGalaxy.Network; -using MCGalaxy.Tasks; using MCGalaxy.Maths; +using MCGalaxy.Network; +using MCGalaxy.SQL; using BlockID = System.UInt16; namespace MCGalaxy {